Home
last modified time | relevance | path

Searched refs:lrw (Results 1 – 9 of 9) sorted by relevance

/optee_os-3.20.0/core/lib/libtomcrypt/src/modes/lrw/
A Dlrw_process.c21 …rocess(const unsigned char *pt, unsigned char *ct, unsigned long len, int mode, symmetric_LRW *lrw) in lrw_process() argument
31 LTC_ARGCHK(lrw != NULL); in lrw_process()
39 XMEMCPY(prod, lrw->pad, 16); in lrw_process()
43 lrw->IV[x] = (lrw->IV[x] + 1) & 255; in lrw_process()
44 if (lrw->IV[x]) { in lrw_process()
55 …FAST_TYPE_PTR_CAST(lrw->pad + y)) ^= *(LTC_FAST_TYPE_PTR_CAST(&lrw->PC[x][lrw->IV[x]][y])) ^ *(LTC… in lrw_process()
59 lrw->pad[y] ^= lrw->PC[x][lrw->IV[x]][y] ^ lrw->PC[x][(lrw->IV[x]-1)&255][y]; in lrw_process()
64 gcm_gf_mult(lrw->tweak, lrw->IV, lrw->pad); 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()
A Dlrw_setiv.c19 int lrw_setiv(const unsigned char *IV, unsigned long len, symmetric_LRW *lrw) in lrw_setiv() argument
27 LTC_ARGCHK(lrw != NULL); in lrw_setiv()
33 if ((err = cipher_is_valid(lrw->cipher)) != CRYPT_OK) { in lrw_setiv()
38 XMEMCPY(lrw->IV, IV, 16); in lrw_setiv()
41 …if (cipher_descriptor[lrw->cipher]->accel_lrw_encrypt != NULL && cipher_descriptor[lrw->cipher]->a… in lrw_setiv()
47 XMEMCPY(T, &lrw->PC[0][IV[0]][0], 16); in lrw_setiv()
51 *(LTC_FAST_TYPE_PTR_CAST(T + y)) ^= *(LTC_FAST_TYPE_PTR_CAST(&lrw->PC[x][IV[x]][y])); in lrw_setiv()
55 T[y] ^= lrw->PC[x][IV[x]][y]; in lrw_setiv()
59 XMEMCPY(lrw->pad, T, 16); in lrw_setiv()
61 gcm_gf_mult(lrw->tweak, IV, lrw->pad); in lrw_setiv()
A Dlrw_test.c65 symmetric_LRW lrw; in lrw_test()
84 lrw_done(&lrw); in lrw_test()
89 if ((err = lrw_encrypt(tests[x].P, buf[0], 16, &lrw)) != CRYPT_OK) { in lrw_test()
90 lrw_done(&lrw); in lrw_test()
95 lrw_done(&lrw); in lrw_test()
100 if ((err = lrw_setiv(tests[x].IV, 16, &lrw)) != CRYPT_OK) { in lrw_test()
101 lrw_done(&lrw); in lrw_test()
105 if ((err = lrw_decrypt(buf[0], buf[1], 16, &lrw)) != CRYPT_OK) { in lrw_test()
106 lrw_done(&lrw); in lrw_test()
111 lrw_done(&lrw); in lrw_test()
[all …]
A Dlrw_decrypt.c19 int lrw_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_LRW *lrw) in lrw_decrypt() argument
25 LTC_ARGCHK(lrw != NULL); in lrw_decrypt()
27 if ((err = cipher_is_valid(lrw->cipher)) != CRYPT_OK) { in lrw_decrypt()
31 if (cipher_descriptor[lrw->cipher]->accel_lrw_decrypt != 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 Dlrw_encrypt.c19 int lrw_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_LRW *lrw) in lrw_encrypt() argument
25 LTC_ARGCHK(lrw != NULL); in lrw_encrypt()
27 if ((err = cipher_is_valid(lrw->cipher)) != CRYPT_OK) { in lrw_encrypt()
31 if (cipher_descriptor[lrw->cipher]->accel_lrw_encrypt != 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()
A Dlrw_start.c28 symmetric_LRW *lrw) in lrw_start() argument
39 LTC_ARGCHK(lrw != NULL); in lrw_start()
56 if ((err = cipher_descriptor[cipher]->setup(key, keylen, num_rounds, &lrw->key)) != CRYPT_OK) { in lrw_start()
59 lrw->cipher = cipher; in lrw_start()
62 XMEMCPY(lrw->tweak, tweak, 16); in lrw_start()
70 gcm_gf_mult(tweak, B, &lrw->PC[0][y][0]); in lrw_start()
77 t = lrw->PC[x-1][y][15]; in lrw_start()
79 lrw->PC[x][y][z] = lrw->PC[x-1][y][z-1]; in lrw_start()
81 lrw->PC[x][y][0] = gcm_shift_table[t<<1]; in lrw_start()
82 lrw->PC[x][y][1] ^= gcm_shift_table[(t<<1)+1]; in lrw_start()
[all …]
A Dlrw_done.c17 int lrw_done(symmetric_LRW *lrw) in lrw_done() argument
21 LTC_ARGCHK(lrw != NULL); in lrw_done()
23 if ((err = cipher_is_valid(lrw->cipher)) != CRYPT_OK) { in lrw_done()
26 cipher_descriptor[lrw->cipher]->done(&lrw->key); in lrw_done()
A Dlrw_getiv.c19 int lrw_getiv(unsigned char *IV, unsigned long *len, const symmetric_LRW *lrw) in lrw_getiv() argument
23 LTC_ARGCHK(lrw != NULL); in lrw_getiv()
29 XMEMCPY(IV, lrw->IV, 16); in lrw_getiv()
/optee_os-3.20.0/core/lib/libtomcrypt/src/headers/
A Dtomcrypt_cipher.h942 symmetric_LRW *lrw);
943 int lrw_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_LRW *lrw);
944 int lrw_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_LRW *lrw);
945 int lrw_getiv(unsigned char *IV, unsigned long *len, const symmetric_LRW *lrw);
946 int lrw_setiv(const unsigned char *IV, unsigned long len, symmetric_LRW *lrw);
947 int lrw_done(symmetric_LRW *lrw);
951 …ocess(const unsigned char *pt, unsigned char *ct, unsigned long len, int mode, symmetric_LRW *lrw);

Completed in 14 milliseconds