Home
last modified time | relevance | path

Searched refs:hash (Results 1 – 25 of 147) sorted by relevance

123456

/optee_os/core/lib/libtomcrypt/src/hashes/
H A Dsha3_test.c15 unsigned char buf[200], hash[224 / 8]; in sha3_224_test()
38 sha3_done(&c, hash); in sha3_224_test()
39 …if (compare_testvector(hash, sizeof(hash), sha3_224_empty, sizeof(sha3_224_empty), "SHA3-224", 0))… in sha3_224_test()
47 sha3_done(&c, hash); in sha3_224_test()
48 …if (compare_testvector(hash, sizeof(hash), sha3_224_0xa3_200_times, sizeof(sha3_224_0xa3_200_times… in sha3_224_test()
58 sha3_done(&c, hash); in sha3_224_test()
59 …if (compare_testvector(hash, sizeof(hash), sha3_224_0xa3_200_times, sizeof(sha3_224_0xa3_200_times… in sha3_224_test()
72 unsigned char buf[200], hash[256 / 8]; in sha3_256_test()
94 sha3_done(&c, hash); in sha3_256_test()
95 …if (compare_testvector(hash, sizeof(hash), sha3_256_empty, sizeof(sha3_256_empty), "SHA3-256", 0))… in sha3_256_test()
[all …]
/optee_os/core/drivers/crypto/hisilicon/
H A Dsec_hmac.c21 struct crypto_hmac *hash = NULL; in sec_hmac_initialize() local
29 hash = to_hmac_ctx(ctx); in sec_hmac_initialize()
30 hash_ctx = hash->ctx; in sec_hmac_initialize()
38 struct crypto_hmac *hash = NULL; in sec_hmac_do_update() local
51 hash = to_hmac_ctx(ctx); in sec_hmac_do_update()
52 hashctx = hash->ctx; in sec_hmac_do_update()
60 struct crypto_hmac *hash = to_hmac_ctx(ctx); in sec_hmac_do_final() local
61 struct hashctx *hash_ctx = hash->ctx; in sec_hmac_do_final()
68 struct crypto_hmac *hash = NULL; in sec_hmac_ctx_free() local
74 hash = to_hmac_ctx(ctx); in sec_hmac_ctx_free()
[all …]
/optee_os/core/lib/libtomcrypt/src/mac/hmac/
H A Dhmac_done.c12 #define LTC_HMAC_BLOCKSIZE hash_descriptor[hash]->blocksize
25 int hash, err; in hmac_done() local
31 hash = hmac->hash; in hmac_done()
32 if((err = hash_is_valid(hash)) != CRYPT_OK) { in hmac_done()
37 hashsize = hash_descriptor[hash]->hashsize; in hmac_done()
53 if ((err = hash_descriptor[hash]->done(&hmac->md, isha)) != CRYPT_OK) { in hmac_done()
63 if ((err = hash_descriptor[hash]->init(&hmac->md)) != CRYPT_OK) { in hmac_done()
66 if ((err = hash_descriptor[hash]->process(&hmac->md, buf, LTC_HMAC_BLOCKSIZE)) != CRYPT_OK) { in hmac_done()
69 if ((err = hash_descriptor[hash]->process(&hmac->md, isha, hashsize)) != CRYPT_OK) { in hmac_done()
72 if ((err = hash_descriptor[hash]->done(&hmac->md, buf)) != CRYPT_OK) { in hmac_done()
H A Dhmac_init.c12 #define LTC_HMAC_BLOCKSIZE hash_descriptor[hash]->blocksize
22 int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned long keylen) in hmac_init() argument
33 if ((err = hash_is_valid(hash)) != CRYPT_OK) { in hmac_init()
36 hmac->hash = hash; in hmac_init()
37 hashsize = hash_descriptor[hash]->hashsize; in hmac_init()
59 if ((err = hash_memory(hash, key, keylen, hmac->key, &z)) != CRYPT_OK) { in hmac_init()
77 if ((err = hash_descriptor[hash]->init(&hmac->md)) != CRYPT_OK) { in hmac_init()
81 if ((err = hash_descriptor[hash]->process(&hmac->md, buf, LTC_HMAC_BLOCKSIZE)) != CRYPT_OK) { in hmac_init()
H A Dhmac_memory.c23 int hmac_memory(int hash, in hmac_memory() argument
37 if ((err = hash_is_valid(hash)) != CRYPT_OK) { in hmac_memory()
42 if (hash_descriptor[hash]->hmac_block != NULL) { in hmac_memory()
43 return hash_descriptor[hash]->hmac_block(key, keylen, in, inlen, out, outlen); in hmac_memory()
53 if ((err = hmac_init(hmac, hash, key, keylen)) != CRYPT_OK) { in hmac_memory()
/optee_os/core/lib/libtomcrypt/src/hashes/helper/
H A Dhash_memory.c20 int hash_memory(int hash, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigne… in hash_memory() argument
29 if ((err = hash_is_valid(hash)) != CRYPT_OK) { in hash_memory()
33 if (*outlen < hash_descriptor[hash]->hashsize) { in hash_memory()
34 *outlen = hash_descriptor[hash]->hashsize; in hash_memory()
43 if ((err = hash_descriptor[hash]->init(md)) != CRYPT_OK) { in hash_memory()
46 if ((err = hash_descriptor[hash]->process(md, in, inlen)) != CRYPT_OK) { in hash_memory()
49 err = hash_descriptor[hash]->done(md, out); in hash_memory()
50 *outlen = hash_descriptor[hash]->hashsize; in hash_memory()
H A Dhash_filehandle.c19 int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outlen) in hash_filehandle() argument
34 if ((err = hash_is_valid(hash)) != CRYPT_OK) { in hash_filehandle()
38 if (*outlen < hash_descriptor[hash]->hashsize) { in hash_filehandle()
39 *outlen = hash_descriptor[hash]->hashsize; in hash_filehandle()
43 if ((err = hash_descriptor[hash]->init(&md)) != CRYPT_OK) { in hash_filehandle()
49 if ((err = hash_descriptor[hash]->process(&md, buf, (unsigned long)x)) != CRYPT_OK) { in hash_filehandle()
53 if ((err = hash_descriptor[hash]->done(&md, out)) == CRYPT_OK) { in hash_filehandle()
54 *outlen = hash_descriptor[hash]->hashsize; in hash_filehandle()
H A Dhash_memory_multi.c22 int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen, in hash_memory_multi() argument
35 if ((err = hash_is_valid(hash)) != CRYPT_OK) { in hash_memory_multi()
39 if (*outlen < hash_descriptor[hash]->hashsize) { in hash_memory_multi()
40 *outlen = hash_descriptor[hash]->hashsize; in hash_memory_multi()
49 if ((err = hash_descriptor[hash]->init(md)) != CRYPT_OK) { in hash_memory_multi()
58 if ((err = hash_descriptor[hash]->process(md, curptr, curlen)) != CRYPT_OK) { in hash_memory_multi()
68 err = hash_descriptor[hash]->done(md, out); in hash_memory_multi()
69 *outlen = hash_descriptor[hash]->hashsize; in hash_memory_multi()
H A Dhash_file.c18 int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *outlen) in hash_file() argument
26 if ((err = hash_is_valid(hash)) != CRYPT_OK) { in hash_file()
35 err = hash_filehandle(hash, in, out, outlen); in hash_file()
/optee_os/core/lib/libtomcrypt/src/prngs/
H A Dyarrow.c84 prng->u.yarrow.hash = register_hash(&sha256_desc); in yarrow_start()
86 prng->u.yarrow.hash = register_hash(&sha512_desc); in yarrow_start()
88 prng->u.yarrow.hash = register_hash(&tiger_desc); in yarrow_start()
90 prng->u.yarrow.hash = register_hash(&sha1_desc); in yarrow_start()
92 prng->u.yarrow.hash = register_hash(&rmd320_desc); in yarrow_start()
94 prng->u.yarrow.hash = register_hash(&rmd256_desc); in yarrow_start()
96 prng->u.yarrow.hash = register_hash(&rmd160_desc); in yarrow_start()
98 prng->u.yarrow.hash = register_hash(&rmd128_desc); in yarrow_start()
100 prng->u.yarrow.hash = register_hash(&md5_desc); in yarrow_start()
102 prng->u.yarrow.hash = register_hash(&md4_desc); in yarrow_start()
[all …]
/optee_os/core/drivers/crypto/stm32/
H A Dhash.c21 struct stm32_hash_context hash; member
40 return stm32_hash_init(&c->hash, NULL, 0); in do_hash_init()
55 return stm32_hash_update(&c->hash, data, len); in do_hash_update()
73 if (len < stm32_hash_digest_size(&c->hash)) in do_hash_final()
76 res = stm32_hash_final(&c->hash, tmp_digest, NULL, 0); in do_hash_final()
78 if (res == TEE_SUCCESS && len < stm32_hash_digest_size(&c->hash)) in do_hash_final()
93 stm32_hash_free(&c->hash); in do_hash_free()
110 stm32_hash_deep_copy(&dst->hash, &src->hash); in do_hash_copy_state()
165 res = stm32_hash_alloc(&c->hash, STM32_HASH_MODE, stm32_algo); in stm32_hash_allocate()
H A Dhmac.c21 struct stm32_hash_context hash; member
60 return stm32_hash_init(&c->hash, c->key, c->key_len); in do_hmac_init()
80 return stm32_hash_update(&c->hash, data, len); in do_hmac_update()
103 if (len < stm32_hash_digest_size(&c->hash)) in do_hmac_final()
106 res = stm32_hash_final(&c->hash, tmp_digest, c->key, c->key_len); in do_hmac_final()
108 if (res == TEE_SUCCESS && len < stm32_hash_digest_size(&c->hash)) in do_hmac_final()
124 stm32_hash_free(&c->hash); in do_hmac_free()
141 stm32_hash_deep_copy(&dst->hash, &src->hash); in do_hmac_copy_state()
205 res = stm32_hash_alloc(&c->hash, STM32_HMAC_MODE, stm32_algo); in stm32_hmac_allocate()
/optee_os/core/lib/libtomcrypt/src/pk/pkcs1/
H A Dpkcs_1_pss_decode.c30 unsigned char *DB, *mask, *salt, *hash; in pkcs_1_pss_decode() local
60 hash = XMALLOC(modulus_len); in pkcs_1_pss_decode()
61 if (DB == NULL || mask == NULL || salt == NULL || hash == NULL) { in pkcs_1_pss_decode()
71 if (hash != NULL) { in pkcs_1_pss_decode()
72 XFREE(hash); in pkcs_1_pss_decode()
89 XMEMCPY(hash, sig + x, hLen); in pkcs_1_pss_decode()
99 if ((err = pkcs_1_mgf1(hash_idx, hash, hLen, mask, modulus_len - hLen - 1)) != CRYPT_OK) { in pkcs_1_pss_decode()
146 if (FTMN_CALLEE_DONE_MEMCMP(XMEM_NEQ, mask, hash, hLen) == 0) { in pkcs_1_pss_decode()
156 zeromem(hash, modulus_len); in pkcs_1_pss_decode()
159 XFREE(hash); in pkcs_1_pss_decode()
H A Dpkcs_1_pss_encode.c31 unsigned char *DB, *mask, *salt, *hash; in pkcs_1_pss_encode() local
61 hash = XMALLOC(modulus_len); in pkcs_1_pss_encode()
62 if (DB == NULL || mask == NULL || salt == NULL || hash == NULL) { in pkcs_1_pss_encode()
72 if (hash != NULL) { in pkcs_1_pss_encode()
73 XFREE(hash); in pkcs_1_pss_encode()
101 if ((err = hash_descriptor[hash_idx]->done(&md, hash)) != CRYPT_OK) { in pkcs_1_pss_encode()
114 if ((err = pkcs_1_mgf1(hash_idx, hash, hLen, mask, modulus_len - hLen - 1)) != CRYPT_OK) { in pkcs_1_pss_encode()
136 XMEMCPY(out + y, hash, hLen); in pkcs_1_pss_encode()
153 zeromem(hash, modulus_len); in pkcs_1_pss_encode()
156 XFREE(hash); in pkcs_1_pss_encode()
/optee_os/lib/libutils/ext/
H A Dfault_mitigation.c47 arg->hash ^= my_hash; in ___ftmn_callee_done()
48 arg->res = arg->hash ^ res; in ___ftmn_callee_done()
57 arg->hash ^= my_hash; in ___ftmn_callee_done_not_zero()
58 arg->res = arg->hash ^ res; in ___ftmn_callee_done_not_zero()
76 arg->hash ^= my_hash; in ___ftmn_callee_done_memcmp()
77 arg->res = arg->hash ^ res; in ___ftmn_callee_done_memcmp()
93 arg->hash ^= my_hash; in ___ftmn_callee_done_check()
94 arg->res = check->res ^ FTMN_DEFAULT_HASH ^ arg->hash; in ___ftmn_callee_done_check()
104 arg->res = arg->hash ^ res; in ___ftmn_callee_update_not_zero()
113 if ((arg->res ^ arg->hash) != res) in ___ftmn_copy_linked_call_res()
/optee_os/ta/pkcs11/src/
H A Dprocessing_rsa.c24 uint32_t hash = 0; in pkcs2tee_proc_params_rsa_pss() local
30 rc = serialargs_get_u32(&args, &hash); in pkcs2tee_proc_params_rsa_pss()
52 ctx->hash_alg = hash; in pkcs2tee_proc_params_rsa_pss()
122 uint32_t hash = 0; in pkcs2tee_algo_rsa_pss() local
128 rc = serialargs_get_u32(&args, &hash); in pkcs2tee_algo_rsa_pss()
144 if (hash == PKCS11_CKM_SHA_1 && mgf == PKCS11_CKG_MGF1_SHA1) { in pkcs2tee_algo_rsa_pss()
148 if (hash == PKCS11_CKM_SHA224 && in pkcs2tee_algo_rsa_pss()
153 if (hash == PKCS11_CKM_SHA256 && in pkcs2tee_algo_rsa_pss()
158 if (hash == PKCS11_CKM_SHA384 && in pkcs2tee_algo_rsa_pss()
163 if (hash == PKCS11_CKM_SHA512 && in pkcs2tee_algo_rsa_pss()
[all …]
/optee_os/core/lib/libtomcrypt/src/misc/crypt/
H A Dcrypt_register_hash.c15 int register_hash(const struct ltc_hash_descriptor *hash) in register_hash() argument
19 LTC_ARGCHK(hash != NULL); in register_hash()
24 if (hash_descriptor[x] == hash) { in register_hash()
33 hash_descriptor[x] = hash; in register_hash()
H A Dcrypt_unregister_hash.c15 int unregister_hash(const struct ltc_hash_descriptor *hash) in unregister_hash() argument
19 LTC_ARGCHK(hash != NULL); in unregister_hash()
24 if (hash_descriptor[x] == hash) { in unregister_hash()
/optee_os/core/lib/libtomcrypt/src/stream/salsa20/
H A Dxsalsa20_test.c16 static int s_sha256(unsigned char *hash, const unsigned char *data, const int datalen) { in s_sha256() argument
20 sha256_done(&md, hash); in s_sha256()
73 unsigned char hash[32]; in xsalsa20_test()
80 if ((err = s_sha256(hash, keystream, keystreamlen)) != CRYPT_OK) return err; in xsalsa20_test()
81 …if (compare_testvector(hash, sizeof(hash), expecthash, sizeof(expecthash), "XSALSA20-TV3", 1)) … in xsalsa20_test()
/optee_os/lib/libmbedtls/mbedtls/library/
H A Dpk_wrap.c66 const unsigned char *hash, size_t hash_len, in rsa_verify_wrap() argument
113 status = psa_verify_hash(key_id, psa_alg_md, hash, hash_len, in rsa_verify_wrap()
131 const unsigned char *hash, size_t hash_len, in rsa_verify_wrap() argument
150 hash, sig)) != 0) { in rsa_verify_wrap()
170 const unsigned char *hash, size_t hash_len, in mbedtls_pk_psa_rsa_sign_ext() argument
210 status = psa_sign_hash(key_id, alg, hash, hash_len, in mbedtls_pk_psa_rsa_sign_ext()
231 const unsigned char *hash, size_t hash_len, in rsa_sign_wrap() argument
250 return mbedtls_pk_psa_rsa_sign_ext(psa_alg, pk->pk_ctx, hash, hash_len, in rsa_sign_wrap()
255 const unsigned char *hash, size_t hash_len, in rsa_sign_wrap() argument
274 hash, sig); in rsa_sign_wrap()
[all …]
H A Dpsa_crypto_hash.c342 uint8_t *hash, in mbedtls_psa_hash_finish() argument
357 memset(hash, '!', hash_size); in mbedtls_psa_hash_finish()
368 ret = mbedtls_md5_finish(&operation->ctx.md5, hash); in mbedtls_psa_hash_finish()
373 ret = mbedtls_ripemd160_finish(&operation->ctx.ripemd160, hash); in mbedtls_psa_hash_finish()
378 ret = mbedtls_sha1_finish(&operation->ctx.sha1, hash); in mbedtls_psa_hash_finish()
383 ret = mbedtls_sha256_finish(&operation->ctx.sha256, hash); in mbedtls_psa_hash_finish()
388 ret = mbedtls_sha256_finish(&operation->ctx.sha256, hash); in mbedtls_psa_hash_finish()
393 ret = mbedtls_sha512_finish(&operation->ctx.sha512, hash); in mbedtls_psa_hash_finish()
398 ret = mbedtls_sha512_finish(&operation->ctx.sha512, hash); in mbedtls_psa_hash_finish()
417 ret = mbedtls_sha3_finish(&operation->ctx.sha3, hash, hash_size); in mbedtls_psa_hash_finish()
[all …]
/optee_os/core/lib/libtomcrypt/src/pk/ecc/
H A Decc_encrypt_key.c27 prng_state *prng, int wprng, int hash, in ecc_encrypt_key() argument
40 if ((err = hash_is_valid(hash)) != CRYPT_OK) { in ecc_encrypt_key()
44 if (inlen > hash_descriptor[hash]->hashsize) { in ecc_encrypt_key()
90 if ((err = hash_memory(hash, ecc_shared, x, skey, &y)) != CRYPT_OK) { in ecc_encrypt_key()
100 … LTC_ASN1_OBJECT_IDENTIFIER, hash_descriptor[hash]->OIDlen, hash_descriptor[hash]->OID, in ecc_encrypt_key()
/optee_os/core/lib/libtomcrypt/src/pk/dsa/
H A Ddsa_encrypt_key.c26 prng_state *prng, int wprng, int hash, in dsa_encrypt_key() argument
44 if ((err = hash_is_valid(hash)) != CRYPT_OK) { in dsa_encrypt_key()
48 if (inlen > hash_descriptor[hash]->hashsize) { in dsa_encrypt_key()
89 if ((err = hash_memory(hash, expt, x, skey, &y)) != CRYPT_OK) { in dsa_encrypt_key()
99 … LTC_ASN1_OBJECT_IDENTIFIER, hash_descriptor[hash]->OIDlen, hash_descriptor[hash]->OID, in dsa_encrypt_key()
/optee_os/core/include/tee/
H A Dfs_dirfile.h22 uint8_t hash[TEE_FS_HTREE_HASH_SIZE]; member
37 TEE_Result (*open)(bool create, uint8_t *hash, uint32_t min_counter,
46 TEE_Result (*commit_writes)(struct tee_file_handle *fh, uint8_t *hash,
59 TEE_Result tee_fs_dirfile_open(bool create, uint8_t *hash, uint32_t min_counter,
78 uint8_t *hash, uint32_t *counter);
/optee_os/core/tee/
H A Dfs_dirfile.c26 uint8_t hash[TEE_FS_HTREE_HASH_SIZE]; member
124 TEE_Result tee_fs_dirfile_open(bool create, uint8_t *hash, uint32_t min_counter, in tee_fs_dirfile_open() argument
136 res = fops->open(create, hash, min_counter, NULL, NULL, &dirh->fh); in tee_fs_dirfile_open()
187 uint8_t *hash, uint32_t *counter) in tee_fs_dirfile_commit_writes() argument
189 return dirh->fops->commit_writes(dirh->fh, hash, counter); in tee_fs_dirfile_commit_writes()
239 memcpy(dfh->hash, dent.hash, sizeof(dent.hash)); in tee_fs_dirfile_find()
304 memcpy(dent.hash, dfh->hash, sizeof(dent.hash)); in tee_fs_dirfile_rename()
361 memcpy(&dent.hash, dfh->hash, sizeof(dent.hash)); in tee_fs_dirfile_update_hash()

123456