/optee_os/core/lib/libtomcrypt/src/hashes/ |
A D | sha3.c | 209 md->sha3.s[md->sha3.word_index] ^= (md->sha3.saved ^ (pad << (md->sha3.byte_index * 8))); in _done() 215 STORE64L(md->sha3.s[i], md->sha3.sb + i * 8); in _done() 227 XMEMSET(&md->sha3, 0, sizeof(md->sha3)); in sha3_224_init() 235 XMEMSET(&md->sha3, 0, sizeof(md->sha3)); in sha3_256_init() 243 XMEMSET(&md->sha3, 0, sizeof(md->sha3)); in sha3_384_init() 251 XMEMSET(&md->sha3, 0, sizeof(md->sha3)); in sha3_512_init() 261 XMEMSET(&md->sha3, 0, sizeof(md->sha3)); in sha3_shake_init() 289 md->sha3.s[md->sha3.word_index] ^= md->sha3.saved; in sha3_process() 305 md->sha3.s[md->sha3.word_index] ^= t; in sha3_process() 346 …md->sha3.s[md->sha3.word_index] ^= (md->sha3.saved ^ (CONST64(0x1F) << (md->sha3.byte_index * 8))); in sha3_shake_done() [all …]
|
A D | md2.c | 80 md->md2.X[16+j] = md->md2.buf[j]; in md2_compress() 81 md->md2.X[32+j] = md->md2.X[j] ^ md->md2.X[16+j]; in md2_compress() 105 zeromem(md->md2.X, sizeof(md->md2.X)); in md2_init() 106 zeromem(md->md2.chksum, sizeof(md->md2.chksum)); in md2_init() 107 zeromem(md->md2.buf, sizeof(md->md2.buf)); in md2_init() 124 if (md-> md2 .curlen > sizeof(md-> md2 .buf)) { in md2_process() 129 XMEMCPY(md->md2.buf + md->md2.curlen, in, (size_t)n); in md2_process() 157 if (md->md2.curlen >= sizeof(md->md2.buf)) { in md2_done() 169 md2_compress(md); in md2_done() 173 XMEMCPY(md->md2.buf, md->md2.chksum, 16); in md2_done() [all …]
|
A D | blake2b.c | 173 if (md->blake2b.t[0] < inc) md->blake2b.t[1]++; in blake2b_increment_counter() 179 XMEMSET(&md->blake2b, 0, sizeof(md->blake2b)); in blake2b_init0() 349 md->blake2b.h[i] = md->blake2b.h[i] ^ v[i] ^ v[i + 8]; in _blake2b_compress() 379 if (md->blake2b.curlen > sizeof(md->blake2b.buf)) { in blake2b_process() 390 blake2b_compress(md, md->blake2b.buf); /* Compress */ in blake2b_process() 400 XMEMCPY(md->blake2b.buf + md->blake2b.curlen, in, inlen); in blake2b_process() 426 blake2b_increment_counter(md, md->blake2b.curlen); in blake2b_done() 428 …XMEMSET(md->blake2b.buf + md->blake2b.curlen, 0, BLAKE2B_BLOCKBYTES - md->blake2b.curlen); /* Padd… in blake2b_done() 429 blake2b_compress(md, md->blake2b.buf); in blake2b_done() 480 hash_state md; in blake2b_512_test() [all …]
|
A D | blake2s.c | 165 if (md->blake2s.t[0] < inc) md->blake2s.t[1]++; in blake2s_increment_counter() 339 md->blake2s.h[i] = md->blake2s.h[i] ^ v[i] ^ v[i + 8]; in _blake2s_compress() 368 if (md->blake2s.curlen > sizeof(md->blake2s.buf)) { in blake2s_process() 379 blake2s_compress(md, md->blake2s.buf); /* Compress */ in blake2s_process() 389 XMEMCPY(md->blake2s.buf + md->blake2s.curlen, in, inlen); in blake2s_process() 414 blake2s_increment_counter(md, md->blake2s.curlen); in blake2s_done() 416 …XMEMSET(md->blake2s.buf + md->blake2s.curlen, 0, BLAKE2S_BLOCKBYTES - md->blake2s.curlen); /* Padd… in blake2s_done() 417 blake2s_compress(md, md->blake2s.buf); in blake2s_done() 470 hash_state md; in blake2s_256_test() 514 hash_state md; in blake2s_224_test() [all …]
|
A D | sha1.c | 140 md->sha1.state[0] = md->sha1.state[0] + a; in _sha1_compress() 141 md->sha1.state[1] = md->sha1.state[1] + b; in _sha1_compress() 142 md->sha1.state[2] = md->sha1.state[2] + c; in _sha1_compress() 143 md->sha1.state[3] = md->sha1.state[3] + d; in _sha1_compress() 144 md->sha1.state[4] = md->sha1.state[4] + e; in _sha1_compress() 199 if (md->sha1.curlen >= sizeof(md->sha1.buf)) { in sha1_done() 204 md->sha1.length += md->sha1.curlen * 8; in sha1_done() 207 md->sha1.buf[md->sha1.curlen++] = (unsigned char)0x80; in sha1_done() 217 sha1_compress(md, md->sha1.buf); in sha1_done() 227 STORE64H(md->sha1.length, md->sha1.buf+56); in sha1_done() [all …]
|
A D | md4.c | 150 md->md4.state[0] = md->md4.state[0] + a; in _md4_compress() 151 md->md4.state[1] = md->md4.state[1] + b; in _md4_compress() 152 md->md4.state[2] = md->md4.state[2] + c; in _md4_compress() 153 md->md4.state[3] = md->md4.state[3] + d; in _md4_compress() 207 if (md->md4.curlen >= sizeof(md->md4.buf)) { in md4_done() 212 md->md4.length += md->md4.curlen * 8; in md4_done() 215 md->md4.buf[md->md4.curlen++] = (unsigned char)0x80; in md4_done() 225 md4_compress(md, md->md4.buf); in md4_done() 231 md->md4.buf[md->md4.curlen++] = (unsigned char)0; in md4_done() 235 STORE64L(md->md4.length, md->md4.buf+56); in md4_done() [all …]
|
A D | md5.c | 209 md->md5.state[0] = md->md5.state[0] + a; in _md5_compress() 210 md->md5.state[1] = md->md5.state[1] + b; in _md5_compress() 211 md->md5.state[2] = md->md5.state[2] + c; in _md5_compress() 212 md->md5.state[3] = md->md5.state[3] + d; in _md5_compress() 266 if (md->md5.curlen >= sizeof(md->md5.buf)) { in md5_done() 272 md->md5.length += md->md5.curlen * 8; in md5_done() 275 md->md5.buf[md->md5.curlen++] = (unsigned char)0x80; in md5_done() 285 md5_compress(md, md->md5.buf); in md5_done() 291 md->md5.buf[md->md5.curlen++] = (unsigned char)0; in md5_done() 295 STORE64L(md->md5.length, md->md5.buf+56); in md5_done() [all …]
|
A D | rmd256.c | 91 aa = md->rmd256.state[0]; in _rmd256_compress() 318 if (md->rmd256.curlen >= sizeof(md->rmd256.buf)) { in rmd256_done() 324 md->rmd256.length += md->rmd256.curlen * 8; in rmd256_done() 327 md->rmd256.buf[md->rmd256.curlen++] = (unsigned char)0x80; in rmd256_done() 335 md->rmd256.buf[md->rmd256.curlen++] = (unsigned char)0; in rmd256_done() 337 rmd256_compress(md, md->rmd256.buf); in rmd256_done() 343 md->rmd256.buf[md->rmd256.curlen++] = (unsigned char)0; in rmd256_done() 347 STORE64L(md->rmd256.length, md->rmd256.buf+56); in rmd256_done() 348 rmd256_compress(md, md->rmd256.buf); in rmd256_done() 413 hash_state md; in rmd256_test() [all …]
|
A D | rmd128.c | 248 md->rmd128.state[1] = md->rmd128.state[2] + dd + aaa; in _rmd128_compress() 249 md->rmd128.state[2] = md->rmd128.state[3] + aa + bbb; in _rmd128_compress() 250 md->rmd128.state[3] = md->rmd128.state[0] + bb + ccc; in _rmd128_compress() 305 if (md->rmd128.curlen >= sizeof(md->rmd128.buf)) { in rmd128_done() 311 md->rmd128.length += md->rmd128.curlen * 8; in rmd128_done() 314 md->rmd128.buf[md->rmd128.curlen++] = (unsigned char)0x80; in rmd128_done() 324 rmd128_compress(md, md->rmd128.buf); in rmd128_done() 330 md->rmd128.buf[md->rmd128.curlen++] = (unsigned char)0; in rmd128_done() 334 STORE64L(md->rmd128.length, md->rmd128.buf+56); in rmd128_done() 335 rmd128_compress(md, md->rmd128.buf); in rmd128_done() [all …]
|
A D | rmd320.c | 112 aa = md->rmd320.state[0]; in _rmd320_compress() 383 if (md->rmd320.curlen >= sizeof(md->rmd320.buf)) { in rmd320_done() 389 md->rmd320.length += md->rmd320.curlen * 8; in rmd320_done() 392 md->rmd320.buf[md->rmd320.curlen++] = (unsigned char)0x80; in rmd320_done() 400 md->rmd320.buf[md->rmd320.curlen++] = (unsigned char)0; in rmd320_done() 402 rmd320_compress(md, md->rmd320.buf); in rmd320_done() 408 md->rmd320.buf[md->rmd320.curlen++] = (unsigned char)0; in rmd320_done() 412 STORE64L(md->rmd320.length, md->rmd320.buf+56); in rmd320_done() 413 rmd320_compress(md, md->rmd320.buf); in rmd320_done() 478 hash_state md; in rmd320_test() [all …]
|
A D | rmd160.c | 305 md->rmd160.state[1] = md->rmd160.state[2] + dd + eee; in _rmd160_compress() 306 md->rmd160.state[2] = md->rmd160.state[3] + ee + aaa; in _rmd160_compress() 307 md->rmd160.state[3] = md->rmd160.state[4] + aa + bbb; in _rmd160_compress() 308 md->rmd160.state[4] = md->rmd160.state[0] + bb + ccc; in _rmd160_compress() 364 if (md->rmd160.curlen >= sizeof(md->rmd160.buf)) { in rmd160_done() 370 md->rmd160.length += md->rmd160.curlen * 8; in rmd160_done() 373 md->rmd160.buf[md->rmd160.curlen++] = (unsigned char)0x80; in rmd160_done() 383 rmd160_compress(md, md->rmd160.buf); in rmd160_done() 389 md->rmd160.buf[md->rmd160.curlen++] = (unsigned char)0; in rmd160_done() 393 STORE64L(md->rmd160.length, md->rmd160.buf+56); in rmd160_done() [all …]
|
A D | tiger.c | 635 md->tiger.state[0] = a ^ md->tiger.state[0]; in _tiger_compress() 636 md->tiger.state[1] = b - md->tiger.state[1]; in _tiger_compress() 637 md->tiger.state[2] = c + md->tiger.state[2]; in _tiger_compress() 688 if (md->tiger.curlen >= sizeof(md->tiger.buf)) { in tiger_done() 693 md->tiger.length += md->tiger.curlen * 8; in tiger_done() 696 md->tiger.buf[md->tiger.curlen++] = (unsigned char)0x01; in tiger_done() 705 tiger_compress(md, md->tiger.buf); in tiger_done() 711 md->tiger.buf[md->tiger.curlen++] = (unsigned char)0; in tiger_done() 715 STORE64L(md->tiger.length, md->tiger.buf+56); in tiger_done() 716 tiger_compress(md, md->tiger.buf); in tiger_done() [all …]
|
/optee_os/core/lib/libtomcrypt/ |
A D | sha256_accel.c | 93 md->sha256.curlen = 0; in sha256_init() 128 if (md->sha256.curlen >= sizeof(md->sha256.buf)) { in sha256_done() 134 md->sha256.length += md->sha256.curlen * 8; in sha256_done() 137 md->sha256.buf[md->sha256.curlen++] = (unsigned char)0x80; in sha256_done() 145 md->sha256.buf[md->sha256.curlen++] = (unsigned char)0; in sha256_done() 147 sha256_compress(md, md->sha256.buf); in sha256_done() 153 md->sha256.buf[md->sha256.curlen++] = (unsigned char)0; in sha256_done() 157 STORE64H(md->sha256.length, md->sha256.buf+56); in sha256_done() 158 sha256_compress(md, md->sha256.buf); in sha256_done() 199 hash_state md; in sha256_test() [all …]
|
A D | sha1_accel.c | 104 md->sha1.curlen = 0; in sha1_init() 122 if (md->sha1.curlen >= sizeof(md->sha1.buf)) { in sha1_done() 127 md->sha1.length += md->sha1.curlen * 8; in sha1_done() 130 md->sha1.buf[md->sha1.curlen++] = (unsigned char)0x80; in sha1_done() 138 md->sha1.buf[md->sha1.curlen++] = (unsigned char)0; in sha1_done() 140 sha1_compress(md, md->sha1.buf); in sha1_done() 146 md->sha1.buf[md->sha1.curlen++] = (unsigned char)0; in sha1_done() 150 STORE64H(md->sha1.length, md->sha1.buf+56); in sha1_done() 151 sha1_compress(md, md->sha1.buf); in sha1_done() 190 hash_state md; in sha1_test() [all …]
|
/optee_os/core/lib/libtomcrypt/src/hashes/whirl/ |
A D | whirl.c | 131 zeromem(&md->whirlpool, sizeof(md->whirlpool)); in whirlpool_init() 157 if (md->whirlpool.curlen >= sizeof(md->whirlpool.buf)) { in whirlpool_done() 162 md->whirlpool.length += md->whirlpool.curlen * 8; in whirlpool_done() 165 md->whirlpool.buf[md->whirlpool.curlen++] = (unsigned char)0x80; in whirlpool_done() 173 md->whirlpool.buf[md->whirlpool.curlen++] = (unsigned char)0; in whirlpool_done() 175 whirlpool_compress(md, md->whirlpool.buf); in whirlpool_done() 181 md->whirlpool.buf[md->whirlpool.curlen++] = (unsigned char)0; in whirlpool_done() 185 STORE64H(md->whirlpool.length, md->whirlpool.buf+56); in whirlpool_done() 186 whirlpool_compress(md, md->whirlpool.buf); in whirlpool_done() 193 zeromem(md, sizeof(*md)); in whirlpool_done() [all …]
|
/optee_os/core/lib/libtomcrypt/src/headers/ |
A D | tomcrypt_hash.h | 252 int chc_init(hash_state * md); 313 int sha512_init(hash_state * md); 324 int sha384_init(hash_state * md); 354 int sha256_init(hash_state * md); 364 int sha224_init(hash_state * md); 373 int sha1_init(hash_state * md); 425 int md5_init(hash_state * md); 433 int md4_init(hash_state * md); 441 int md2_init(hash_state * md); 449 int tiger_init(hash_state * md); [all …]
|
/optee_os/core/lib/libtomcrypt/src/hashes/chc/ |
A D | chc.c | 118 md->chc.length = 0; in chc_init() 120 zeromem(md->chc.buf, sizeof(md->chc.buf)); in chc_init() 213 if (md->chc.curlen >= sizeof(md->chc.buf)) { in chc_done() 218 md->chc.length += md->chc.curlen * 8; in chc_done() 221 md->chc.buf[md->chc.curlen++] = (unsigned char)0x80; in chc_done() 229 md->chc.buf[md->chc.curlen++] = (unsigned char)0; in chc_done() 231 chc_compress(md, md->chc.buf); in chc_done() 237 md->chc.buf[md->chc.curlen++] = (unsigned char)0; in chc_done() 241 STORE64L(md->chc.length, md->chc.buf+(cipher_blocksize-8)); in chc_done() 242 chc_compress(md, md->chc.buf); in chc_done() [all …]
|
/optee_os/core/lib/libtomcrypt/src/hashes/sha2/ |
A D | sha384.c | 42 int sha384_init(hash_state * md) in sha384_init() argument 44 LTC_ARGCHK(md != NULL); in sha384_init() 46 md->sha512.curlen = 0; in sha384_init() 47 md->sha512.length = 0; in sha384_init() 65 int sha384_done(hash_state * md, unsigned char *out) in sha384_done() argument 69 LTC_ARGCHK(md != NULL); in sha384_done() 72 if (md->sha512.curlen >= sizeof(md->sha512.buf)) { in sha384_done() 76 sha512_done(md, buf); in sha384_done() 117 hash_state md; in sha384_test() 120 sha384_init(&md); in sha384_test() [all …]
|
A D | sha512_224.c | 42 int sha512_224_init(hash_state * md) in sha512_224_init() argument 44 LTC_ARGCHK(md != NULL); in sha512_224_init() 46 md->sha512.curlen = 0; in sha512_224_init() 47 md->sha512.length = 0; in sha512_224_init() 48 md->sha512.state[0] = CONST64(0x8C3D37C819544DA2); in sha512_224_init() 69 LTC_ARGCHK(md != NULL); in sha512_224_done() 72 if (md->sha512.curlen >= sizeof(md->sha512.buf)) { in sha512_224_done() 76 sha512_done(md, buf); in sha512_224_done() 113 hash_state md; in sha512_224_test() 116 sha512_224_init(&md); in sha512_224_test() [all …]
|
A D | sha512_256.c | 42 int sha512_256_init(hash_state * md) in sha512_256_init() argument 44 LTC_ARGCHK(md != NULL); in sha512_256_init() 46 md->sha512.curlen = 0; in sha512_256_init() 47 md->sha512.length = 0; in sha512_256_init() 48 md->sha512.state[0] = CONST64(0x22312194FC2BF72C); in sha512_256_init() 69 LTC_ARGCHK(md != NULL); in sha512_256_done() 72 if (md->sha512.curlen >= sizeof(md->sha512.buf)) { in sha512_256_done() 76 sha512_done(md, buf); in sha512_256_done() 113 hash_state md; in sha512_256_test() 116 sha512_256_init(&md); in sha512_256_test() [all …]
|
A D | sha512.c | 152 md->sha512.state[i] = md->sha512.state[i] + S[i]; in _sha512_compress() 212 if (md->sha512.curlen >= sizeof(md->sha512.buf)) { in sha512_done() 217 md->sha512.length += md->sha512.curlen * CONST64(8); in sha512_done() 220 md->sha512.buf[md->sha512.curlen++] = (unsigned char)0x80; in sha512_done() 228 md->sha512.buf[md->sha512.curlen++] = (unsigned char)0; in sha512_done() 230 sha512_compress(md, md->sha512.buf); in sha512_done() 239 md->sha512.buf[md->sha512.curlen++] = (unsigned char)0; in sha512_done() 243 STORE64H(md->sha512.length, md->sha512.buf+120); in sha512_done() 244 sha512_compress(md, md->sha512.buf); in sha512_done() 293 hash_state md; in sha512_test() [all …]
|
A D | sha224.c | 43 int sha224_init(hash_state * md) in sha224_init() argument 45 LTC_ARGCHK(md != NULL); in sha224_init() 47 md->sha256.curlen = 0; in sha224_init() 48 md->sha256.length = 0; in sha224_init() 49 md->sha256.state[0] = 0xc1059ed8UL; in sha224_init() 50 md->sha256.state[1] = 0x367cd507UL; in sha224_init() 71 LTC_ARGCHK(md != NULL); in sha224_done() 74 err = sha256_done(md, buf); in sha224_done() 111 hash_state md; in sha224_test() 114 sha224_init(&md); in sha224_test() [all …]
|
A D | sha256.c | 185 md->sha256.state[i] = md->sha256.state[i] + S[i]; in _sha256_compress() 244 if (md->sha256.curlen >= sizeof(md->sha256.buf)) { in sha256_done() 250 md->sha256.length += md->sha256.curlen * 8; in sha256_done() 253 md->sha256.buf[md->sha256.curlen++] = (unsigned char)0x80; in sha256_done() 261 md->sha256.buf[md->sha256.curlen++] = (unsigned char)0; in sha256_done() 263 sha256_compress(md, md->sha256.buf); in sha256_done() 269 md->sha256.buf[md->sha256.curlen++] = (unsigned char)0; in sha256_done() 273 STORE64H(md->sha256.length, md->sha256.buf+56); in sha256_done() 274 sha256_compress(md, md->sha256.buf); in sha256_done() 315 hash_state md; in sha256_test() [all …]
|
/optee_os/core/lib/libtomcrypt/src/pk/pkcs1/ |
A D | pkcs_1_mgf1.c | 35 hash_state *md; in pkcs_1_mgf1() local 50 md = XMALLOC(sizeof(hash_state)); in pkcs_1_mgf1() 52 if (md == NULL || buf == NULL) { in pkcs_1_mgf1() 53 if (md != NULL) { in pkcs_1_mgf1() 54 XFREE(md); in pkcs_1_mgf1() 71 if ((err = hash_descriptor[hash_idx]->init(md)) != CRYPT_OK) { in pkcs_1_mgf1() 74 if ((err = hash_descriptor[hash_idx]->process(md, seed, seedlen)) != CRYPT_OK) { in pkcs_1_mgf1() 77 if ((err = hash_descriptor[hash_idx]->process(md, buf, 4)) != CRYPT_OK) { in pkcs_1_mgf1() 80 if ((err = hash_descriptor[hash_idx]->done(md, buf)) != CRYPT_OK) { in pkcs_1_mgf1() 94 zeromem(md, sizeof(hash_state)); in pkcs_1_mgf1() [all …]
|
/optee_os/core/lib/libtomcrypt/src/misc/pkcs5/ |
A D | pkcs_5_1.c | 48 hash_state *md; in _pkcs_5_alg1_common() local 66 md = XMALLOC(sizeof(hash_state)); in _pkcs_5_alg1_common() 68 if (md == NULL || buf == NULL) { in _pkcs_5_alg1_common() 69 if (md != NULL) { in _pkcs_5_alg1_common() 70 XFREE(md); in _pkcs_5_alg1_common() 81 if ((err = hash_descriptor[hash_idx]->init(md)) != CRYPT_OK) { in _pkcs_5_alg1_common() 90 if ((err = hash_descriptor[hash_idx]->process(md, password, password_len)) != CRYPT_OK) { in _pkcs_5_alg1_common() 93 if ((err = hash_descriptor[hash_idx]->process(md, salt, 8)) != CRYPT_OK) { in _pkcs_5_alg1_common() 96 if ((err = hash_descriptor[hash_idx]->done(md, buf)) != CRYPT_OK) { in _pkcs_5_alg1_common() 135 zeromem(md, sizeof(hash_state)); in _pkcs_5_alg1_common() [all …]
|