Subversion Repositories Kolibri OS

Rev

Rev 7698 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ; libcrash -- cryptographic hash (and other) functions
  2. ;
  3. ; Copyright (C) <2012-2014,2016,2019,2021> Ivan Baravy
  4. ;
  5. ; SPDX-License-Identifier: GPL-2.0-or-later
  6. ;
  7. ; This program is free software: you can redistribute it and/or modify it under
  8. ; the terms of the GNU General Public License as published by the Free Software
  9. ; Foundation, either version 2 of the License, or (at your option) any later
  10. ; version.
  11. ;
  12. ; This program is distributed in the hope that it will be useful, but WITHOUT
  13. ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  14. ; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  15. ;
  16. ; You should have received a copy of the GNU General Public License along with
  17. ; this program. If not, see <http://www.gnu.org/licenses/>.
  18.  
  19. LIBCRASH_ALIGN = 16     ; align your data for speed
  20.  
  21. ; hash IDs
  22. LIBCRASH_CRC32          = 0
  23. LIBCRASH_MD5            = 1
  24. LIBCRASH_SHA1           = 2
  25. LIBCRASH_SHA2_224       = 3
  26. LIBCRASH_SHA2_256       = 4
  27. LIBCRASH_SHA2_384       = 5
  28. LIBCRASH_SHA2_512       = 6
  29. LIBCRASH_SHA3_224       = 7
  30. LIBCRASH_SHA3_256       = 8
  31. LIBCRASH_SHA3_384       = 9
  32. LIBCRASH_SHA3_512       = 10
  33.  
  34. ; mac IDs
  35. LIBCRASH_POLY1305       = 0
  36. LIBCRASH_HMAC_SHA2_256  = 1
  37. LIBCRASH_HMAC_SHA2_512  = 2
  38.  
  39. ; cipher IDs
  40. LIBCRASH_CHACHA20       = 0
  41. LIBCRASH_AES_256_CTR    = 1
  42. LIBCRASH_AES_256_CBC    = 2
  43.  
  44. ; cipher flags for crash_crypt
  45. LIBCRASH_CIPHER_ENCRYPT = 0000b
  46. LIBCRASH_CIPHER_DECRYPT = 0001b
  47. LIBCRASH_CIPHER_PADDING = 0010b ; PKCS#5
  48.  
  49. ; cipher output can be larger than input, e.g. for CBC mode with padding
  50. CBC128_MAX_PAD_LEN = 128/8
  51. LIBCRASH_MAX_PAD_LEN = CBC128_MAX_PAD_LEN
  52.  
  53. CRC32_LEN    = 4
  54. MD5_LEN      = 16
  55. SHA1_LEN     = 20
  56. SHA2_224_LEN = 28
  57. SHA2_256_LEN = 32
  58. SHA2_384_LEN = 48
  59. SHA2_512_LEN = 64
  60. SHA3_224_LEN = 28
  61. SHA3_256_LEN = 32
  62. SHA3_384_LEN = 48
  63. SHA3_512_LEN = 64
  64. MAX_HASH_LEN = SHA3_512_LEN
  65.  
  66. POLY1305_LEN = 16
  67. HMAC_SHA2_256_LEN = SHA2_256_LEN
  68. HMAC_SHA2_512_LEN = SHA2_512_LEN
  69.  
  70. LIBCRASH_CTX_LEN = 0x500
  71.