Home
last modified time | relevance | path

Searched refs:key (Results 1 – 25 of 413) sorted by relevance

12345678910>>...17

/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/ecc/
A Decc_set_curve_internal.c20 key->dp.oidlen = 0; in s_ecc_oid_lookup()
35 pk_oid_str_to_num(curve->OID, key->dp.oid, &key->dp.oidlen); in s_ecc_oid_lookup()
47 if ((err = mp_init_multi(&key->dp.prime, &key->dp.order, &key->dp.A, &key->dp.B, in ecc_copy_curve()
48 &key->dp.base.x, &key->dp.base.y, &key->dp.base.z, in ecc_copy_curve()
49 &key->pubkey.x, &key->pubkey.y, &key->pubkey.z, &key->k, in ecc_copy_curve()
66 for (i = 0; i < key->dp.oidlen; i++) key->dp.oid[i] = srckey->dp.oid[i]; in ecc_copy_curve()
75 ecc_free(key); in ecc_copy_curve()
91 if ((err = mp_init_multi(&key->dp.prime, &key->dp.order, &key->dp.A, &key->dp.B, in ecc_set_curve_from_mpis()
92 &key->dp.base.x, &key->dp.base.y, &key->dp.base.z, in ecc_set_curve_from_mpis()
93 &key->pubkey.x, &key->pubkey.y, &key->pubkey.z, &key->k, in ecc_set_curve_from_mpis()
[all …]
A Decc_set_curve.c8 int ecc_set_curve(const ltc_ecc_curve *cu, ecc_key *key) in ecc_set_curve() argument
12 LTC_ARGCHK(key != NULL); in ecc_set_curve()
15 if ((err = mp_init_multi(&key->dp.prime, &key->dp.order, &key->dp.A, &key->dp.B, in ecc_set_curve()
16 &key->dp.base.x, &key->dp.base.y, &key->dp.base.z, in ecc_set_curve()
17 &key->pubkey.x, &key->pubkey.y, &key->pubkey.z, &key->k, in ecc_set_curve()
31 key->dp.cofactor = cu->cofactor; in ecc_set_curve()
32 key->dp.size = mp_unsigned_bin_size(key->dp.prime); in ecc_set_curve()
34 key->dp.oidlen = 16; in ecc_set_curve()
35 if ((err = pk_oid_str_to_num(cu->OID, key->dp.oid, &key->dp.oidlen)) != CRYPT_OK) { goto error; } in ecc_set_curve()
40 ecc_free(key); in ecc_set_curve()
[all …]
A Decc_free.c17 void ecc_free(ecc_key *key) in ecc_free() argument
19 LTC_ARGCHKVD(key != NULL); in ecc_free()
21 mp_cleanup_multi(&key->dp.prime, &key->dp.order, in ecc_free()
22 &key->dp.A, &key->dp.B, in ecc_free()
23 &key->dp.base.x, &key->dp.base.y, &key->dp.base.z, in ecc_free()
24 &key->pubkey.x, &key->pubkey.y, &key->pubkey.z, in ecc_free()
25 &key->k, NULL); in ecc_free()
A Decc_make_key.c21 int ecc_make_key(prng_state *prng, int wprng, int keysize, ecc_key *key) in ecc_make_key() argument
25 if ((err = ecc_set_curve_by_size(keysize, key)) != CRYPT_OK) { return err; } in ecc_make_key()
26 if ((err = ecc_generate_key(prng, wprng, key)) != CRYPT_OK) { return err; } in ecc_make_key()
33 if ((err = ecc_set_curve(cu, key)) != CRYPT_OK) { return err; } in ecc_make_key_ex()
38 int ecc_generate_key(prng_state *prng, int wprng, ecc_key *key) in ecc_generate_key() argument
43 LTC_ARGCHK(key != NULL); in ecc_generate_key()
44 LTC_ARGCHK(key->dp.size > 0); in ecc_generate_key()
53 if ((err = rand_bn_upto(key->k, key->dp.order, prng, wprng)) != CRYPT_OK) { in ecc_generate_key()
58 …if ((err = ltc_mp.ecc_ptmul(key->k, &key->dp.base, &key->pubkey, key->dp.A, key->dp.prime, 1)) != … in ecc_generate_key()
61 key->type = PK_PRIVATE; in ecc_generate_key()
[all …]
A Decc_set_key.c8 int ecc_set_key(const unsigned char *in, unsigned long inlen, int type, ecc_key *key) in ecc_set_key() argument
13 LTC_ARGCHK(key != NULL); in ecc_set_key()
17 prime = key->dp.prime; in ecc_set_key()
18 a = key->dp.A; in ecc_set_key()
19 b = key->dp.B; in ecc_set_key()
26 if (mp_iszero(key->k) || (mp_cmp(key->k, key->dp.order) != LTC_MP_LT)) { in ecc_set_key()
31 …if ((err = ltc_mp.ecc_ptmul(key->k, &key->dp.base, &key->pubkey, a, prime, 1)) != CRYPT_OK) … in ecc_set_key()
35 …if ((err = ltc_ecc_import_point(in, inlen, prime, a, b, key->pubkey.x, key->pubkey.y)) != CRYPT_OK… in ecc_set_key()
44 if ((err = ltc_ecc_verify_key(key)) != CRYPT_OK) { in ecc_set_key()
48 key->type = type; in ecc_set_key()
[all …]
A Dltc_ecc_verify_key.c16 int ltc_ecc_verify_key(const ecc_key *key) in ltc_ecc_verify_key() argument
20 void *prime = key->dp.prime; in ltc_ecc_verify_key()
21 void *order = key->dp.order; in ltc_ecc_verify_key()
22 void *a = key->dp.A; in ltc_ecc_verify_key()
25 if (ltc_mp.compare_d(key->pubkey.z, 1) == LTC_MP_EQ) { in ltc_ecc_verify_key()
26 if ((ltc_mp.compare(key->pubkey.x, prime) != LTC_MP_LT) || in ltc_ecc_verify_key()
27 (ltc_mp.compare(key->pubkey.y, prime) != LTC_MP_LT) || in ltc_ecc_verify_key()
28 (ltc_mp.compare_d(key->pubkey.x, 0) == LTC_MP_LT) || in ltc_ecc_verify_key()
29 (ltc_mp.compare_d(key->pubkey.y, 0) == LTC_MP_LT) || in ltc_ecc_verify_key()
30 (mp_iszero(key->pubkey.x) && mp_iszero(key->pubkey.y)) in ltc_ecc_verify_key()
[all …]
A Decc_import.c20 int ecc_import(const unsigned char *in, unsigned long inlen, ecc_key *key) in ecc_import() argument
22 return ecc_import_ex(in, inlen, key, NULL); in ecc_import()
40 LTC_ARGCHK(key != NULL); in ecc_import_ex()
53 if ((err = ecc_set_curve_by_size(key_size, key)) != CRYPT_OK) { goto done; } in ecc_import_ex()
55 if ((err = ecc_set_curve(cu, key)) != CRYPT_OK) { goto done; } in ecc_import_ex()
60 key->type = PK_PRIVATE; in ecc_import_ex()
66 LTC_ASN1_INTEGER, 1UL, key->k, in ecc_import_ex()
72 key->type = PK_PUBLIC; in ecc_import_ex()
88 if ((err = mp_set(key->pubkey.z, 1)) != CRYPT_OK) { goto done; } in ecc_import_ex()
91 if ((err = ltc_ecc_verify_key(key)) != CRYPT_OK) { goto done; } in ecc_import_ex()
[all …]
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/rsa/
A Drsa_key.c76 void rsa_shrink_key(rsa_key *key) in rsa_shrink_key() argument
78 LTC_ARGCHKVD(key != NULL); in rsa_shrink_key()
79 …s_mpi_shrink_multi(&key->e, &key->d, &key->N, &key->dQ, &key->dP, &key->qP, &key->p, &key->q, NULL… in rsa_shrink_key()
87 int rsa_init(rsa_key *key) in rsa_init() argument
89 LTC_ARGCHK(key != NULL); in rsa_init()
90 …return mp_init_multi(&key->e, &key->d, &key->N, &key->dQ, &key->dP, &key->qP, &key->p, &key->q, LT… in rsa_init()
97 void rsa_free(rsa_key *key) in rsa_free() argument
99 LTC_ARGCHKVD(key != NULL); in rsa_free()
100 …mp_cleanup_multi(&key->q, &key->p, &key->qP, &key->dP, &key->dQ, &key->N, &key->d, &key->e, LTC_NU… in rsa_free()
A Drsa_exptmod.c25 const rsa_key *key) in rsa_exptmod() argument
37 LTC_ARGCHK(key != NULL); in rsa_exptmod()
61 if (mp_cmp(key->N, tmp) == LTC_MP_LT) { in rsa_exptmod()
76 err = mp_invmod(rnd, key->N, rndi); in rsa_exptmod()
82 err = mp_exptmod( rnd, key->e, key->N, rnd); in rsa_exptmod()
94 has_crt_parameters = (key->p != NULL) && (mp_get_digit_count(key->p) != 0) && in rsa_exptmod()
95 (key->q != NULL) && (mp_get_digit_count(key->q) != 0) && in rsa_exptmod()
96 (key->dP != NULL) && (mp_get_digit_count(key->dP) != 0) && in rsa_exptmod()
97 (key->dQ != NULL) && (mp_get_digit_count(key->dQ) != 0) && in rsa_exptmod()
98 (key->qP != NULL) && (mp_get_digit_count(key->qP) != 0); in rsa_exptmod()
[all …]
A Drsa_set.c23 rsa_key *key) in rsa_set_key() argument
27 LTC_ARGCHK(key != NULL); in rsa_set_key()
38 key->type = PK_PRIVATE; in rsa_set_key()
41 key->type = PK_PUBLIC; in rsa_set_key()
46 rsa_free(key); in rsa_set_key()
64 rsa_key *key) in rsa_set_factors() argument
68 LTC_ARGCHK(key != NULL); in rsa_set_factors()
80 rsa_free(key); in rsa_set_factors()
101 rsa_key *key) in rsa_set_crt_params() argument
105 LTC_ARGCHK(key != NULL); in rsa_set_crt_params()
[all …]
A Drsa_import.c40 key->type = PK_PUBLIC; in rsa_import_pkcs1()
52 LTC_ASN1_INTEGER, 1UL, key->N, in rsa_import_pkcs1()
53 LTC_ASN1_INTEGER, 1UL, key->e, in rsa_import_pkcs1()
54 LTC_ASN1_INTEGER, 1UL, key->d, in rsa_import_pkcs1()
55 LTC_ASN1_INTEGER, 1UL, key->p, in rsa_import_pkcs1()
56 LTC_ASN1_INTEGER, 1UL, key->q, in rsa_import_pkcs1()
63 key->type = PK_PRIVATE; in rsa_import_pkcs1()
92 LTC_ARGCHK(key != NULL); in rsa_import()
96 if ((err = rsa_init(key)) != CRYPT_OK) { in rsa_import()
122 key->type = PK_PUBLIC; in rsa_import()
[all …]
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/dsa/
A Ddsa_set.c22 dsa_key *key) in dsa_set_pqg() argument
29 LTC_ARGCHK(key != NULL); in dsa_set_pqg()
33 err = mp_init_multi(&key->p, &key->g, &key->q, &key->x, &key->y, LTC_NULL); in dsa_set_pqg()
40 key->qord = mp_unsigned_bin_size(key->q); in dsa_set_pqg()
52 dsa_free(key); in dsa_set_pqg()
71 LTC_ARGCHK(key != NULL); in dsa_set_key()
72 LTC_ARGCHK(key->x != NULL); in dsa_set_key()
80 key->type = PK_PRIVATE; in dsa_set_key()
82 …if ((err = mp_exptmod(key->g, key->x, key->p, key->y)) != CRYPT_OK) { goto LBL_ERR; } in dsa_set_key()
85 key->type = PK_PUBLIC; in dsa_set_key()
[all …]
A Ddsa_verify_key.c49 LTC_ARGCHK(key != NULL); in dsa_int_validate_pqg()
54 if ( key->qord >= LTC_MDSA_MAX_GROUP || key->qord <= 15 || in dsa_int_validate_pqg()
55 (unsigned long)key->qord >= mp_unsigned_bin_size(key->p) || in dsa_int_validate_pqg()
56 (mp_unsigned_bin_size(key->p) - key->qord) >= LTC_MDSA_DELTA ) { in dsa_int_validate_pqg()
61 if (mp_cmp_d(key->g, 1) != LTC_MP_GT || mp_cmp(key->g, key->p) != LTC_MP_LT) { in dsa_int_validate_pqg()
78 if ((err = mp_exptmod(key->g, key->q, key->p, tmp1)) != CRYPT_OK) { goto error; } in dsa_int_validate_pqg()
103 LTC_ARGCHK(key != NULL); in dsa_int_validate_primes()
149 if (mp_cmp_d(key->y, 1) != LTC_MP_GT || mp_cmp(key->y, tmp) != LTC_MP_LT) { in dsa_int_validate_xy()
156 if (mp_cmp_d(key->x, 0) != LTC_MP_GT || mp_cmp(key->x, key->q) != LTC_MP_LT) { in dsa_int_validate_xy()
161 if ((err = mp_exptmod(key->g, key->x, key->p, tmp)) != CRYPT_OK) { in dsa_int_validate_xy()
[all …]
A Ddsa_import.c27 LTC_ARGCHK(key != NULL); in dsa_import()
31 if (mp_init_multi(&key->p, &key->g, &key->q, &key->x, &key->y, LTC_NULL) != CRYPT_OK) { in dsa_import()
52 key->type = PK_PRIVATE; in dsa_import()
66 key->type = PK_PUBLIC; in dsa_import()
77 LTC_ASN1_INTEGER, 1UL, key->p, in dsa_import()
78 LTC_ASN1_INTEGER, 1UL, key->q, in dsa_import()
79 LTC_ASN1_INTEGER, 1UL, key->g, in dsa_import()
84 key->type = PK_PRIVATE; in dsa_import()
114 key->type = PK_PUBLIC; in dsa_import()
118 key->qord = mp_unsigned_bin_size(key->q); in dsa_import()
[all …]
A Ddsa_export.c28 LTC_ARGCHK(key != NULL); in dsa_export()
33 if (type == PK_PRIVATE && key->type != PK_PRIVATE) { in dsa_export()
41 LTC_ASN1_INTEGER, 1UL, key->p, in dsa_export()
69 err = der_encode_integer(key->y, tmp, &tmplen); in dsa_export()
74 LTC_SET_ASN1(int_list, 0, LTC_ASN1_INTEGER, key->p, 1UL); in dsa_export()
75 LTC_SET_ASN1(int_list, 1, LTC_ASN1_INTEGER, key->q, 1UL); in dsa_export()
76 LTC_SET_ASN1(int_list, 2, LTC_ASN1_INTEGER, key->g, 1UL); in dsa_export()
89 LTC_ASN1_INTEGER, 1UL, key->g, in dsa_export()
90 LTC_ASN1_INTEGER, 1UL, key->p, in dsa_export()
91 LTC_ASN1_INTEGER, 1UL, key->q, in dsa_export()
[all …]
A Ddsa_set_pqg_dsaparam.c19 dsa_key *key) in dsa_set_pqg_dsaparam() argument
24 LTC_ARGCHK(key != NULL); in dsa_set_pqg_dsaparam()
28 err = mp_init_multi(&key->p, &key->g, &key->q, &key->x, &key->y, LTC_NULL); in dsa_set_pqg_dsaparam()
32 LTC_ASN1_INTEGER, 1UL, key->p, in dsa_set_pqg_dsaparam()
33 LTC_ASN1_INTEGER, 1UL, key->q, in dsa_set_pqg_dsaparam()
34 LTC_ASN1_INTEGER, 1UL, key->g, in dsa_set_pqg_dsaparam()
39 key->qord = mp_unsigned_bin_size(key->q); in dsa_set_pqg_dsaparam()
42 if ((err = dsa_int_validate_pqg(key, &stat)) != CRYPT_OK) { in dsa_set_pqg_dsaparam()
53 dsa_free(key); in dsa_set_pqg_dsaparam()
A Ddsa_free.c16 void dsa_free(dsa_key *key) in dsa_free() argument
18 LTC_ARGCHKVD(key != NULL); in dsa_free()
19 mp_cleanup_multi(&key->y, &key->x, &key->q, &key->g, &key->p, LTC_NULL); in dsa_free()
20 key->type = key->qord = 0; in dsa_free()
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/dh/
A Ddh_set.c20 dh_key *key) in dh_set_pg() argument
24 LTC_ARGCHK(key != NULL); in dh_set_pg()
29 if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { in dh_set_pg()
39 dh_free(key); in dh_set_pg()
54 LTC_ARGCHK(key != NULL); in dh_set_pg_groupsize()
61 if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { in dh_set_pg_groupsize()
70 dh_free(key); in dh_set_pg_groupsize()
93 key->type = PK_PRIVATE; in dh_set_key()
95 … if ((err = mp_exptmod(key->base, key->x, key->prime, key->y)) != CRYPT_OK) { goto LBL_ERR; } in dh_set_key()
98 key->type = PK_PUBLIC; in dh_set_key()
[all …]
A Ddh_import.c15 int dh_import(const unsigned char *in, unsigned long inlen, dh_key *key) in dh_import() argument
22 LTC_ARGCHK(key != NULL); in dh_import()
25 if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { in dh_import()
40 key->type = PK_PRIVATE; in dh_import()
45 LTC_ASN1_INTEGER, 1UL, key->base, in dh_import()
46 LTC_ASN1_INTEGER, 1UL, key->x, in dh_import()
51 if ((err = mp_exptmod(key->base, key->x, key->prime, key->y)) != CRYPT_OK) { in dh_import()
56 key->type = PK_PUBLIC; in dh_import()
62 LTC_ASN1_INTEGER, 1UL, key->y, in dh_import()
78 if ((err = dh_check_pubkey(key)) != CRYPT_OK) { in dh_import()
[all …]
A Ddh_make_key.c61 LTC_ARGCHK(key != NULL); in dh_make_key()
62 LTC_ARGCHK(key->base != NULL); in dh_make_key()
63 LTC_ARGCHK(key->prime != NULL); in dh_make_key()
75 key_size_p = mp_unsigned_bin_size(key->prime); in dh_make_key()
93 arg_mod = key->prime; in dh_make_key()
96 key->x = NULL; in dh_make_key()
97 key->y = NULL; in dh_make_key()
98 err = mp_init_multi(&key->x, &key->y, NULL); in dh_make_key()
122 err = mp_mod(key->y, arg_mod, key->x); in dh_make_key()
127 err = mp_exptmod(key->base, key->x, key->prime, key->y); in dh_make_key()
[all …]
/optee_os-3.20.0/core/drivers/crypto/crypto_api/acipher/
A Drsa.c64 if (key) { in crypto_acipher_free_rsa_public_key()
77 if (key) { in crypto_acipher_free_rsa_keypair()
125 rsa_data.key.key = key; in crypto_acipher_rsanopad_decrypt()
127 rsa_data.key.n_size = crypto_bignum_num_bytes(key->n); in crypto_acipher_rsanopad_decrypt()
164 rsa_data.key.key = key; in crypto_acipher_rsanopad_encrypt()
166 rsa_data.key.n_size = crypto_bignum_num_bytes(key->n); in crypto_acipher_rsanopad_encrypt()
237 rsa_data.key.key = key; in crypto_acipher_rsaes_decrypt()
282 rsa_data.key.key = key; in crypto_acipher_rsaes_encrypt()
382 rsa_ssa.key.key = key; in crypto_acipher_rsassa_sign()
384 rsa_ssa.key.n_size = crypto_bignum_num_bytes(key->n); in crypto_acipher_rsassa_sign()
[all …]
/optee_os-3.20.0/core/lib/libtomcrypt/src/ciphers/safer/
A Dsafer.c259 key = skey->safer.key; in s_safer_ecb_encrypt()
265 a ^= *++key; b += *++key; c += *++key; d ^= *++key; in s_safer_ecb_encrypt()
266 e ^= *++key; f += *++key; g += *++key; h ^= *++key; in s_safer_ecb_encrypt()
267 a = EXP(a) + *++key; b = LOG(b) ^ *++key; in s_safer_ecb_encrypt()
276 a ^= *++key; b += *++key; c += *++key; d ^= *++key; in s_safer_ecb_encrypt()
277 e ^= *++key; f += *++key; g += *++key; h ^= *++key; in s_safer_ecb_encrypt()
313 key = skey->safer.key; in s_safer_ecb_decrypt()
318 h ^= *key; g -= *--key; f -= *--key; e ^= *--key; in s_safer_ecb_decrypt()
319 d ^= *--key; c -= *--key; b -= *--key; a ^= *--key; in s_safer_ecb_decrypt()
326 h -= *--key; g ^= *--key; f ^= *--key; e -= *--key; in s_safer_ecb_decrypt()
[all …]
/optee_os-3.20.0/core/drivers/crypto/versal/
A Drsa.c31 struct rsa_public_key *p = rsa_data->key.key; in do_encrypt()
47 rsa_data->key.key, in do_encrypt()
56 rsa_data->key.key, in do_encrypt()
139 rsa_data->key.key, in do_decrypt()
148 rsa_data->key.key, in do_decrypt()
222 p->key.key, in do_ssa_sign()
231 p->key.key, in do_ssa_sign()
243 p->key.key, in do_ssa_sign()
269 p->key.key, in do_ssa_verify()
278 p->key.key, in do_ssa_verify()
[all …]
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/x25519/
A Dx25519_import_raw.c21 int x25519_import_raw(const unsigned char *in, unsigned long inlen, int which, curve25519_key *key) in x25519_import_raw() argument
25 LTC_ARGCHK(key != NULL); in x25519_import_raw()
28 XMEMCPY(key->priv, in, sizeof(key->priv)); in x25519_import_raw()
29 tweetnacl_crypto_scalarmult_base(key->pub, key->priv); in x25519_import_raw()
31 XMEMCPY(key->pub, in, sizeof(key->pub)); in x25519_import_raw()
35 key->algo = LTC_OID_X25519; in x25519_import_raw()
36 key->type = which; in x25519_import_raw()
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/ed25519/
A Ded25519_import_raw.c21 int ed25519_import_raw(const unsigned char *in, unsigned long inlen, int which, curve25519_key *key) in ed25519_import_raw() argument
25 LTC_ARGCHK(key != NULL); in ed25519_import_raw()
28 XMEMCPY(key->priv, in, sizeof(key->priv)); in ed25519_import_raw()
29 tweetnacl_crypto_sk_to_pk(key->pub, key->priv); in ed25519_import_raw()
31 XMEMCPY(key->pub, in, sizeof(key->pub)); in ed25519_import_raw()
35 key->algo = LTC_OID_ED25519; in ed25519_import_raw()
36 key->type = which; in ed25519_import_raw()

Completed in 23 milliseconds

12345678910>>...17