/optee_os-3.20.0/core/lib/libtomcrypt/ |
A D | aes_accel.c | 102 LTC_ARGCHK(ct); in aes_ecb_encrypt_nblocks() 115 LTC_ARGCHK(ct); in aes_ecb_decrypt_nblocks() 127 return aes_ecb_encrypt_nblocks(pt, ct, 1, skey); in rijndael_ecb_encrypt() 133 return aes_ecb_decrypt_nblocks(ct, pt, 1, skey); in rijndael_ecb_decrypt() 141 LTC_ARGCHK(ct); in aes_cbc_encrypt_nblocks() 156 LTC_ARGCHK(ct); in aes_cbc_decrypt_nblocks() 171 LTC_ARGCHK(ct); in aes_ctr_encrypt_nblocks() 192 LTC_ARGCHK(ct); in aes_xts_encrypt_nblocks() 199 crypto_accel_aes_xts_enc(ct, pt, skey1->rijndael.eK, in aes_xts_encrypt_nblocks() 212 LTC_ARGCHK(ct); in aes_xts_decrypt_nblocks() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/modes/lrw/ |
A D | lrw_process.c | 21 int lrw_process(const unsigned char *pt, unsigned char *ct, unsigned long len, int mode, symmetric_… in lrw_process() argument 30 LTC_ARGCHK(ct != NULL); in lrw_process() 70 …*(LTC_FAST_TYPE_PTR_CAST(ct + x)) = *(LTC_FAST_TYPE_PTR_CAST(pt + x)) ^ *(LTC_FAST_TYPE_PTR_CAST(p… in lrw_process() 74 ct[x] = pt[x] ^ prod[x]; in lrw_process() 80 if ((err = cipher_descriptor[lrw->cipher]->ecb_encrypt(ct, ct, &lrw->key)) != CRYPT_OK) { in lrw_process() 84 if ((err = cipher_descriptor[lrw->cipher]->ecb_decrypt(ct, ct, &lrw->key)) != CRYPT_OK) { in lrw_process() 92 …*(LTC_FAST_TYPE_PTR_CAST(ct + x)) = *(LTC_FAST_TYPE_PTR_CAST(ct + x)) ^ *(LTC_FAST_TYPE_PTR_CAST(p… in lrw_process() 96 ct[x] = ct[x] ^ prod[x]; in lrw_process() 102 ct += 16; in lrw_process()
|
A D | lrw_decrypt.c | 19 int lrw_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_LRW *lrw) in lrw_decrypt() argument 24 LTC_ARGCHK(ct != NULL); in lrw_decrypt() 32 …return cipher_descriptor[lrw->cipher]->accel_lrw_decrypt(ct, pt, len, lrw->IV, lrw->tweak, &lrw->k… in lrw_decrypt() 35 return lrw_process(ct, pt, len, LRW_DECRYPT, lrw); in lrw_decrypt()
|
A D | lrw_encrypt.c | 19 int lrw_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_LRW *lrw) in lrw_encrypt() argument 24 LTC_ARGCHK(ct != NULL); in lrw_encrypt() 32 …return cipher_descriptor[lrw->cipher]->accel_lrw_encrypt(pt, ct, len, lrw->IV, lrw->tweak, &lrw->k… in lrw_encrypt() 35 return lrw_process(pt, ct, len, LRW_ENCRYPT, lrw); in lrw_encrypt()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/ciphers/ |
A D | skipjack.c | 145 LTC_ARGCHK(ct != NULL); in s_skipjack_ecb_encrypt() 175 ct[0] = (w1>>8)&255; ct[1] = w1&255; in s_skipjack_ecb_encrypt() 176 ct[2] = (w2>>8)&255; ct[3] = w2&255; in s_skipjack_ecb_encrypt() 177 ct[4] = (w3>>8)&255; ct[5] = w3&255; in s_skipjack_ecb_encrypt() 178 ct[6] = (w4>>8)&255; ct[7] = w4&255; in s_skipjack_ecb_encrypt() 209 LTC_ARGCHK(ct != NULL); in s_skipjack_ecb_decrypt() 213 w1 = ((unsigned)ct[0]<<8)|ct[1]; in s_skipjack_ecb_decrypt() 214 w2 = ((unsigned)ct[2]<<8)|ct[3]; in s_skipjack_ecb_decrypt() 215 w3 = ((unsigned)ct[4]<<8)|ct[5]; in s_skipjack_ecb_decrypt() 216 w4 = ((unsigned)ct[6]<<8)|ct[7]; in s_skipjack_ecb_decrypt() [all …]
|
A D | rc2.c | 155 LTC_ARGCHK(ct != NULL); in s_rc2_ecb_encrypt() 186 ct[0] = (unsigned char)x10; in s_rc2_ecb_encrypt() 187 ct[1] = (unsigned char)(x10 >> 8); in s_rc2_ecb_encrypt() 188 ct[2] = (unsigned char)x32; in s_rc2_ecb_encrypt() 190 ct[4] = (unsigned char)x54; in s_rc2_ecb_encrypt() 192 ct[6] = (unsigned char)x76; in s_rc2_ecb_encrypt() 234 LTC_ARGCHK(ct != NULL); in s_rc2_ecb_decrypt() 239 x76 = ((unsigned)ct[7] << 8) + (unsigned)ct[6]; in s_rc2_ecb_decrypt() 240 x54 = ((unsigned)ct[5] << 8) + (unsigned)ct[4]; in s_rc2_ecb_decrypt() 241 x32 = ((unsigned)ct[3] << 8) + (unsigned)ct[2]; in s_rc2_ecb_decrypt() [all …]
|
A D | noekeon.c | 107 int noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey) in s_noekeon_ecb_encrypt() 115 LTC_ARGCHK(ct != NULL); in s_noekeon_ecb_encrypt() 136 STORE32H(a,&ct[0]); STORE32H(b,&ct[4]); in s_noekeon_ecb_encrypt() 137 STORE32H(c,&ct[8]); STORE32H(d,&ct[12]); in s_noekeon_ecb_encrypt() 145 int err = s_noekeon_ecb_encrypt(pt, ct, skey); in noekeon_ecb_encrypt() 169 LTC_ARGCHK(ct != NULL); in s_noekeon_ecb_decrypt() 171 LOAD32H(a,&ct[0]); LOAD32H(b,&ct[4]); in s_noekeon_ecb_decrypt() 172 LOAD32H(c,&ct[8]); LOAD32H(d,&ct[12]); in s_noekeon_ecb_decrypt() 198 int err = s_noekeon_ecb_decrypt(ct, pt, skey); in noekeon_ecb_decrypt() 215 unsigned char key[16], pt[16], ct[16]; in noekeon_test() [all …]
|
A D | rc6.c | 117 int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey) in s_rc6_ecb_encrypt() 126 LTC_ARGCHK(ct != NULL); in s_rc6_ecb_encrypt() 150 STORE32L(a,&ct[0]);STORE32L(b,&ct[4]);STORE32L(c,&ct[8]);STORE32L(d,&ct[12]); in s_rc6_ecb_encrypt() 155 int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey) in rc6_ecb_encrypt() argument 157 int err = s_rc6_ecb_encrypt(pt, ct, skey); in rc6_ecb_encrypt() 172 int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey) in s_rc6_ecb_decrypt() 181 LTC_ARGCHK(ct != NULL); in s_rc6_ecb_decrypt() 183 LOAD32L(a,&ct[0]);LOAD32L(b,&ct[4]);LOAD32L(c,&ct[8]);LOAD32L(d,&ct[12]); in s_rc6_ecb_decrypt() 214 int err = s_rc6_ecb_decrypt(ct, pt, skey); in rc6_ecb_decrypt() 231 unsigned char key[32], pt[16], ct[16]; in rc6_test() [all …]
|
A D | kseed.c | 251 int kseed_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey) in kseed_ecb_encrypt() argument 259 STORE32H(P[2], ct); in kseed_ecb_encrypt() 260 STORE32H(P[3], ct+4); in kseed_ecb_encrypt() 261 STORE32H(P[0], ct+8); in kseed_ecb_encrypt() 262 STORE32H(P[1], ct+12); in kseed_ecb_encrypt() 276 LOAD32H(P[0], ct); in kseed_ecb_decrypt() 277 LOAD32H(P[1], ct+4); in kseed_ecb_decrypt() 278 LOAD32H(P[2], ct+8); in kseed_ecb_decrypt() 279 LOAD32H(P[3], ct+12); in kseed_ecb_decrypt() 306 unsigned char pt[16], ct[16], key[16]; in kseed_test() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/stream/rc4/ |
A D | rc4_test.c | 17 const unsigned char ct[] = { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 }; in rc4_stream_test() 22 …if (compare_testvector(buf, sizeof(ct), ct, sizeof(ct), "RC4-TV1", 0)) return CRYPT_FAIL_TESTVECT… in rc4_stream_test() 27 …if (compare_testvector(buf, sizeof(ct), ct, sizeof(ct), "RC4-TV2", 0)) return CRYPT_FAIL_TESTVECT… in rc4_stream_test()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/headers/ |
A D | tomcrypt_cipher.h | 521 unsigned char *ct, 545 unsigned char *ct, 603 int (*accel_xts_encrypt)(const unsigned char *pt, unsigned char *ct, 618 int (*accel_xts_decrypt)(const unsigned char *ct, unsigned char *pt, 635 int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 636 int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 645 int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 646 int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey); 656 int rc2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey); 982 unsigned char *ct, [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/stream/chacha/ |
A D | chacha_test.c | 24 …unsigned char ct[] = { 0x6E, 0x2E, 0x35, 0x9A, 0x25, 0x68, 0xF9, 0x80, 0x41, 0xBA, 0x07, 0x28, 0xD… in chacha_test() 46 …if (compare_testvector(out, len, ct, sizeof(ct), "CHACHA-TV1", 1)) return CRY… in chacha_test() 52 …if (compare_testvector(out, len, ct, sizeof(ct), "CHACHA-TV2", 1)) return CRY… in chacha_test() 58 …if (compare_testvector(out, len, ct, sizeof(ct), "CHACHA-TV3", 1)) return CRY… in chacha_test() 63 …if (compare_testvector(out, len, ct, sizeof(ct), "CHACHA-TV4", 1)) return CRY… in chacha_test() 68 …if (compare_testvector(out, len, ct, sizeof(ct), "CHACHA-TV5", 1)) return CRY… in chacha_test()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/ciphers/safer/ |
A D | saferp.c | 341 LTC_ARGCHK(ct != NULL); in saferp_ecb_encrypt() 352 ROUND(b, 0); LT(b, ct); in saferp_ecb_encrypt() 353 ROUND(ct, 2); LT(ct, b); in saferp_ecb_encrypt() 354 ROUND(b, 4); LT(b, ct); in saferp_ecb_encrypt() 355 ROUND(ct, 6); LT(ct, b); in saferp_ecb_encrypt() 357 ROUND(ct, 10); LT(ct, b); in saferp_ecb_encrypt() 359 ROUND(ct, 14); LT(ct, b); in saferp_ecb_encrypt() 363 ROUND(ct, 18); LT(ct, b); in saferp_ecb_encrypt() 365 ROUND(ct, 22); LT(ct, b); in saferp_ecb_encrypt() 370 ROUND(ct, 26); LT(ct, b); in saferp_ecb_encrypt() [all …]
|
/optee_os-3.20.0/core/crypto/ |
A D | sm4.c | 301 uint8_t ct[16] = { }; in sm4_crypt_xts() local 313 sm4_one_round(ctx->sk, ct, ct); in sm4_crypt_xts() 329 output[i] = ct[i]; in sm4_crypt_xts() 330 ct[i] = input[i]; in sm4_crypt_xts() 333 xor_128(ct, tweak, ct); in sm4_crypt_xts() 334 sm4_one_round(ctx->sk, ct, ct); in sm4_crypt_xts() 335 xor_128(ct, tweak, ct); in sm4_crypt_xts() 340 sm4_one_round(ctx->sk, ct, ct); in sm4_crypt_xts() 341 xor_128(ct, tweak1, ct); in sm4_crypt_xts() 347 xor_128(ct, tweak, ct); in sm4_crypt_xts() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/modes/ctr/ |
A D | ctr_encrypt.c | 41 static int s_ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_C… in s_ctr_encrypt() argument 57 …*(LTC_FAST_TYPE_PTR_CAST((unsigned char *)ct + x)) = *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pt … in s_ctr_encrypt() 61 ct += ctr->blocklen; in s_ctr_encrypt() 67 *ct++ = *pt++ ^ ctr->pad[ctr->padlen++]; in s_ctr_encrypt() 86 int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CTR *ctr) in ctr_encrypt() argument 92 LTC_ARGCHK(ct != NULL); in ctr_encrypt() 118 ct += (len / ctr->blocklen) * ctr->blocklen; in ctr_encrypt() 127 if ((err = s_ctr_encrypt(pt, ct, incr, ctr)) != CRYPT_OK) { in ctr_encrypt() 131 ct += incr; in ctr_encrypt() 133 return ctr_encrypt(pt, ct, len, ctr); in ctr_encrypt() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/encauth/eax/ |
A D | eax_decrypt.c | 20 int eax_decrypt(eax_state *eax, const unsigned char *ct, unsigned char *pt, in eax_decrypt() argument 27 LTC_ARGCHK(ct != NULL); in eax_decrypt() 30 if ((err = omac_process(&eax->ctomac, ct, length)) != CRYPT_OK) { in eax_decrypt() 35 return ctr_decrypt(ct, pt, length, &eax->ctr); in eax_decrypt()
|
A D | eax_encrypt.c | 20 int eax_encrypt(eax_state *eax, const unsigned char *pt, unsigned char *ct, in eax_encrypt() argument 27 LTC_ARGCHK(ct != NULL); in eax_encrypt() 30 if ((err = ctr_encrypt(pt, ct, length, &eax->ctr)) != CRYPT_OK) { in eax_encrypt() 35 return omac_process(&eax->ctomac, ct, length); in eax_encrypt()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/encauth/chachapoly/ |
A D | chacha20poly1305_test.c | 33 unsigned char ct[1000], pt[1000], emac[16], dmac[16]; in chacha20poly1305_test() 41 …if ((err = chacha20poly1305_encrypt(&st1, (unsigned char *)m, 25, ct)) != CRYPT_OK) re… in chacha20poly1305_test() 50 …if (compare_testvector(ct, mlen, enc, sizeof(enc), "ENC-CT", 1) != 0) return CRYPT_FAIL_TESTVECTOR; in chacha20poly1305_test() 57 if ((err = chacha20poly1305_decrypt(&st2, ct, 21, pt)) != CRYPT_OK) return err; in chacha20poly1305_test() 58 if ((err = chacha20poly1305_decrypt(&st2, ct + 21, mlen - 21, pt + 21)) != CRYPT_OK) return err; in chacha20poly1305_test() 69 …if (compare_testvector(ct, mlen, enc, sizeof(enc), "ENC-CT2", 1) != 0) return CRYPT_FAIL_TESTVECTO… in chacha20poly1305_test() 83 if ((err = chacha20poly1305_encrypt(&st1, rfc7905_pt, 16, ct)) != CRYPT_OK) return err; in chacha20poly1305_test() 87 if (compare_testvector(ct, 16, rfc7905_enc, 16, "ENC-CT3", 1) != 0) return CRYPT_FAIL_TESTVECTOR; in chacha20poly1305_test() 94 if ((err = chacha20poly1305_decrypt(&st1, ct, 16, pt)) != CRYPT_OK) return err; in chacha20poly1305_test() 105 if ((err = chacha20poly1305_encrypt(&st1, (unsigned char *)m, mlen, ct)) != CRYPT_OK) return err; in chacha20poly1305_test() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/modes/cbc/ |
A D | cbc_decrypt.c | 21 int cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CBC *cbc) in cbc_decrypt() argument 32 LTC_ARGCHK(ct != NULL); in cbc_decrypt() 54 …return cipher_descriptor[cbc->cipher]->accel_cbc_decrypt(ct, pt, len / cbc->blocklen, cbc->IV, &cb… in cbc_decrypt() 58 if ((err = cipher_descriptor[cbc->cipher]->ecb_decrypt(ct, tmp, &cbc->key)) != CRYPT_OK) { in cbc_decrypt() 66 …_TYPE_PTR_CAST((unsigned char *)cbc->IV + x)) = *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)ct + x)); in cbc_decrypt() 72 cbc->IV[x] = ct[x]; in cbc_decrypt() 77 ct += cbc->blocklen; in cbc_decrypt()
|
A D | cbc_encrypt.c | 21 int cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CBC *cbc) in cbc_encrypt() argument 26 LTC_ARGCHK(ct != NULL); in cbc_encrypt() 48 …return cipher_descriptor[cbc->cipher]->accel_cbc_encrypt(pt, ct, len / cbc->blocklen, cbc->IV, &cb… in cbc_encrypt() 63 if ((err = cipher_descriptor[cbc->cipher]->ecb_encrypt(cbc->IV, ct, &cbc->key)) != CRYPT_OK) { in cbc_encrypt() 70 …_TYPE_PTR_CAST((unsigned char *)cbc->IV + x)) = *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)ct + x)); in cbc_encrypt() 74 cbc->IV[x] = ct[x]; in cbc_encrypt() 78 ct += cbc->blocklen; in cbc_encrypt()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/modes/cfb/ |
A D | cfb_decrypt.c | 20 int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CFB *cfb) in cfb_decrypt() argument 25 LTC_ARGCHK(ct != NULL); in cfb_decrypt() 45 cfb->pad[cfb->padlen] = *ct; in cfb_decrypt() 46 *pt = *ct ^ cfb->IV[cfb->padlen]; in cfb_decrypt() 48 ++ct; in cfb_decrypt()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/modes/ecb/ |
A D | ecb_decrypt.c | 20 int ecb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_ECB *ecb) in ecb_decrypt() argument 24 LTC_ARGCHK(ct != NULL); in ecb_decrypt() 35 …return cipher_descriptor[ecb->cipher]->accel_ecb_decrypt(ct, pt, len / cipher_descriptor[ecb->ciph… in ecb_decrypt() 38 if ((err = cipher_descriptor[ecb->cipher]->ecb_decrypt(ct, pt, &ecb->key)) != CRYPT_OK) { in ecb_decrypt() 42 ct += cipher_descriptor[ecb->cipher]->block_length; in ecb_decrypt()
|
A D | ecb_encrypt.c | 20 int ecb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_ECB *ecb) in ecb_encrypt() argument 24 LTC_ARGCHK(ct != NULL); in ecb_encrypt() 35 …return cipher_descriptor[ecb->cipher]->accel_ecb_encrypt(pt, ct, len / cipher_descriptor[ecb->ciph… in ecb_encrypt() 38 if ((err = cipher_descriptor[ecb->cipher]->ecb_encrypt(pt, ct, &ecb->key)) != CRYPT_OK) { in ecb_encrypt() 42 ct += cipher_descriptor[ecb->cipher]->block_length; in ecb_encrypt()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/stream/sosemanuk/ |
A D | sosemanuk_test.c | 20 …unsigned char ct[] = { 0x7e, 0xfe, 0x2e, 0x6f, 0x8f, 0x77, 0x15, 0x72, 0x6a, 0x88, 0x14, 0xa6, 0x5… in sosemanuk_test() 33 …if (compare_testvector(out, len, ct, sizeof(ct), "SOSEMANUK-TV1", 1)) return … in sosemanuk_test() 39 …if (compare_testvector(out, len, ct, sizeof(ct), "SOSEMANUK-TV2", 1)) return CRYPT_FAIL_TEST… in sosemanuk_test() 44 …if (compare_testvector(out, len, ct, sizeof(ct), "SOSEMANUK-TV3", 1)) return CRYPT_FAIL_TEST… in sosemanuk_test()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/encauth/ocb/ |
A D | ocb_encrypt_authenticate_memory.c | 29 unsigned char *ct, in ocb_encrypt_authenticate_memory() argument 38 LTC_ARGCHK(ct != NULL); in ocb_encrypt_authenticate_memory() 53 if ((err = ocb_encrypt(ocb, pt, ct)) != CRYPT_OK) { in ocb_encrypt_authenticate_memory() 58 ct += ocb->block_len; in ocb_encrypt_authenticate_memory() 61 err = ocb_done_encrypt(ocb, pt, ptlen, ct, tag, taglen); in ocb_encrypt_authenticate_memory()
|