/optee_os-3.20.0/core/lib/libtomcrypt/src/ciphers/safer/ |
A D | saferp.c | 344 if (skey->saferp.rounds < 8 || skey->saferp.rounds > 16) { in saferp_ecb_encrypt() 374 ct[0] = b[0] ^ skey->saferp.K[skey->saferp.rounds*2][0]; in saferp_ecb_encrypt() 377 ct[3] = b[3] ^ skey->saferp.K[skey->saferp.rounds*2][3]; in saferp_ecb_encrypt() 378 ct[4] = b[4] ^ skey->saferp.K[skey->saferp.rounds*2][4]; in saferp_ecb_encrypt() 381 ct[7] = b[7] ^ skey->saferp.K[skey->saferp.rounds*2][7]; in saferp_ecb_encrypt() 382 ct[8] = b[8] ^ skey->saferp.K[skey->saferp.rounds*2][8]; in saferp_ecb_encrypt() 417 b[0] = ct[0] ^ skey->saferp.K[skey->saferp.rounds*2][0]; in saferp_ecb_decrypt() 420 b[3] = ct[3] ^ skey->saferp.K[skey->saferp.rounds*2][3]; in saferp_ecb_decrypt() 421 b[4] = ct[4] ^ skey->saferp.K[skey->saferp.rounds*2][4]; in saferp_ecb_decrypt() 424 b[7] = ct[7] ^ skey->saferp.K[skey->saferp.rounds*2][7]; in saferp_ecb_decrypt() [all …]
|
A D | safer.c | 177 LTC_ARGCHK(skey != NULL); in safer_k64_setup() 194 LTC_ARGCHK(skey != NULL); in safer_sk64_setup() 211 LTC_ARGCHK(skey != NULL); in safer_k128_setup() 228 LTC_ARGCHK(skey != NULL); in safer_sk128_setup() 257 LTC_ARGCHK(skey != NULL); in s_safer_ecb_encrypt() 259 key = skey->safer.key; in s_safer_ecb_encrypt() 313 key = skey->safer.key; in s_safer_ecb_decrypt() 380 symmetric_key skey; in safer_k64_test() 410 symmetric_key skey; in safer_sk64_test() 442 LTC_UNUSED_PARAM(skey); in safer_done() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/ciphers/ |
A D | camellia.c | 209 LTC_ARGCHK(skey != NULL); in camellia_setup() 439 L ^= skey->camellia.kw[0]; in camellia_ecb_encrypt() 440 R ^= skey->camellia.kw[1]; in camellia_ecb_encrypt() 519 L ^= skey->camellia.kw[3]; in camellia_ecb_encrypt() 520 R ^= skey->camellia.kw[2]; in camellia_ecb_encrypt() 533 L ^= skey->camellia.kw[3]; in camellia_ecb_decrypt() 534 R ^= skey->camellia.kw[2]; in camellia_ecb_decrypt() 679 symmetric_key skey; in camellia_test() 684 zeromem(&skey, sizeof(skey)); in camellia_test() 696 camellia_done(&skey); in camellia_test() [all …]
|
A D | blowfish.c | 295 #define F(x) ((skey->blowfish.S[0][LTC_BYTE(x,3)] + skey->blowfish.S[1][LTC_BYTE(x,2)]) ^ skey->blo… 306 S1 = skey->blowfish.S[0]; in s_blowfish_encipher() 307 S2 = skey->blowfish.S[1]; in s_blowfish_encipher() 308 S3 = skey->blowfish.S[2]; in s_blowfish_encipher() 309 S4 = skey->blowfish.S[3]; in s_blowfish_encipher() 324 l ^= skey->blowfish.K[16]; in s_blowfish_encipher() 325 r ^= skey->blowfish.K[17]; in s_blowfish_encipher() 377 LTC_ARGCHK(skey != NULL); in blowfish_expand() 484 LTC_ARGCHK(skey != NULL); in s_blowfish_ecb_encrypt() 529 LTC_ARGCHK(skey != NULL); in s_blowfish_ecb_decrypt() [all …]
|
A D | cast5.c | 538 L ^= FI(R, skey->cast5.K[0], skey->cast5.K[16]); in s_cast5_ecb_encrypt() 539 R ^= FII(L, skey->cast5.K[1], skey->cast5.K[17]); in s_cast5_ecb_encrypt() 541 R ^= FI(L, skey->cast5.K[3], skey->cast5.K[19]); in s_cast5_ecb_encrypt() 542 L ^= FII(R, skey->cast5.K[4], skey->cast5.K[20]); in s_cast5_ecb_encrypt() 544 L ^= FI(R, skey->cast5.K[6], skey->cast5.K[22]); in s_cast5_ecb_encrypt() 545 R ^= FII(L, skey->cast5.K[7], skey->cast5.K[23]); in s_cast5_ecb_encrypt() 547 R ^= FI(L, skey->cast5.K[9], skey->cast5.K[25]); in s_cast5_ecb_encrypt() 599 R ^= FI(L, skey->cast5.K[9], skey->cast5.K[25]); in s_cast5_ecb_decrypt() 602 L ^= FI(R, skey->cast5.K[6], skey->cast5.K[22]); in s_cast5_ecb_decrypt() 605 R ^= FI(L, skey->cast5.K[3], skey->cast5.K[19]); in s_cast5_ecb_decrypt() [all …]
|
A D | xtea.c | 31 LTC_ARGCHK(skey != NULL); in xtea_setup() 49 skey->xtea.A[x] = (sum + K[sum&3]) & 0xFFFFFFFFUL; in xtea_setup() 51 skey->xtea.B[x] = (sum + K[(sum>>11)&3]) & 0xFFFFFFFFUL; in xtea_setup() 75 LTC_ARGCHK(skey != NULL); in xtea_ecb_encrypt() 111 LTC_ARGCHK(skey != NULL); in xtea_ecb_decrypt() 198 symmetric_key skey; in xtea_test() 201 zeromem(&skey, sizeof(skey)); in xtea_test() 205 xtea_ecb_encrypt(tests[i].pt, tmp[0], &skey); in xtea_test() 206 xtea_ecb_decrypt(tmp[0], tmp[1], &skey); in xtea_test() 227 void xtea_done(symmetric_key *skey) in xtea_done() argument [all …]
|
A D | tea.c | 32 LTC_ARGCHK(skey != NULL); in tea_setup() 44 LOAD32H(skey->tea.k[0], key+0); in tea_setup() 67 LTC_ARGCHK(skey != NULL); in tea_ecb_encrypt() 73 y += ((z<<4) + skey->tea.k[0]) ^ (z + sum) ^ ((z>>5) + skey->tea.k[1]); in tea_ecb_encrypt() 74 z += ((y<<4) + skey->tea.k[2]) ^ (y + sum) ^ ((y>>5) + skey->tea.k[3]); in tea_ecb_encrypt() 96 LTC_ARGCHK(skey != NULL); in tea_ecb_decrypt() 102 v1 -= ((v0 << 4) + skey->tea.k[2]) ^ (v0 + sum) ^ ((v0 >> 5) + skey->tea.k[3]); in tea_ecb_decrypt() 103 v0 -= ((v1 << 4) + skey->tea.k[0]) ^ (v1 + sum) ^ ((v1 >> 5) + skey->tea.k[1]); in tea_ecb_decrypt() 150 symmetric_key skey; in tea_test() 154 zeromem(&skey, sizeof(skey)); in tea_test() [all …]
|
A D | rc5.c | 53 LTC_ARGCHK(skey != NULL); in s_rc5_setup() 71 S = skey->rc5.K; in s_rc5_setup() 133 if (skey->rc5.rounds < 12 || skey->rc5.rounds > 24) { in s_rc5_ecb_encrypt() 139 A += skey->rc5.K[0]; in s_rc5_ecb_encrypt() 140 B += skey->rc5.K[1]; in s_rc5_ecb_encrypt() 141 K = skey->rc5.K + 2; in s_rc5_ecb_encrypt() 193 if (skey->rc5.rounds < 12 || skey->rc5.rounds > 24) { in s_rc5_ecb_decrypt() 199 K = skey->rc5.K + (skey->rc5.rounds << 1); in s_rc5_ecb_decrypt() 217 A -= skey->rc5.K[0]; in s_rc5_ecb_decrypt() 218 B -= skey->rc5.K[1]; in s_rc5_ecb_decrypt() [all …]
|
A D | anubis.c | 890 LTC_ARGCHK(skey != NULL); in s_anubis_setup() 995 skey->anubis.roundKeyDec[0][i] = skey->anubis.roundKeyEnc[R][i]; in s_anubis_setup() 996 skey->anubis.roundKeyDec[R][i] = skey->anubis.roundKeyEnc[0][i]; in s_anubis_setup() 1127 LTC_ARGCHK(skey != NULL); in anubis_ecb_encrypt() 1129 if (skey->anubis.R < 12 || skey->anubis.R > 18) { in anubis_ecb_encrypt() 1133 anubis_crypt(pt, ct, skey->anubis.roundKeyEnc, skey->anubis.R); in anubis_ecb_encrypt() 1148 LTC_ARGCHK(skey != NULL); in anubis_ecb_decrypt() 1150 if (skey->anubis.R < 12 || skey->anubis.R > 18) { in anubis_ecb_decrypt() 1154 anubis_crypt(ct, pt, skey->anubis.roundKeyDec, skey->anubis.R); in anubis_ecb_decrypt() 1491 symmetric_key skey; in anubis_test() [all …]
|
A D | noekeon.c | 72 LTC_ARGCHK(skey != NULL); in noekeon_setup() 82 LOAD32H(skey->noekeon.K[0],&key[0]); in noekeon_setup() 83 LOAD32H(skey->noekeon.K[1],&key[4]); in noekeon_setup() 84 LOAD32H(skey->noekeon.K[2],&key[8]); in noekeon_setup() 85 LOAD32H(skey->noekeon.K[3],&key[12]); in noekeon_setup() 92 kTHETA(skey->noekeon.dK[0], skey->noekeon.dK[1], skey->noekeon.dK[2], skey->noekeon.dK[3]); in noekeon_setup() 113 LTC_ARGCHK(skey != NULL); in s_noekeon_ecb_encrypt() 134 THETA(skey->noekeon.K, a, b, c, d); in s_noekeon_ecb_encrypt() 167 LTC_ARGCHK(skey != NULL); in s_noekeon_ecb_decrypt() 188 THETA(skey->noekeon.dK, a,b,c,d); in s_noekeon_ecb_decrypt() [all …]
|
A D | kasumi.c | 140 LTC_ARGCHK(skey != NULL); in kasumi_ecb_encrypt() 146 temp = FL(left, n, skey); in kasumi_ecb_encrypt() 147 temp = FO(temp, n++, skey); in kasumi_ecb_encrypt() 149 temp = FO(right, n, skey); in kasumi_ecb_encrypt() 150 temp = FL(temp, n++, skey); in kasumi_ecb_encrypt() 167 LTC_ARGCHK(skey != NULL); in kasumi_ecb_decrypt() 173 temp = FO(right, n, skey); in kasumi_ecb_decrypt() 174 temp = FL(temp, n--, skey); in kasumi_ecb_decrypt() 176 temp = FL(left, n, skey); in kasumi_ecb_decrypt() 194 LTC_ARGCHK(skey != NULL); in kasumi_setup() [all …]
|
A D | rc6.c | 129 b += skey->rc6.K[0]; in s_rc6_ecb_encrypt() 130 d += skey->rc6.K[1]; in s_rc6_ecb_encrypt() 138 K = skey->rc6.K + 2; in s_rc6_ecb_encrypt() 148 a += skey->rc6.K[42]; in s_rc6_ecb_encrypt() 149 c += skey->rc6.K[43]; in s_rc6_ecb_encrypt() 184 a -= skey->rc6.K[42]; in s_rc6_ecb_decrypt() 185 c -= skey->rc6.K[43]; in s_rc6_ecb_decrypt() 193 K = skey->rc6.K + 40; in s_rc6_ecb_decrypt() 204 b -= skey->rc6.K[0]; in s_rc6_ecb_decrypt() 205 d -= skey->rc6.K[1]; in s_rc6_ecb_decrypt() [all …]
|
A D | rc2.c | 65 unsigned *xkey = skey->rc2.xkey; in rc2_setup_ex() 71 LTC_ARGCHK(skey != NULL); in rc2_setup_ex() 156 LTC_ARGCHK(skey != NULL); in s_rc2_ecb_encrypt() 158 xkey = skey->rc2.xkey; in s_rc2_ecb_encrypt() 203 int err = s_rc2_ecb_encrypt(pt, ct, skey); in rc2_ecb_encrypt() 235 LTC_ARGCHK(skey != NULL); in s_rc2_ecb_decrypt() 237 xkey = skey->rc2.xkey; in s_rc2_ecb_decrypt() 282 int err = s_rc2_ecb_decrypt(ct, pt, skey); in rc2_ecb_decrypt() 346 symmetric_key skey; in rc2_test() 383 void rc2_done(symmetric_key *skey) in rc2_done() argument [all …]
|
A D | kseed.c | 214 skey->kseed.K[2*i+0] = G(k1 + k3 - KCi[i]); in kseed_setup() 215 skey->kseed.K[2*i+1] = G(k2 - k4 + KCi[i]); in kseed_setup() 226 skey->kseed.dK[2*(15-i)+0] = skey->kseed.K[2*i+0]; in kseed_setup() 227 skey->kseed.dK[2*(15-i)+1] = skey->kseed.K[2*i+1]; in kseed_setup() 258 rounds(P, skey->kseed.K); in kseed_ecb_encrypt() 280 rounds(P, skey->kseed.dK); in kseed_ecb_decrypt() 291 void kseed_done(symmetric_key *skey) in kseed_done() argument 293 LTC_UNUSED_PARAM(skey); in kseed_done() 335 symmetric_key skey; in kseed_test() 338 kseed_setup(tests[x].key, 16, 0, &skey); in kseed_test() [all …]
|
A D | multi2.c | 120 LTC_ARGCHK(skey != NULL); in multi2_setup() 125 skey->multi2.N = num_rounds; in multi2_setup() 131 s_setup(dk, sk, skey->multi2.uk); in multi2_setup() 150 LTC_ARGCHK(skey != NULL); in multi2_ecb_encrypt() 153 s_encrypt(p, skey->multi2.N, skey->multi2.uk); in multi2_ecb_encrypt() 171 LTC_ARGCHK(skey != NULL); in multi2_ecb_decrypt() 174 s_decrypt(p, skey->multi2.N, skey->multi2.uk); in multi2_ecb_decrypt() 242 symmetric_key skey; in multi2_test() local 257 if ((err = multi2_ecb_decrypt(buf, buf, &skey)) != CRYPT_OK) { in multi2_test() 288 void multi2_done(symmetric_key *skey) in multi2_done() argument [all …]
|
A D | skipjack.c | 64 LTC_ARGCHK(skey != NULL); in skipjack_setup() 76 skey->skipjack.key[x] = key[x] & 255; in skipjack_setup() 83 tmp = g_func(w1, &kp, skey->skipjack.key); \ 89 tmp = g_func(w1, &kp, skey->skipjack.key); \ 96 w1 = ig_func(w2, &kp, skey->skipjack.key); \ 146 LTC_ARGCHK(skey != NULL); in s_skipjack_ecb_encrypt() 186 int err = s_skipjack_ecb_encrypt(pt, ct, skey); in skipjack_ecb_encrypt() 210 LTC_ARGCHK(skey != NULL); in s_skipjack_ecb_decrypt() 254 int err = s_skipjack_ecb_decrypt(ct, pt, skey); in skipjack_ecb_decrypt() 312 void skipjack_done(symmetric_key *skey) in skipjack_done() argument [all …]
|
/optee_os-3.20.0/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-3.20.0/core/lib/libtomcrypt/src/headers/ |
A D | tomcrypt_cipher.h | 419 void (*done)(symmetric_key *skey); 638 void rc5_done(symmetric_key *skey); 648 void rc6_done(symmetric_key *skey); 659 void rc2_done(symmetric_key *skey); 684 void safer_done(symmetric_key *skey); 723 void xtea_done(symmetric_key *skey); 743 void des_done(symmetric_key *skey); 749 void des3_done(symmetric_key *skey); 759 void cast5_done(symmetric_key *skey); 850 void idea_done(symmetric_key *skey); [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/ciphers/twofish/ |
A D | twofish.c | 351 LTC_ARGCHK(skey != NULL); in s_twofish_setup() 482 S1 = skey->twofish.S[0]; in s_twofish_ecb_encrypt() 483 S2 = skey->twofish.S[1]; in s_twofish_ecb_encrypt() 484 S3 = skey->twofish.S[2]; in s_twofish_ecb_encrypt() 485 S4 = skey->twofish.S[3]; in s_twofish_ecb_encrypt() 490 a ^= skey->twofish.K[0]; in s_twofish_ecb_encrypt() 491 b ^= skey->twofish.K[1]; in s_twofish_ecb_encrypt() 492 c ^= skey->twofish.K[2]; in s_twofish_ecb_encrypt() 493 d ^= skey->twofish.K[3]; in s_twofish_ecb_encrypt() 556 S1 = skey->twofish.S[0]; in s_twofish_ecb_decrypt() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/mac/xcbc/ |
A D | xcbc_init.c | 22 symmetric_key *skey; in xcbc_init() local 39 skey = NULL; in xcbc_init() 58 skey = XCALLOC(1, sizeof(*skey)); in xcbc_init() 59 if (skey == NULL) { in xcbc_init() 63 if ((err = cipher_descriptor[cipher]->setup(key, keylen, 0, skey)) != CRYPT_OK) { in xcbc_init() 72 cipher_descriptor[cipher]->ecb_encrypt(xcbc->K[y], xcbc->K[y], skey); in xcbc_init() 85 cipher_descriptor[cipher]->done(skey); in xcbc_init() 86 if (skey != NULL) { in xcbc_init() 88 zeromem(skey, sizeof(*skey)); in xcbc_init() 90 XFREE(skey); in xcbc_init()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/encauth/ccm/ |
A D | ccm_memory.c | 45 symmetric_key *skey; in ccm_memory() local 117 skey = XMALLOC(sizeof(*skey)); in ccm_memory() 118 if (skey == NULL) { in ccm_memory() 124 XFREE(skey); in ccm_memory() 128 skey = uskey; in ccm_memory() 169 if ((err = cipher_descriptor[cipher]->ecb_encrypt(PAD, PAD, skey)) != CRYPT_OK) { in ccm_memory() 321 if (skey != uskey) { in ccm_memory() 322 cipher_descriptor[cipher]->done(skey); in ccm_memory() 324 zeromem(skey, sizeof(*skey)); in ccm_memory() 365 if (skey != uskey) { in ccm_memory() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/dsa/ |
A D | dsa_encrypt_key.c | 29 unsigned char *expt, *skey; in dsa_encrypt_key() local 58 skey = XMALLOC(MAXBLOCKSIZE); in dsa_encrypt_key() 59 if (expt == NULL || skey == NULL) { in dsa_encrypt_key() 63 if (skey != NULL) { in dsa_encrypt_key() 64 XFREE(skey); in dsa_encrypt_key() 89 if ((err = hash_memory(hash, expt, x, skey, &y)) != CRYPT_OK) { in dsa_encrypt_key() 95 skey[x] ^= in[x]; in dsa_encrypt_key() 101 … LTC_ASN1_OCTET_STRING, inlen, skey, in dsa_encrypt_key() 108 zeromem(skey, MAXBLOCKSIZE); in dsa_encrypt_key() 111 XFREE(skey); in dsa_encrypt_key()
|
A D | dsa_decrypt_key.c | 25 unsigned char *skey, *expt; in dsa_decrypt_key() local 62 skey = XMALLOC(MAXBLOCKSIZE); in dsa_decrypt_key() 63 if (expt == NULL || skey == NULL) { in dsa_decrypt_key() 67 if (skey != NULL) { in dsa_decrypt_key() 68 XFREE(skey); in dsa_decrypt_key() 75 LTC_SET_ASN1(decode, 2, LTC_ASN1_OCTET_STRING, skey, MAXBLOCKSIZE); in dsa_decrypt_key() 109 out[x] = expt[x] ^ skey[x]; in dsa_decrypt_key() 117 zeromem(skey, MAXBLOCKSIZE); in dsa_decrypt_key() 121 XFREE(skey); in dsa_decrypt_key()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/ecc/ |
A D | ecc_encrypt_key.c | 30 unsigned char *pub_expt, *ecc_shared, *skey; in ecc_encrypt_key() local 54 skey = XMALLOC(MAXBLOCKSIZE); in ecc_encrypt_key() 55 if (pub_expt == NULL || ecc_shared == NULL || skey == NULL) { in ecc_encrypt_key() 62 if (skey != NULL) { in ecc_encrypt_key() 63 XFREE(skey); in ecc_encrypt_key() 90 if ((err = hash_memory(hash, ecc_shared, x, skey, &y)) != CRYPT_OK) { in ecc_encrypt_key() 96 skey[x] ^= in[x]; in ecc_encrypt_key() 102 … LTC_ASN1_OCTET_STRING, inlen, skey, in ecc_encrypt_key() 110 zeromem(skey, MAXBLOCKSIZE); in ecc_encrypt_key() 113 XFREE(skey); in ecc_encrypt_key()
|