/optee_os/core/lib/libtomcrypt/src/ciphers/ |
A D | camellia.c | 216 LTC_ARGCHK(skey != NULL); in camellia_setup() 446 L ^= skey->camellia.kw[0]; in camellia_ecb_encrypt() 447 R ^= skey->camellia.kw[1]; in camellia_ecb_encrypt() 526 L ^= skey->camellia.kw[3]; in camellia_ecb_encrypt() 527 R ^= skey->camellia.kw[2]; in camellia_ecb_encrypt() 540 L ^= skey->camellia.kw[3]; in camellia_ecb_decrypt() 541 R ^= skey->camellia.kw[2]; in camellia_ecb_decrypt() 683 symmetric_key skey; in camellia_test() local 688 zeromem(&skey, sizeof(skey)); in camellia_test() 700 camellia_done(&skey); in camellia_test() [all …]
|
A D | cast5.c | 551 L ^= FI(R, skey->cast5.K[0], skey->cast5.K[16]); in _cast5_ecb_encrypt() 552 R ^= FII(L, skey->cast5.K[1], skey->cast5.K[17]); in _cast5_ecb_encrypt() 554 R ^= FI(L, skey->cast5.K[3], skey->cast5.K[19]); in _cast5_ecb_encrypt() 555 L ^= FII(R, skey->cast5.K[4], skey->cast5.K[20]); in _cast5_ecb_encrypt() 557 L ^= FI(R, skey->cast5.K[6], skey->cast5.K[22]); in _cast5_ecb_encrypt() 558 R ^= FII(L, skey->cast5.K[7], skey->cast5.K[23]); in _cast5_ecb_encrypt() 560 R ^= FI(L, skey->cast5.K[9], skey->cast5.K[25]); in _cast5_ecb_encrypt() 612 R ^= FI(L, skey->cast5.K[9], skey->cast5.K[25]); in _cast5_ecb_decrypt() 615 L ^= FI(R, skey->cast5.K[6], skey->cast5.K[22]); in _cast5_ecb_decrypt() 618 R ^= FI(L, skey->cast5.K[3], skey->cast5.K[19]); in _cast5_ecb_decrypt() [all …]
|
A D | blowfish.c | 314 LTC_ARGCHK(skey != NULL); in blowfish_setup() 379 #define F(x) ((skey->blowfish.S[0][LTC_BYTE(x,3)] + skey->blowfish.S[1][LTC_BYTE(x,2)]) ^ skey->blo… 403 LTC_ARGCHK(skey != NULL); in _blowfish_ecb_encrypt() 406 S1 = skey->blowfish.S[0]; in _blowfish_ecb_encrypt() 407 S2 = skey->blowfish.S[1]; in _blowfish_ecb_encrypt() 408 S3 = skey->blowfish.S[2]; in _blowfish_ecb_encrypt() 409 S4 = skey->blowfish.S[3]; in _blowfish_ecb_encrypt() 425 R ^= skey->blowfish.K[17]; in _blowfish_ecb_encrypt() 426 L ^= skey->blowfish.K[16]; in _blowfish_ecb_encrypt() 465 LTC_ARGCHK(skey != NULL); in _blowfish_ecb_decrypt() [all …]
|
A D | xtea.c | 38 LTC_ARGCHK(skey != NULL); in xtea_setup() 56 skey->xtea.A[x] = (sum + K[sum&3]) & 0xFFFFFFFFUL; in xtea_setup() 58 skey->xtea.B[x] = (sum + K[(sum>>11)&3]) & 0xFFFFFFFFUL; in xtea_setup() 82 LTC_ARGCHK(skey != NULL); in xtea_ecb_encrypt() 118 LTC_ARGCHK(skey != NULL); in xtea_ecb_decrypt() 205 symmetric_key skey; in xtea_test() 208 zeromem(&skey, sizeof(skey)); in xtea_test() 212 xtea_ecb_encrypt(tests[i].pt, tmp[0], &skey); in xtea_test() 213 xtea_ecb_decrypt(tmp[0], tmp[1], &skey); in xtea_test() 234 void xtea_done(symmetric_key *skey) in xtea_done() argument [all …]
|
A D | rc5.c | 60 LTC_ARGCHK(skey != NULL); in _rc5_setup() 78 S = skey->rc5.K; in _rc5_setup() 136 LTC_ARGCHK(skey != NULL); in _rc5_ecb_encrypt() 142 A += skey->rc5.K[0]; in _rc5_ecb_encrypt() 143 B += skey->rc5.K[1]; in _rc5_ecb_encrypt() 144 K = skey->rc5.K + 2; in _rc5_ecb_encrypt() 192 LTC_ARGCHK(skey != NULL); in _rc5_ecb_decrypt() 198 K = skey->rc5.K + (skey->rc5.rounds << 1); in _rc5_ecb_decrypt() 216 A -= skey->rc5.K[0]; in _rc5_ecb_decrypt() 217 B -= skey->rc5.K[1]; in _rc5_ecb_decrypt() [all …]
|
A D | anubis.c | 897 LTC_ARGCHK(skey != NULL); in _anubis_setup() 909 N = skey->anubis.keyBits >> 5; in _anubis_setup() 914 skey->anubis.R = R = 8 + N; in _anubis_setup() 1002 skey->anubis.roundKeyDec[0][i] = skey->anubis.roundKeyEnc[R][i]; in _anubis_setup() 1003 skey->anubis.roundKeyDec[R][i] = skey->anubis.roundKeyEnc[0][i]; in _anubis_setup() 1134 LTC_ARGCHK(skey != NULL); in anubis_ecb_encrypt() 1135 anubis_crypt(pt, ct, skey->anubis.roundKeyEnc, skey->anubis.R); in anubis_ecb_encrypt() 1150 LTC_ARGCHK(skey != NULL); in anubis_ecb_decrypt() 1151 anubis_crypt(ct, pt, skey->anubis.roundKeyDec, skey->anubis.R); in anubis_ecb_decrypt() 1488 symmetric_key skey; in anubis_test() [all …]
|
A D | noekeon.c | 79 LTC_ARGCHK(skey != NULL); in noekeon_setup() 89 LOAD32H(skey->noekeon.K[0],&key[0]); in noekeon_setup() 90 LOAD32H(skey->noekeon.K[1],&key[4]); in noekeon_setup() 91 LOAD32H(skey->noekeon.K[2],&key[8]); in noekeon_setup() 92 LOAD32H(skey->noekeon.K[3],&key[12]); in noekeon_setup() 99 kTHETA(skey->noekeon.dK[0], skey->noekeon.dK[1], skey->noekeon.dK[2], skey->noekeon.dK[3]); in noekeon_setup() 120 LTC_ARGCHK(skey != NULL); in _noekeon_ecb_encrypt() 141 THETA(skey->noekeon.K, a, b, c, d); in _noekeon_ecb_encrypt() 174 LTC_ARGCHK(skey != NULL); in _noekeon_ecb_decrypt() 195 THETA(skey->noekeon.dK, a,b,c,d); in _noekeon_ecb_decrypt() [all …]
|
A D | rc6.c | 136 b += skey->rc6.K[0]; in _rc6_ecb_encrypt() 137 d += skey->rc6.K[1]; in _rc6_ecb_encrypt() 145 K = skey->rc6.K + 2; in _rc6_ecb_encrypt() 155 a += skey->rc6.K[42]; in _rc6_ecb_encrypt() 156 c += skey->rc6.K[43]; in _rc6_ecb_encrypt() 191 a -= skey->rc6.K[42]; in _rc6_ecb_decrypt() 192 c -= skey->rc6.K[43]; in _rc6_ecb_decrypt() 200 K = skey->rc6.K + 40; in _rc6_ecb_decrypt() 211 b -= skey->rc6.K[0]; in _rc6_ecb_decrypt() 212 d -= skey->rc6.K[1]; in _rc6_ecb_decrypt() [all …]
|
A D | kasumi.c | 147 LTC_ARGCHK(skey != NULL); in kasumi_ecb_encrypt() 153 temp = FL(left, n, skey); in kasumi_ecb_encrypt() 154 temp = FO(temp, n++, skey); in kasumi_ecb_encrypt() 156 temp = FO(right, n, skey); in kasumi_ecb_encrypt() 157 temp = FL(temp, n++, skey); in kasumi_ecb_encrypt() 174 LTC_ARGCHK(skey != NULL); in kasumi_ecb_decrypt() 180 temp = FO(right, n, skey); in kasumi_ecb_decrypt() 181 temp = FL(temp, n--, skey); in kasumi_ecb_decrypt() 183 temp = FL(left, n, skey); in kasumi_ecb_decrypt() 201 LTC_ARGCHK(skey != NULL); in kasumi_setup() [all …]
|
A D | rc2.c | 72 unsigned *xkey = skey->rc2.xkey; in rc2_setup_ex() 78 LTC_ARGCHK(skey != NULL); in rc2_setup_ex() 163 LTC_ARGCHK(skey != NULL); in _rc2_ecb_encrypt() 165 xkey = skey->rc2.xkey; in _rc2_ecb_encrypt() 210 int err = _rc2_ecb_encrypt(pt, ct, skey); in rc2_ecb_encrypt() 242 LTC_ARGCHK(skey != NULL); in _rc2_ecb_decrypt() 244 xkey = skey->rc2.xkey; in _rc2_ecb_decrypt() 289 int err = _rc2_ecb_decrypt(ct, pt, skey); in rc2_ecb_decrypt() 353 symmetric_key skey; in rc2_test() 390 void rc2_done(symmetric_key *skey) in rc2_done() argument [all …]
|
A D | kseed.c | 221 skey->kseed.K[2*i+0] = G(k1 + k3 - KCi[i]); in kseed_setup() 222 skey->kseed.K[2*i+1] = G(k2 - k4 + KCi[i]); in kseed_setup() 233 skey->kseed.dK[2*(15-i)+0] = skey->kseed.K[2*i+0]; in kseed_setup() 234 skey->kseed.dK[2*(15-i)+1] = skey->kseed.K[2*i+1]; in kseed_setup() 265 rounds(P, skey->kseed.K); in kseed_ecb_encrypt() 287 rounds(P, skey->kseed.dK); in kseed_ecb_decrypt() 298 void kseed_done(symmetric_key *skey) in kseed_done() argument 300 LTC_UNUSED_PARAM(skey); in kseed_done() 342 symmetric_key skey; in kseed_test() 345 kseed_setup(tests[x].key, 16, 0, &skey); in kseed_test() [all …]
|
A D | multi2.c | 127 LTC_ARGCHK(skey != NULL); in multi2_setup() 132 skey->multi2.N = num_rounds; in multi2_setup() 138 setup(dk, sk, skey->multi2.uk); in multi2_setup() 157 LTC_ARGCHK(skey != NULL); in multi2_ecb_encrypt() 160 encrypt(p, skey->multi2.N, skey->multi2.uk); in multi2_ecb_encrypt() 178 LTC_ARGCHK(skey != NULL); in multi2_ecb_decrypt() 181 decrypt(p, skey->multi2.N, skey->multi2.uk); in multi2_ecb_decrypt() 249 symmetric_key skey; in multi2_test() local 264 if ((err = multi2_ecb_decrypt(buf, buf, &skey)) != CRYPT_OK) { in multi2_test() 295 void multi2_done(symmetric_key *skey) in multi2_done() argument [all …]
|
A D | skipjack.c | 71 LTC_ARGCHK(skey != NULL); in skipjack_setup() 83 skey->skipjack.key[x] = key[x] & 255; in skipjack_setup() 90 tmp = g_func(w1, &kp, skey->skipjack.key); \ 96 tmp = g_func(w1, &kp, skey->skipjack.key); \ 103 w1 = ig_func(w2, &kp, skey->skipjack.key); \ 153 LTC_ARGCHK(skey != NULL); in _skipjack_ecb_encrypt() 193 int err = _skipjack_ecb_encrypt(pt, ct, skey); in skipjack_ecb_encrypt() 217 LTC_ARGCHK(skey != NULL); in _skipjack_ecb_decrypt() 261 int err = _skipjack_ecb_decrypt(ct, pt, skey); in skipjack_ecb_decrypt() 319 void skipjack_done(symmetric_key *skey) in skipjack_done() argument [all …]
|
/optee_os/core/lib/libtomcrypt/src/ciphers/safer/ |
A D | saferp.c | 377 ct[0] = b[0] ^ skey->saferp.K[skey->saferp.rounds*2][0]; in saferp_ecb_encrypt() 380 ct[3] = b[3] ^ skey->saferp.K[skey->saferp.rounds*2][3]; in saferp_ecb_encrypt() 381 ct[4] = b[4] ^ skey->saferp.K[skey->saferp.rounds*2][4]; in saferp_ecb_encrypt() 384 ct[7] = b[7] ^ skey->saferp.K[skey->saferp.rounds*2][7]; in saferp_ecb_encrypt() 385 ct[8] = b[8] ^ skey->saferp.K[skey->saferp.rounds*2][8]; in saferp_ecb_encrypt() 388 ct[11] = b[11] ^ skey->saferp.K[skey->saferp.rounds*2][11]; in saferp_ecb_encrypt() 416 b[0] = ct[0] ^ skey->saferp.K[skey->saferp.rounds*2][0]; in saferp_ecb_decrypt() 419 b[3] = ct[3] ^ skey->saferp.K[skey->saferp.rounds*2][3]; in saferp_ecb_decrypt() 420 b[4] = ct[4] ^ skey->saferp.K[skey->saferp.rounds*2][4]; in saferp_ecb_decrypt() 423 b[7] = ct[7] ^ skey->saferp.K[skey->saferp.rounds*2][7]; in saferp_ecb_decrypt() [all …]
|
A D | safer.c | 184 LTC_ARGCHK(skey != NULL); in safer_k64_setup() 201 LTC_ARGCHK(skey != NULL); in safer_sk64_setup() 218 LTC_ARGCHK(skey != NULL); in safer_k128_setup() 235 LTC_ARGCHK(skey != NULL); in safer_sk128_setup() 264 LTC_ARGCHK(skey != NULL); in _safer_ecb_encrypt() 266 key = skey->safer.key; in _safer_ecb_encrypt() 320 key = skey->safer.key; in _safer_ecb_decrypt() 387 symmetric_key skey; in safer_k64_test() 417 symmetric_key skey; in safer_sk64_test() 449 LTC_UNUSED_PARAM(skey); in safer_done() [all …]
|
/optee_os/core/lib/libtomcrypt/ |
A D | aes_accel.c | 58 LTC_ARGCHK(skey); in rijndael_setup() 64 skey->rijndael.dK, in rijndael_setup() 103 LTC_ARGCHK(skey); in aes_ecb_encrypt_nblocks() 105 crypto_accel_aes_ecb_enc(ct, pt, skey->rijndael.eK, skey->rijndael.Nr, in aes_ecb_encrypt_nblocks() 116 LTC_ARGCHK(skey); in aes_ecb_decrypt_nblocks() 118 crypto_accel_aes_ecb_dec(pt, ct, skey->rijndael.dK, skey->rijndael.Nr, in aes_ecb_decrypt_nblocks() 143 LTC_ARGCHK(skey); in aes_cbc_encrypt_nblocks() 145 crypto_accel_aes_cbc_enc(ct, pt, skey->rijndael.eK, skey->rijndael.Nr, in aes_cbc_encrypt_nblocks() 158 LTC_ARGCHK(skey); in aes_cbc_decrypt_nblocks() 160 crypto_accel_aes_cbc_dec(pt, ct, skey->rijndael.dK, skey->rijndael.Nr, in aes_cbc_decrypt_nblocks() [all …]
|
A D | aes.c | 21 symmetric_key skey; in crypto_aes_expand_enc_key() 23 if (enc_keylen < sizeof(skey.rijndael.eK)) in crypto_aes_expand_enc_key() 26 if (aes_setup(key, key_len, 0, &skey)) in crypto_aes_expand_enc_key() 29 memcpy(enc_key, skey.rijndael.eK, sizeof(skey.rijndael.eK)); in crypto_aes_expand_enc_key() 30 *rounds = skey.rijndael.Nr; in crypto_aes_expand_enc_key() 41 symmetric_key skey; in crypto_aes_enc_block() 43 assert(enc_keylen >= sizeof(skey.rijndael.eK)); in crypto_aes_enc_block() 44 memcpy(skey.rijndael.eK, enc_key, sizeof(skey.rijndael.eK)); in crypto_aes_enc_block() 45 skey.rijndael.Nr = rounds; in crypto_aes_enc_block() 46 if (aes_ecb_encrypt(src, dst, &skey)) in crypto_aes_enc_block()
|
/optee_os/core/lib/libtomcrypt/src/headers/ |
A D | tomcrypt_cipher.h | 417 void (*done)(symmetric_key *skey); 636 void rc5_done(symmetric_key *skey); 646 void rc6_done(symmetric_key *skey); 657 void rc2_done(symmetric_key *skey); 682 void safer_done(symmetric_key *skey); 721 void xtea_done(symmetric_key *skey); 741 void des_done(symmetric_key *skey); 747 void des3_done(symmetric_key *skey); 757 void cast5_done(symmetric_key *skey); 807 void kseed_done(symmetric_key *skey); [all …]
|
/optee_os/core/lib/libtomcrypt/src/ciphers/twofish/ |
A D | twofish.c | 358 LTC_ARGCHK(skey != NULL); in _twofish_setup() 489 S1 = skey->twofish.S[0]; in _twofish_ecb_encrypt() 490 S2 = skey->twofish.S[1]; in _twofish_ecb_encrypt() 491 S3 = skey->twofish.S[2]; in _twofish_ecb_encrypt() 492 S4 = skey->twofish.S[3]; in _twofish_ecb_encrypt() 497 a ^= skey->twofish.K[0]; in _twofish_ecb_encrypt() 498 b ^= skey->twofish.K[1]; in _twofish_ecb_encrypt() 499 c ^= skey->twofish.K[2]; in _twofish_ecb_encrypt() 500 d ^= skey->twofish.K[3]; in _twofish_ecb_encrypt() 563 S1 = skey->twofish.S[0]; in _twofish_ecb_decrypt() [all …]
|
/optee_os/core/lib/libtomcrypt/src/encauth/ccm/ |
A D | ccm_memory.c | 52 symmetric_key *skey; in ccm_memory() local 121 skey = XMALLOC(sizeof(*skey)); in ccm_memory() 122 if (skey == NULL) { in ccm_memory() 128 XFREE(skey); in ccm_memory() 132 skey = uskey; in ccm_memory() 173 if ((err = cipher_descriptor[cipher]->ecb_encrypt(PAD, PAD, skey)) != CRYPT_OK) { in ccm_memory() 325 if (skey != uskey) { in ccm_memory() 326 cipher_descriptor[cipher]->done(skey); in ccm_memory() 328 zeromem(skey, sizeof(*skey)); in ccm_memory() 369 if (skey != uskey) { in ccm_memory() [all …]
|
/optee_os/core/lib/libtomcrypt/src/mac/xcbc/ |
A D | xcbc_init.c | 29 symmetric_key *skey; in xcbc_init() local 46 skey = NULL; in xcbc_init() 65 skey = XCALLOC(1, sizeof(*skey)); in xcbc_init() 66 if (skey == NULL) { in xcbc_init() 70 if ((err = cipher_descriptor[cipher]->setup(key, keylen, 0, skey)) != CRYPT_OK) { in xcbc_init() 79 cipher_descriptor[cipher]->ecb_encrypt(xcbc->K[y], xcbc->K[y], skey); in xcbc_init() 92 cipher_descriptor[cipher]->done(skey); in xcbc_init() 93 if (skey != NULL) { in xcbc_init() 95 zeromem(skey, sizeof(*skey)); in xcbc_init() 97 XFREE(skey); in xcbc_init()
|
/optee_os/core/lib/libtomcrypt/src/pk/ecc/ |
A D | ecc_encrypt_key.c | 37 unsigned char *pub_expt, *ecc_shared, *skey; in ecc_encrypt_key() local 61 skey = XMALLOC(MAXBLOCKSIZE); in ecc_encrypt_key() 62 if (pub_expt == NULL || ecc_shared == NULL || skey == NULL) { in ecc_encrypt_key() 69 if (skey != NULL) { in ecc_encrypt_key() 70 XFREE(skey); in ecc_encrypt_key() 97 if ((err = hash_memory(hash, ecc_shared, x, skey, &y)) != CRYPT_OK) { in ecc_encrypt_key() 103 skey[x] ^= in[x]; in ecc_encrypt_key() 109 … LTC_ASN1_OCTET_STRING, inlen, skey, in ecc_encrypt_key() 117 zeromem(skey, MAXBLOCKSIZE); in ecc_encrypt_key() 120 XFREE(skey); in ecc_encrypt_key()
|
A D | ecc_decrypt_key.c | 33 unsigned char *ecc_shared, *skey, *pub_expt; in ecc_decrypt_key() local 67 skey = XMALLOC(MAXBLOCKSIZE); in ecc_decrypt_key() 68 if (pub_expt == NULL || ecc_shared == NULL || skey == NULL) { in ecc_decrypt_key() 75 if (skey != NULL) { in ecc_decrypt_key() 76 XFREE(skey); in ecc_decrypt_key() 81 LTC_SET_ASN1(decode, 2, LTC_ASN1_OCTET_STRING, skey, MAXBLOCKSIZE); in ecc_decrypt_key() 120 out[x] = skey[x] ^ ecc_shared[x]; in ecc_decrypt_key() 129 zeromem(skey, MAXBLOCKSIZE); in ecc_decrypt_key() 134 XFREE(skey); in ecc_decrypt_key()
|
/optee_os/core/lib/libtomcrypt/src/pk/dsa/ |
A D | dsa_encrypt_key.c | 36 unsigned char *expt, *skey; in dsa_encrypt_key() local 65 skey = XMALLOC(MAXBLOCKSIZE); in dsa_encrypt_key() 66 if (expt == NULL || skey == NULL) { in dsa_encrypt_key() 70 if (skey != NULL) { in dsa_encrypt_key() 71 XFREE(skey); in dsa_encrypt_key() 96 if ((err = hash_memory(hash, expt, x, skey, &y)) != CRYPT_OK) { in dsa_encrypt_key() 102 skey[x] ^= in[x]; in dsa_encrypt_key() 108 … LTC_ASN1_OCTET_STRING, inlen, skey, in dsa_encrypt_key() 115 zeromem(skey, MAXBLOCKSIZE); in dsa_encrypt_key() 118 XFREE(skey); in dsa_encrypt_key()
|
A D | dsa_decrypt_key.c | 32 unsigned char *skey, *expt; in dsa_decrypt_key() local 69 skey = XMALLOC(MAXBLOCKSIZE); in dsa_decrypt_key() 70 if (expt == NULL || skey == NULL) { in dsa_decrypt_key() 74 if (skey != NULL) { in dsa_decrypt_key() 75 XFREE(skey); in dsa_decrypt_key() 82 LTC_SET_ASN1(decode, 2, LTC_ASN1_OCTET_STRING, skey, MAXBLOCKSIZE); in dsa_decrypt_key() 116 out[x] = expt[x] ^ skey[x]; in dsa_decrypt_key() 124 zeromem(skey, MAXBLOCKSIZE); in dsa_decrypt_key() 128 XFREE(skey); in dsa_decrypt_key()
|