Lines Matching +full:- +full:s
1 // SPDX-License-Identifier: BSD-2-Clause
3 * Copyright (c) 2014-2019, Linaro Limited
16 TEE_Result crypto_acipher_alloc_dsa_keypair(struct dsa_keypair *s, in crypto_acipher_alloc_dsa_keypair() argument
19 memset(s, 0, sizeof(*s)); in crypto_acipher_alloc_dsa_keypair()
20 if (!bn_alloc_max(&s->g)) in crypto_acipher_alloc_dsa_keypair()
23 if (!bn_alloc_max(&s->p)) in crypto_acipher_alloc_dsa_keypair()
25 if (!bn_alloc_max(&s->q)) in crypto_acipher_alloc_dsa_keypair()
27 if (!bn_alloc_max(&s->y)) in crypto_acipher_alloc_dsa_keypair()
29 if (!bn_alloc_max(&s->x)) in crypto_acipher_alloc_dsa_keypair()
33 crypto_bignum_free(&s->g); in crypto_acipher_alloc_dsa_keypair()
34 crypto_bignum_free(&s->p); in crypto_acipher_alloc_dsa_keypair()
35 crypto_bignum_free(&s->q); in crypto_acipher_alloc_dsa_keypair()
36 crypto_bignum_free(&s->y); in crypto_acipher_alloc_dsa_keypair()
40 TEE_Result crypto_acipher_alloc_dsa_public_key(struct dsa_public_key *s, in crypto_acipher_alloc_dsa_public_key() argument
43 memset(s, 0, sizeof(*s)); in crypto_acipher_alloc_dsa_public_key()
44 if (!bn_alloc_max(&s->g)) in crypto_acipher_alloc_dsa_public_key()
47 if (!bn_alloc_max(&s->p)) in crypto_acipher_alloc_dsa_public_key()
49 if (!bn_alloc_max(&s->q)) in crypto_acipher_alloc_dsa_public_key()
51 if (!bn_alloc_max(&s->y)) in crypto_acipher_alloc_dsa_public_key()
55 crypto_bignum_free(&s->g); in crypto_acipher_alloc_dsa_public_key()
56 crypto_bignum_free(&s->p); in crypto_acipher_alloc_dsa_public_key()
57 crypto_bignum_free(&s->q); in crypto_acipher_alloc_dsa_public_key()
66 if (key_size != 8 * mp_unsigned_bin_size(key->p)) in crypto_acipher_gen_dsa_key()
75 mp_copy(key->g, ltc_tmp_key.g); in crypto_acipher_gen_dsa_key()
76 mp_copy(key->p, ltc_tmp_key.p); in crypto_acipher_gen_dsa_key()
77 mp_copy(key->q, ltc_tmp_key.q); in crypto_acipher_gen_dsa_key()
86 mp_copy(ltc_tmp_key.y, key->y); in crypto_acipher_gen_dsa_key()
87 mp_copy(ltc_tmp_key.x, key->x); in crypto_acipher_gen_dsa_key()
102 void *r, *s; in crypto_acipher_dsa_sign() local
105 .qord = mp_unsigned_bin_size(key->q), in crypto_acipher_dsa_sign()
106 .g = key->g, in crypto_acipher_dsa_sign()
107 .p = key->p, in crypto_acipher_dsa_sign()
108 .q = key->q, in crypto_acipher_dsa_sign()
109 .y = key->y, in crypto_acipher_dsa_sign()
110 .x = key->x, in crypto_acipher_dsa_sign()
137 ltc_res = mp_init_multi(&r, &s, NULL); in crypto_acipher_dsa_sign()
143 ltc_res = dsa_sign_hash_raw(msg, msg_len, r, s, NULL, in crypto_acipher_dsa_sign()
149 mp_to_unsigned_bin(r, (uint8_t *)sig + *sig_len/2 - in crypto_acipher_dsa_sign()
151 mp_to_unsigned_bin(s, (uint8_t *)sig + *sig_len - in crypto_acipher_dsa_sign()
152 mp_unsigned_bin_size(s)); in crypto_acipher_dsa_sign()
158 mp_clear_multi(r, s, NULL); in crypto_acipher_dsa_sign()
170 void *r, *s; in crypto_acipher_dsa_verify() local
173 .qord = mp_unsigned_bin_size(key->q), in crypto_acipher_dsa_verify()
174 .g = key->g, in crypto_acipher_dsa_verify()
175 .p = key->p, in crypto_acipher_dsa_verify()
176 .q = key->q, in crypto_acipher_dsa_verify()
177 .y = key->y in crypto_acipher_dsa_verify()
187 ltc_res = mp_init_multi(&r, &s, NULL); in crypto_acipher_dsa_verify()
193 mp_read_unsigned_bin(s, (uint8_t *)sig + sig_len/2, sig_len/2); in crypto_acipher_dsa_verify()
194 ltc_res = dsa_verify_hash_raw(r, s, msg, msg_len, <c_stat, <c_key); in crypto_acipher_dsa_verify()
195 mp_clear_multi(r, s, NULL); in crypto_acipher_dsa_verify()