1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis 3 * 4 * LibTomCrypt is a library that provides various cryptographic 5 * algorithms in a highly modular and flexible manner. 6 * 7 * The library is free for all purposes without any express 8 * guarantee it works. 9 */ 10 11 /* ---- SYMMETRIC KEY STUFF ----- 12 * 13 * We put each of the ciphers scheduled keys in their own structs then we put all of 14 * the key formats in one union. This makes the function prototypes easier to use. 15 */ 16 #ifdef LTC_BLOWFISH 17 struct blowfish_key { 18 ulong32 S[4][256]; 19 ulong32 K[18]; 20 }; 21 #endif 22 23 #ifdef LTC_RC5 24 struct rc5_key { 25 int rounds; 26 ulong32 K[50]; 27 }; 28 #endif 29 30 #ifdef LTC_RC6 31 struct rc6_key { 32 ulong32 K[44]; 33 }; 34 #endif 35 36 #ifdef LTC_SAFERP 37 struct saferp_key { 38 unsigned char K[33][16]; 39 long rounds; 40 }; 41 #endif 42 43 #ifdef LTC_RIJNDAEL 44 struct rijndael_key { 45 ulong32 eK[60], dK[60]; 46 int Nr; 47 }; 48 #endif 49 50 #ifdef LTC_KSEED 51 struct kseed_key { 52 ulong32 K[32], dK[32]; 53 }; 54 #endif 55 56 #ifdef LTC_KASUMI 57 struct kasumi_key { 58 ulong32 KLi1[8], KLi2[8], 59 KOi1[8], KOi2[8], KOi3[8], 60 KIi1[8], KIi2[8], KIi3[8]; 61 }; 62 #endif 63 64 #ifdef LTC_XTEA 65 struct xtea_key { 66 unsigned long A[32], B[32]; 67 }; 68 #endif 69 70 #ifdef LTC_TWOFISH 71 #ifndef LTC_TWOFISH_SMALL 72 struct twofish_key { 73 ulong32 S[4][256], K[40]; 74 }; 75 #else 76 struct twofish_key { 77 ulong32 K[40]; 78 unsigned char S[32], start; 79 }; 80 #endif 81 #endif 82 83 #ifdef LTC_SAFER 84 #define LTC_SAFER_K64_DEFAULT_NOF_ROUNDS 6 85 #define LTC_SAFER_K128_DEFAULT_NOF_ROUNDS 10 86 #define LTC_SAFER_SK64_DEFAULT_NOF_ROUNDS 8 87 #define LTC_SAFER_SK128_DEFAULT_NOF_ROUNDS 10 88 #define LTC_SAFER_MAX_NOF_ROUNDS 13 89 #define LTC_SAFER_BLOCK_LEN 8 90 #define LTC_SAFER_KEY_LEN (1 + LTC_SAFER_BLOCK_LEN * (1 + 2 * LTC_SAFER_MAX_NOF_ROUNDS)) 91 typedef unsigned char safer_block_t[LTC_SAFER_BLOCK_LEN]; 92 typedef unsigned char safer_key_t[LTC_SAFER_KEY_LEN]; 93 struct safer_key { safer_key_t key; }; 94 #endif 95 96 #ifdef LTC_RC2 97 struct rc2_key { unsigned xkey[64]; }; 98 #endif 99 100 #ifdef LTC_DES 101 struct des_key { 102 ulong32 ek[32], dk[32]; 103 }; 104 105 struct des3_key { 106 ulong32 ek[3][32], dk[3][32]; 107 }; 108 #endif 109 110 #ifdef LTC_CAST5 111 struct cast5_key { 112 ulong32 K[32], keylen; 113 }; 114 #endif 115 116 #ifdef LTC_NOEKEON 117 struct noekeon_key { 118 ulong32 K[4], dK[4]; 119 }; 120 #endif 121 122 #ifdef LTC_SKIPJACK 123 struct skipjack_key { 124 unsigned char key[10]; 125 }; 126 #endif 127 128 #ifdef LTC_KHAZAD 129 struct khazad_key { 130 ulong64 roundKeyEnc[8 + 1]; 131 ulong64 roundKeyDec[8 + 1]; 132 }; 133 #endif 134 135 #ifdef LTC_ANUBIS 136 struct anubis_key { 137 int keyBits; 138 int R; 139 ulong32 roundKeyEnc[18 + 1][4]; 140 ulong32 roundKeyDec[18 + 1][4]; 141 }; 142 #endif 143 144 #ifdef LTC_MULTI2 145 struct multi2_key { 146 int N; 147 ulong32 uk[8]; 148 }; 149 #endif 150 151 #ifdef LTC_CAMELLIA 152 struct camellia_key { 153 int R; 154 ulong64 kw[4], k[24], kl[6]; 155 }; 156 #endif 157 158 #ifdef LTC_IDEA 159 /* rounds */ 160 #define LTC_IDEA_ROUNDS 8 161 /* key schedule length in # of unsigned shorts */ 162 #define LTC_IDEA_KEYLEN 6*LTC_IDEA_ROUNDS+4 163 struct idea_key { 164 unsigned short int ek[LTC_IDEA_KEYLEN]; /* enc key */ 165 unsigned short int dk[LTC_IDEA_KEYLEN]; /* dec key */ 166 }; 167 #endif 168 169 #ifdef LTC_SERPENT 170 struct serpent_key { 171 ulong32 k[33*4]; 172 }; 173 #endif 174 175 typedef union Symmetric_key { 176 #ifdef LTC_DES 177 struct des_key des; 178 struct des3_key des3; 179 #endif 180 #ifdef LTC_RC2 181 struct rc2_key rc2; 182 #endif 183 #ifdef LTC_SAFER 184 struct safer_key safer; 185 #endif 186 #ifdef LTC_TWOFISH 187 struct twofish_key twofish; 188 #endif 189 #ifdef LTC_BLOWFISH 190 struct blowfish_key blowfish; 191 #endif 192 #ifdef LTC_RC5 193 struct rc5_key rc5; 194 #endif 195 #ifdef LTC_RC6 196 struct rc6_key rc6; 197 #endif 198 #ifdef LTC_SAFERP 199 struct saferp_key saferp; 200 #endif 201 #ifdef LTC_RIJNDAEL 202 struct rijndael_key rijndael; 203 #endif 204 #ifdef LTC_XTEA 205 struct xtea_key xtea; 206 #endif 207 #ifdef LTC_CAST5 208 struct cast5_key cast5; 209 #endif 210 #ifdef LTC_NOEKEON 211 struct noekeon_key noekeon; 212 #endif 213 #ifdef LTC_SKIPJACK 214 struct skipjack_key skipjack; 215 #endif 216 #ifdef LTC_KHAZAD 217 struct khazad_key khazad; 218 #endif 219 #ifdef LTC_ANUBIS 220 struct anubis_key anubis; 221 #endif 222 #ifdef LTC_KSEED 223 struct kseed_key kseed; 224 #endif 225 #ifdef LTC_KASUMI 226 struct kasumi_key kasumi; 227 #endif 228 #ifdef LTC_MULTI2 229 struct multi2_key multi2; 230 #endif 231 #ifdef LTC_CAMELLIA 232 struct camellia_key camellia; 233 #endif 234 #ifdef LTC_IDEA 235 struct idea_key idea; 236 #endif 237 #ifdef LTC_SERPENT 238 struct serpent_key serpent; 239 #endif 240 void *data; 241 } symmetric_key; 242 243 #ifdef LTC_ECB_MODE 244 /** A block cipher ECB structure */ 245 typedef struct { 246 /** The index of the cipher chosen */ 247 int cipher, 248 /** The block size of the given cipher */ 249 blocklen; 250 /** The scheduled key */ 251 symmetric_key key; 252 } symmetric_ECB; 253 #endif 254 255 #ifdef LTC_CFB_MODE 256 /** A block cipher CFB structure */ 257 typedef struct { 258 /** The index of the cipher chosen */ 259 int cipher, 260 /** The block size of the given cipher */ 261 blocklen, 262 /** The padding offset */ 263 padlen; 264 /** The current IV */ 265 unsigned char IV[MAXBLOCKSIZE], 266 /** The pad used to encrypt/decrypt */ 267 pad[MAXBLOCKSIZE]; 268 /** The scheduled key */ 269 symmetric_key key; 270 } symmetric_CFB; 271 #endif 272 273 #ifdef LTC_OFB_MODE 274 /** A block cipher OFB structure */ 275 typedef struct { 276 /** The index of the cipher chosen */ 277 int cipher, 278 /** The block size of the given cipher */ 279 blocklen, 280 /** The padding offset */ 281 padlen; 282 /** The current IV */ 283 unsigned char IV[MAXBLOCKSIZE]; 284 /** The scheduled key */ 285 symmetric_key key; 286 } symmetric_OFB; 287 #endif 288 289 #ifdef LTC_CBC_MODE 290 /** A block cipher CBC structure */ 291 typedef struct { 292 /** The index of the cipher chosen */ 293 int cipher, 294 /** The block size of the given cipher */ 295 blocklen; 296 /** The current IV */ 297 unsigned char IV[MAXBLOCKSIZE]; 298 /** The scheduled key */ 299 symmetric_key key; 300 } symmetric_CBC; 301 #endif 302 303 304 #ifdef LTC_CTR_MODE 305 /** A block cipher CTR structure */ 306 typedef struct { 307 /** The index of the cipher chosen */ 308 int cipher, 309 /** The block size of the given cipher */ 310 blocklen, 311 /** The padding offset */ 312 padlen, 313 /** The mode (endianess) of the CTR, 0==little, 1==big */ 314 mode, 315 /** counter width */ 316 ctrlen; 317 318 /** The counter */ 319 unsigned char ctr[MAXBLOCKSIZE], 320 /** The pad used to encrypt/decrypt */ 321 pad[MAXBLOCKSIZE]; 322 /** The scheduled key */ 323 symmetric_key key; 324 } symmetric_CTR; 325 #endif 326 327 328 #ifdef LTC_LRW_MODE 329 /** A LRW structure */ 330 typedef struct { 331 /** The index of the cipher chosen (must be a 128-bit block cipher) */ 332 int cipher; 333 334 /** The current IV */ 335 unsigned char IV[16], 336 337 /** the tweak key */ 338 tweak[16], 339 340 /** The current pad, it's the product of the first 15 bytes against the tweak key */ 341 pad[16]; 342 343 /** The scheduled symmetric key */ 344 symmetric_key key; 345 346 #ifdef LTC_LRW_TABLES 347 /** The pre-computed multiplication table */ 348 unsigned char PC[16][256][16]; 349 #endif 350 } symmetric_LRW; 351 #endif 352 353 #ifdef LTC_F8_MODE 354 /** A block cipher F8 structure */ 355 typedef struct { 356 /** The index of the cipher chosen */ 357 int cipher, 358 /** The block size of the given cipher */ 359 blocklen, 360 /** The padding offset */ 361 padlen; 362 /** The current IV */ 363 unsigned char IV[MAXBLOCKSIZE], 364 MIV[MAXBLOCKSIZE]; 365 /** Current block count */ 366 ulong32 blockcnt; 367 /** The scheduled key */ 368 symmetric_key key; 369 } symmetric_F8; 370 #endif 371 372 373 /** cipher descriptor table, last entry has "name == NULL" to mark the end of table */ 374 extern const struct ltc_cipher_descriptor { 375 /** name of cipher */ 376 const char *name; 377 /** internal ID */ 378 unsigned char ID; 379 /** min keysize (octets) */ 380 int min_key_length, 381 /** max keysize (octets) */ 382 max_key_length, 383 /** block size (octets) */ 384 block_length, 385 /** default number of rounds */ 386 default_rounds; 387 /** Setup the cipher 388 @param key The input symmetric key 389 @param keylen The length of the input key (octets) 390 @param num_rounds The requested number of rounds (0==default) 391 @param skey [out] The destination of the scheduled key 392 @return CRYPT_OK if successful 393 */ 394 int (*setup)(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 395 /** Encrypt a block 396 @param pt The plaintext 397 @param ct [out] The ciphertext 398 @param skey The scheduled key 399 @return CRYPT_OK if successful 400 */ 401 int (*ecb_encrypt)(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 402 /** Decrypt a block 403 @param ct The ciphertext 404 @param pt [out] The plaintext 405 @param skey The scheduled key 406 @return CRYPT_OK if successful 407 */ 408 int (*ecb_decrypt)(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 409 /** Test the block cipher 410 @return CRYPT_OK if successful, CRYPT_NOP if self-testing has been disabled 411 */ 412 int (*test)(void); 413 414 /** Terminate the context 415 @param skey The scheduled key 416 */ 417 void (*done)(symmetric_key *skey); 418 419 /** Determine a key size 420 @param keysize [in/out] The size of the key desired and the suggested size 421 @return CRYPT_OK if successful 422 */ 423 int (*keysize)(int *keysize); 424 425 /** Accelerators **/ 426 /** Accelerated ECB encryption 427 @param pt Plaintext 428 @param ct Ciphertext 429 @param blocks The number of complete blocks to process 430 @param skey The scheduled key context 431 @return CRYPT_OK if successful 432 */ 433 int (*accel_ecb_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, const symmetric_key *skey); 434 435 /** Accelerated ECB decryption 436 @param pt Plaintext 437 @param ct Ciphertext 438 @param blocks The number of complete blocks to process 439 @param skey The scheduled key context 440 @return CRYPT_OK if successful 441 */ 442 int (*accel_ecb_decrypt)(const unsigned char *ct, unsigned char *pt, unsigned long blocks, const symmetric_key *skey); 443 444 /** Accelerated CBC encryption 445 @param pt Plaintext 446 @param ct Ciphertext 447 @param blocks The number of complete blocks to process 448 @param IV The initial value (input/output) 449 @param skey The scheduled key context 450 @return CRYPT_OK if successful 451 */ 452 int (*accel_cbc_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, symmetric_key *skey); 453 454 /** Accelerated CBC decryption 455 @param pt Plaintext 456 @param ct Ciphertext 457 @param blocks The number of complete blocks to process 458 @param IV The initial value (input/output) 459 @param skey The scheduled key context 460 @return CRYPT_OK if successful 461 */ 462 int (*accel_cbc_decrypt)(const unsigned char *ct, unsigned char *pt, unsigned long blocks, unsigned char *IV, symmetric_key *skey); 463 464 /** Accelerated CTR encryption 465 @param pt Plaintext 466 @param ct Ciphertext 467 @param blocks The number of complete blocks to process 468 @param IV The initial value (input/output) 469 @param mode little or big endian counter (mode=0 or mode=1) 470 @param skey The scheduled key context 471 @return CRYPT_OK if successful 472 */ 473 int (*accel_ctr_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, int mode, symmetric_key *skey); 474 475 /** Accelerated LRW 476 @param pt Plaintext 477 @param ct Ciphertext 478 @param blocks The number of complete blocks to process 479 @param IV The initial value (input/output) 480 @param tweak The LRW tweak 481 @param skey The scheduled key context 482 @return CRYPT_OK if successful 483 */ 484 int (*accel_lrw_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, const unsigned char *tweak, symmetric_key *skey); 485 486 /** Accelerated LRW 487 @param ct Ciphertext 488 @param pt Plaintext 489 @param blocks The number of complete blocks to process 490 @param IV The initial value (input/output) 491 @param tweak The LRW tweak 492 @param skey The scheduled key context 493 @return CRYPT_OK if successful 494 */ 495 int (*accel_lrw_decrypt)(const unsigned char *ct, unsigned char *pt, unsigned long blocks, unsigned char *IV, const unsigned char *tweak, symmetric_key *skey); 496 497 /** Accelerated CCM packet (one-shot) 498 @param key The secret key to use 499 @param keylen The length of the secret key (octets) 500 @param uskey A previously scheduled key [optional can be NULL] 501 @param nonce The session nonce [use once] 502 @param noncelen The length of the nonce 503 @param header The header for the session 504 @param headerlen The length of the header (octets) 505 @param pt [out] The plaintext 506 @param ptlen The length of the plaintext (octets) 507 @param ct [out] The ciphertext 508 @param tag [out] The destination tag 509 @param taglen [in/out] The max size and resulting size of the authentication tag 510 @param direction Encrypt or Decrypt direction (0 or 1) 511 @return CRYPT_OK if successful 512 */ 513 int (*accel_ccm_memory)( 514 const unsigned char *key, unsigned long keylen, 515 symmetric_key *uskey, 516 const unsigned char *nonce, unsigned long noncelen, 517 const unsigned char *header, unsigned long headerlen, 518 unsigned char *pt, unsigned long ptlen, 519 unsigned char *ct, 520 unsigned char *tag, unsigned long *taglen, 521 int direction); 522 523 /** Accelerated GCM packet (one shot) 524 @param key The secret key 525 @param keylen The length of the secret key 526 @param IV The initialization vector 527 @param IVlen The length of the initialization vector 528 @param adata The additional authentication data (header) 529 @param adatalen The length of the adata 530 @param pt The plaintext 531 @param ptlen The length of the plaintext (ciphertext length is the same) 532 @param ct The ciphertext 533 @param tag [out] The MAC tag 534 @param taglen [in/out] The MAC tag length 535 @param direction Encrypt or Decrypt mode (GCM_ENCRYPT or GCM_DECRYPT) 536 @return CRYPT_OK on success 537 */ 538 int (*accel_gcm_memory)( 539 const unsigned char *key, unsigned long keylen, 540 const unsigned char *IV, unsigned long IVlen, 541 const unsigned char *adata, unsigned long adatalen, 542 unsigned char *pt, unsigned long ptlen, 543 unsigned char *ct, 544 unsigned char *tag, unsigned long *taglen, 545 int direction); 546 547 /** Accelerated one shot LTC_OMAC 548 @param key The secret key 549 @param keylen The key length (octets) 550 @param in The message 551 @param inlen Length of message (octets) 552 @param out [out] Destination for tag 553 @param outlen [in/out] Initial and final size of out 554 @return CRYPT_OK on success 555 */ 556 int (*omac_memory)( 557 const unsigned char *key, unsigned long keylen, 558 const unsigned char *in, unsigned long inlen, 559 unsigned char *out, unsigned long *outlen); 560 561 /** Accelerated one shot XCBC 562 @param key The secret key 563 @param keylen The key length (octets) 564 @param in The message 565 @param inlen Length of message (octets) 566 @param out [out] Destination for tag 567 @param outlen [in/out] Initial and final size of out 568 @return CRYPT_OK on success 569 */ 570 int (*xcbc_memory)( 571 const unsigned char *key, unsigned long keylen, 572 const unsigned char *in, unsigned long inlen, 573 unsigned char *out, unsigned long *outlen); 574 575 /** Accelerated one shot F9 576 @param key The secret key 577 @param keylen The key length (octets) 578 @param in The message 579 @param inlen Length of message (octets) 580 @param out [out] Destination for tag 581 @param outlen [in/out] Initial and final size of out 582 @return CRYPT_OK on success 583 @remark Requires manual padding 584 */ 585 int (*f9_memory)( 586 const unsigned char *key, unsigned long keylen, 587 const unsigned char *in, unsigned long inlen, 588 unsigned char *out, unsigned long *outlen); 589 590 /** Accelerated XTS encryption 591 @param pt Plaintext 592 @param ct Ciphertext 593 @param blocks The number of complete blocks to process 594 @param tweak The 128-bit encryption tweak (input/output). 595 The tweak should not be encrypted on input, but 596 next tweak will be copied encrypted on output. 597 @param skey1 The first scheduled key context 598 @param skey2 The second scheduled key context 599 @return CRYPT_OK if successful 600 */ 601 int (*accel_xts_encrypt)(const unsigned char *pt, unsigned char *ct, 602 unsigned long blocks, unsigned char *tweak, 603 const symmetric_key *skey1, const symmetric_key *skey2); 604 605 /** Accelerated XTS decryption 606 @param ct Ciphertext 607 @param pt Plaintext 608 @param blocks The number of complete blocks to process 609 @param tweak The 128-bit encryption tweak (input/output). 610 The tweak should not be encrypted on input, but 611 next tweak will be copied encrypted on output. 612 @param skey1 The first scheduled key context 613 @param skey2 The second scheduled key context 614 @return CRYPT_OK if successful 615 */ 616 int (*accel_xts_decrypt)(const unsigned char *ct, unsigned char *pt, 617 unsigned long blocks, unsigned char *tweak, 618 const symmetric_key *skey1, const symmetric_key *skey2); 619 } *cipher_descriptor[]; 620 621 #ifdef LTC_BLOWFISH 622 int blowfish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 623 int blowfish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 624 int blowfish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 625 int blowfish_test(void); 626 void blowfish_done(symmetric_key *skey); 627 int blowfish_keysize(int *keysize); 628 extern const struct ltc_cipher_descriptor blowfish_desc; 629 #endif 630 631 #ifdef LTC_RC5 632 int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 633 int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 634 int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 635 int rc5_test(void); 636 void rc5_done(symmetric_key *skey); 637 int rc5_keysize(int *keysize); 638 extern const struct ltc_cipher_descriptor rc5_desc; 639 #endif 640 641 #ifdef LTC_RC6 642 int rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 643 int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 644 int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 645 int rc6_test(void); 646 void rc6_done(symmetric_key *skey); 647 int rc6_keysize(int *keysize); 648 extern const struct ltc_cipher_descriptor rc6_desc; 649 #endif 650 651 #ifdef LTC_RC2 652 int rc2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 653 int rc2_setup_ex(const unsigned char *key, int keylen, int bits, int num_rounds, symmetric_key *skey); 654 int rc2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 655 int rc2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 656 int rc2_test(void); 657 void rc2_done(symmetric_key *skey); 658 int rc2_keysize(int *keysize); 659 extern const struct ltc_cipher_descriptor rc2_desc; 660 #endif 661 662 #ifdef LTC_SAFERP 663 int saferp_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 664 int saferp_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 665 int saferp_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 666 int saferp_test(void); 667 void saferp_done(symmetric_key *skey); 668 int saferp_keysize(int *keysize); 669 extern const struct ltc_cipher_descriptor saferp_desc; 670 #endif 671 672 #ifdef LTC_SAFER 673 int safer_k64_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 674 int safer_sk64_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 675 int safer_k128_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 676 int safer_sk128_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 677 int safer_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 678 int safer_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 679 int safer_k64_test(void); 680 int safer_sk64_test(void); 681 int safer_sk128_test(void); 682 void safer_done(symmetric_key *skey); 683 int safer_64_keysize(int *keysize); 684 int safer_128_keysize(int *keysize); 685 extern const struct ltc_cipher_descriptor safer_k64_desc, safer_k128_desc, safer_sk64_desc, safer_sk128_desc; 686 #endif 687 688 #ifdef LTC_RIJNDAEL 689 690 /* make aes an alias */ 691 #define aes_setup rijndael_setup 692 #define aes_ecb_encrypt rijndael_ecb_encrypt 693 #define aes_ecb_decrypt rijndael_ecb_decrypt 694 #define aes_test rijndael_test 695 #define aes_done rijndael_done 696 #define aes_keysize rijndael_keysize 697 698 #define aes_enc_setup rijndael_enc_setup 699 #define aes_enc_ecb_encrypt rijndael_enc_ecb_encrypt 700 #define aes_enc_keysize rijndael_enc_keysize 701 702 int rijndael_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 703 int rijndael_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 704 int rijndael_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 705 int rijndael_test(void); 706 void rijndael_done(symmetric_key *skey); 707 int rijndael_keysize(int *keysize); 708 int rijndael_enc_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 709 int rijndael_enc_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 710 void rijndael_enc_done(symmetric_key *skey); 711 int rijndael_enc_keysize(int *keysize); 712 extern const struct ltc_cipher_descriptor rijndael_desc, aes_desc; 713 extern const struct ltc_cipher_descriptor rijndael_enc_desc, aes_enc_desc; 714 #endif 715 716 #ifdef LTC_XTEA 717 int xtea_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 718 int xtea_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 719 int xtea_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 720 int xtea_test(void); 721 void xtea_done(symmetric_key *skey); 722 int xtea_keysize(int *keysize); 723 extern const struct ltc_cipher_descriptor xtea_desc; 724 #endif 725 726 #ifdef LTC_TWOFISH 727 int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 728 int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 729 int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 730 int twofish_test(void); 731 void twofish_done(symmetric_key *skey); 732 int twofish_keysize(int *keysize); 733 extern const struct ltc_cipher_descriptor twofish_desc; 734 #endif 735 736 #ifdef LTC_DES 737 int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 738 int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 739 int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 740 int des_test(void); 741 void des_done(symmetric_key *skey); 742 int des_keysize(int *keysize); 743 int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 744 int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 745 int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 746 int des3_test(void); 747 void des3_done(symmetric_key *skey); 748 int des3_keysize(int *keysize); 749 extern const struct ltc_cipher_descriptor des_desc, des3_desc; 750 #endif 751 752 #ifdef LTC_CAST5 753 int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 754 int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 755 int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 756 int cast5_test(void); 757 void cast5_done(symmetric_key *skey); 758 int cast5_keysize(int *keysize); 759 extern const struct ltc_cipher_descriptor cast5_desc; 760 #endif 761 762 #ifdef LTC_NOEKEON 763 int noekeon_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 764 int noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 765 int noekeon_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 766 int noekeon_test(void); 767 void noekeon_done(symmetric_key *skey); 768 int noekeon_keysize(int *keysize); 769 extern const struct ltc_cipher_descriptor noekeon_desc; 770 #endif 771 772 #ifdef LTC_SKIPJACK 773 int skipjack_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 774 int skipjack_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 775 int skipjack_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 776 int skipjack_test(void); 777 void skipjack_done(symmetric_key *skey); 778 int skipjack_keysize(int *keysize); 779 extern const struct ltc_cipher_descriptor skipjack_desc; 780 #endif 781 782 #ifdef LTC_KHAZAD 783 int khazad_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 784 int khazad_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 785 int khazad_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 786 int khazad_test(void); 787 void khazad_done(symmetric_key *skey); 788 int khazad_keysize(int *keysize); 789 extern const struct ltc_cipher_descriptor khazad_desc; 790 #endif 791 792 #ifdef LTC_ANUBIS 793 int anubis_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 794 int anubis_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 795 int anubis_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 796 int anubis_test(void); 797 void anubis_done(symmetric_key *skey); 798 int anubis_keysize(int *keysize); 799 extern const struct ltc_cipher_descriptor anubis_desc; 800 #endif 801 802 #ifdef LTC_KSEED 803 int kseed_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 804 int kseed_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 805 int kseed_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 806 int kseed_test(void); 807 void kseed_done(symmetric_key *skey); 808 int kseed_keysize(int *keysize); 809 extern const struct ltc_cipher_descriptor kseed_desc; 810 #endif 811 812 #ifdef LTC_KASUMI 813 int kasumi_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 814 int kasumi_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 815 int kasumi_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 816 int kasumi_test(void); 817 void kasumi_done(symmetric_key *skey); 818 int kasumi_keysize(int *keysize); 819 extern const struct ltc_cipher_descriptor kasumi_desc; 820 #endif 821 822 823 #ifdef LTC_MULTI2 824 int multi2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 825 int multi2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 826 int multi2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 827 int multi2_test(void); 828 void multi2_done(symmetric_key *skey); 829 int multi2_keysize(int *keysize); 830 extern const struct ltc_cipher_descriptor multi2_desc; 831 #endif 832 833 #ifdef LTC_CAMELLIA 834 int camellia_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 835 int camellia_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 836 int camellia_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 837 int camellia_test(void); 838 void camellia_done(symmetric_key *skey); 839 int camellia_keysize(int *keysize); 840 extern const struct ltc_cipher_descriptor camellia_desc; 841 #endif 842 843 #ifdef LTC_IDEA 844 int idea_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 845 int idea_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 846 int idea_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 847 int idea_test(void); 848 void idea_done(symmetric_key *skey); 849 int idea_keysize(int *keysize); 850 extern const struct ltc_cipher_descriptor idea_desc; 851 #endif 852 853 #ifdef LTC_SERPENT 854 int serpent_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); 855 int serpent_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 856 int serpent_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 857 int serpent_test(void); 858 void serpent_done(symmetric_key *skey); 859 int serpent_keysize(int *keysize); 860 extern const struct ltc_cipher_descriptor serpent_desc; 861 #endif 862 863 #ifdef LTC_ECB_MODE 864 int ecb_start(int cipher, const unsigned char *key, 865 int keylen, int num_rounds, symmetric_ECB *ecb); 866 int ecb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_ECB *ecb); 867 int ecb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_ECB *ecb); 868 int ecb_done(symmetric_ECB *ecb); 869 #endif 870 871 #ifdef LTC_CFB_MODE 872 int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key, 873 int keylen, int num_rounds, symmetric_CFB *cfb); 874 int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CFB *cfb); 875 int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CFB *cfb); 876 int cfb_getiv(unsigned char *IV, unsigned long *len, const symmetric_CFB *cfb); 877 int cfb_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb); 878 int cfb_done(symmetric_CFB *cfb); 879 #endif 880 881 #ifdef LTC_OFB_MODE 882 int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key, 883 int keylen, int num_rounds, symmetric_OFB *ofb); 884 int ofb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_OFB *ofb); 885 int ofb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_OFB *ofb); 886 int ofb_getiv(unsigned char *IV, unsigned long *len, const symmetric_OFB *ofb); 887 int ofb_setiv(const unsigned char *IV, unsigned long len, symmetric_OFB *ofb); 888 int ofb_done(symmetric_OFB *ofb); 889 #endif 890 891 #ifdef LTC_CBC_MODE 892 int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key, 893 int keylen, int num_rounds, symmetric_CBC *cbc); 894 int cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CBC *cbc); 895 int cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CBC *cbc); 896 int cbc_getiv(unsigned char *IV, unsigned long *len, const symmetric_CBC *cbc); 897 int cbc_setiv(const unsigned char *IV, unsigned long len, symmetric_CBC *cbc); 898 int cbc_done(symmetric_CBC *cbc); 899 #endif 900 901 #ifdef LTC_CTR_MODE 902 903 #define CTR_COUNTER_LITTLE_ENDIAN 0x0000 904 #define CTR_COUNTER_BIG_ENDIAN 0x1000 905 #define LTC_CTR_RFC3686 0x2000 906 907 int ctr_start( int cipher, 908 const unsigned char *IV, 909 const unsigned char *key, int keylen, 910 int num_rounds, int ctr_mode, 911 symmetric_CTR *ctr); 912 int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CTR *ctr); 913 int ctr_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CTR *ctr); 914 int ctr_getiv(unsigned char *IV, unsigned long *len, const symmetric_CTR *ctr); 915 int ctr_setiv(const unsigned char *IV, unsigned long len, symmetric_CTR *ctr); 916 int ctr_done(symmetric_CTR *ctr); 917 int ctr_test(void); 918 #endif 919 920 #ifdef LTC_LRW_MODE 921 922 #define LRW_ENCRYPT LTC_ENCRYPT 923 #define LRW_DECRYPT LTC_DECRYPT 924 925 int lrw_start( int cipher, 926 const unsigned char *IV, 927 const unsigned char *key, int keylen, 928 const unsigned char *tweak, 929 int num_rounds, 930 symmetric_LRW *lrw); 931 int lrw_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_LRW *lrw); 932 int lrw_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_LRW *lrw); 933 int lrw_getiv(unsigned char *IV, unsigned long *len, const symmetric_LRW *lrw); 934 int lrw_setiv(const unsigned char *IV, unsigned long len, symmetric_LRW *lrw); 935 int lrw_done(symmetric_LRW *lrw); 936 int lrw_test(void); 937 938 /* don't call */ 939 int lrw_process(const unsigned char *pt, unsigned char *ct, unsigned long len, int mode, symmetric_LRW *lrw); 940 #endif 941 942 #ifdef LTC_F8_MODE 943 int f8_start( int cipher, const unsigned char *IV, 944 const unsigned char *key, int keylen, 945 const unsigned char *salt_key, int skeylen, 946 int num_rounds, symmetric_F8 *f8); 947 int f8_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_F8 *f8); 948 int f8_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_F8 *f8); 949 int f8_getiv(unsigned char *IV, unsigned long *len, const symmetric_F8 *f8); 950 int f8_setiv(const unsigned char *IV, unsigned long len, symmetric_F8 *f8); 951 int f8_done(symmetric_F8 *f8); 952 int f8_test_mode(void); 953 #endif 954 955 #ifdef LTC_XTS_MODE 956 typedef struct { 957 symmetric_key key1, key2; 958 int cipher; 959 } symmetric_xts; 960 961 int xts_start( int cipher, 962 const unsigned char *key1, 963 const unsigned char *key2, 964 unsigned long keylen, 965 int num_rounds, 966 symmetric_xts *xts); 967 968 int xts_encrypt( 969 const unsigned char *pt, unsigned long ptlen, 970 unsigned char *ct, 971 unsigned char *tweak, 972 const symmetric_xts *xts); 973 int xts_decrypt( 974 const unsigned char *ct, unsigned long ptlen, 975 unsigned char *pt, 976 unsigned char *tweak, 977 const symmetric_xts *xts); 978 979 void xts_done(symmetric_xts *xts); 980 int xts_test(void); 981 void xts_mult_x(unsigned char *I); 982 #endif 983 984 int find_cipher(const char *name); 985 int find_cipher_any(const char *name, int blocklen, int keylen); 986 int find_cipher_id(unsigned char ID); 987 int register_cipher(const struct ltc_cipher_descriptor *cipher); 988 int unregister_cipher(const struct ltc_cipher_descriptor *cipher); 989 int register_all_ciphers(void); 990 int cipher_is_valid(int idx); 991 992 LTC_MUTEX_PROTO(ltc_cipher_mutex) 993 994 /* ---- stream ciphers ---- */ 995 996 #ifdef LTC_CHACHA 997 998 typedef struct { 999 ulong32 input[16]; 1000 unsigned char kstream[64]; 1001 unsigned long ksleft; 1002 unsigned long ivlen; 1003 int rounds; 1004 } chacha_state; 1005 1006 int chacha_setup(chacha_state *st, const unsigned char *key, unsigned long keylen, int rounds); 1007 int chacha_ivctr32(chacha_state *st, const unsigned char *iv, unsigned long ivlen, ulong32 counter); 1008 int chacha_ivctr64(chacha_state *st, const unsigned char *iv, unsigned long ivlen, ulong64 counter); 1009 int chacha_crypt(chacha_state *st, const unsigned char *in, unsigned long inlen, unsigned char *out); 1010 int chacha_keystream(chacha_state *st, unsigned char *out, unsigned long outlen); 1011 int chacha_done(chacha_state *st); 1012 int chacha_test(void); 1013 int chacha_memory(const unsigned char *key, unsigned long keylen, unsigned long rounds, 1014 const unsigned char *iv, unsigned long ivlen, ulong64 counter, 1015 const unsigned char *datain, unsigned long datalen, unsigned char *dataout); 1016 1017 #endif /* LTC_CHACHA */ 1018 1019 #ifdef LTC_SALSA20 1020 1021 typedef struct { 1022 ulong32 input[16]; 1023 unsigned char kstream[64]; 1024 unsigned long ksleft; 1025 unsigned long ivlen; 1026 int rounds; 1027 } salsa20_state; 1028 1029 int salsa20_setup(salsa20_state *st, const unsigned char *key, unsigned long keylen, int rounds); 1030 int salsa20_ivctr64(salsa20_state *st, const unsigned char *iv, unsigned long ivlen, ulong64 counter); 1031 int salsa20_crypt(salsa20_state *st, const unsigned char *in, unsigned long inlen, unsigned char *out); 1032 int salsa20_keystream(salsa20_state *st, unsigned char *out, unsigned long outlen); 1033 int salsa20_done(salsa20_state *st); 1034 int salsa20_test(void); 1035 int salsa20_memory(const unsigned char *key, unsigned long keylen, unsigned long rounds, 1036 const unsigned char *iv, unsigned long ivlen, ulong64 counter, 1037 const unsigned char *datain, unsigned long datalen, unsigned char *dataout); 1038 1039 #endif /* LTC_SALSA20 */ 1040 1041 #ifdef LTC_XSALSA20 1042 1043 int xsalsa20_setup(salsa20_state *st, const unsigned char *key, unsigned long keylen, 1044 const unsigned char *nonce, unsigned long noncelen, 1045 int rounds); 1046 int xsalsa20_test(void); 1047 int xsalsa20_memory(const unsigned char *key, unsigned long keylen, unsigned long rounds, 1048 const unsigned char *nonce, unsigned long noncelen, 1049 const unsigned char *datain, unsigned long datalen, unsigned char *dataout); 1050 1051 #endif /* LTC_XSALSA20 */ 1052 1053 #ifdef LTC_SOSEMANUK 1054 1055 typedef struct { 1056 ulong32 kc[100]; /* key_context */ 1057 ulong32 s00, s01, s02, s03, s04, s05, s06, s07, s08, s09; 1058 ulong32 r1, r2; 1059 /* 1060 * Buffering: the stream cipher produces output data by 1061 * blocks of 640 bits. buf[] contains such a block, and 1062 * "ptr" is the index of the next output byte. 1063 */ 1064 unsigned char buf[80]; 1065 unsigned ptr; 1066 } sosemanuk_state; 1067 1068 int sosemanuk_setup(sosemanuk_state *st, const unsigned char *key, unsigned long keylen); 1069 int sosemanuk_setiv(sosemanuk_state *st, const unsigned char *iv, unsigned long ivlen); 1070 int sosemanuk_crypt(sosemanuk_state *st, const unsigned char *in, unsigned long inlen, unsigned char *out); 1071 int sosemanuk_keystream(sosemanuk_state *st, unsigned char *out, unsigned long outlen); 1072 int sosemanuk_done(sosemanuk_state *st); 1073 int sosemanuk_test(void); 1074 int sosemanuk_memory(const unsigned char *key, unsigned long keylen, 1075 const unsigned char *iv, unsigned long ivlen, 1076 const unsigned char *datain, unsigned long datalen, 1077 unsigned char *dataout); 1078 1079 #endif /* LTC_SOSEMANUK */ 1080 1081 #ifdef LTC_RABBIT 1082 1083 typedef struct { 1084 ulong32 x[8]; 1085 ulong32 c[8]; 1086 ulong32 carry; 1087 } rabbit_ctx; 1088 1089 typedef struct { 1090 rabbit_ctx master_ctx; 1091 rabbit_ctx work_ctx; 1092 unsigned char block[16]; /* last keystream block containing unused bytes */ 1093 ulong32 unused; /* count fm right */ 1094 } rabbit_state; 1095 1096 int rabbit_setup(rabbit_state* st, const unsigned char *key, unsigned long keylen); 1097 int rabbit_setiv(rabbit_state* st, const unsigned char *iv, unsigned long ivlen); 1098 int rabbit_crypt(rabbit_state* st, const unsigned char *in, unsigned long inlen, unsigned char *out); 1099 int rabbit_keystream(rabbit_state* st, unsigned char *out, unsigned long outlen); 1100 int rabbit_done(rabbit_state *st); 1101 int rabbit_test(void); 1102 int rabbit_memory(const unsigned char *key, unsigned long keylen, 1103 const unsigned char *iv, unsigned long ivlen, 1104 const unsigned char *datain, unsigned long datalen, 1105 unsigned char *dataout); 1106 1107 #endif /* LTC_RABBIT */ 1108 1109 #ifdef LTC_RC4_STREAM 1110 1111 typedef struct { 1112 unsigned int x, y; 1113 unsigned char buf[256]; 1114 } rc4_state; 1115 1116 int rc4_stream_setup(rc4_state *st, const unsigned char *key, unsigned long keylen); 1117 int rc4_stream_crypt(rc4_state *st, const unsigned char *in, unsigned long inlen, unsigned char *out); 1118 int rc4_stream_keystream(rc4_state *st, unsigned char *out, unsigned long outlen); 1119 int rc4_stream_done(rc4_state *st); 1120 int rc4_stream_test(void); 1121 int rc4_stream_memory(const unsigned char *key, unsigned long keylen, 1122 const unsigned char *datain, unsigned long datalen, 1123 unsigned char *dataout); 1124 1125 #endif /* LTC_RC4_STREAM */ 1126 1127 #ifdef LTC_SOBER128_STREAM 1128 1129 typedef struct { 1130 ulong32 R[17], /* Working storage for the shift register */ 1131 initR[17], /* saved register contents */ 1132 konst, /* key dependent constant */ 1133 sbuf; /* partial word encryption buffer */ 1134 int nbuf; /* number of part-word stream bits buffered */ 1135 } sober128_state; 1136 1137 int sober128_stream_setup(sober128_state *st, const unsigned char *key, unsigned long keylen); 1138 int sober128_stream_setiv(sober128_state *st, const unsigned char *iv, unsigned long ivlen); 1139 int sober128_stream_crypt(sober128_state *st, const unsigned char *in, unsigned long inlen, unsigned char *out); 1140 int sober128_stream_keystream(sober128_state *st, unsigned char *out, unsigned long outlen); 1141 int sober128_stream_done(sober128_state *st); 1142 int sober128_stream_test(void); 1143 int sober128_stream_memory(const unsigned char *key, unsigned long keylen, 1144 const unsigned char *iv, unsigned long ivlen, 1145 const unsigned char *datain, unsigned long datalen, 1146 unsigned char *dataout); 1147 1148 #endif /* LTC_SOBER128_STREAM */ 1149 1150 /* ref: $Format:%D$ */ 1151 /* git commit: $Format:%H$ */ 1152 /* commit time: $Format:%ai$ */ 1153