• Home
  • Raw
  • Download

Lines Matching refs:key

70 	struct crypto_rsa_key *key;  in crypto_rsa_import_public_key()  local
74 key = os_zalloc(sizeof(*key)); in crypto_rsa_import_public_key()
75 if (key == NULL) in crypto_rsa_import_public_key()
78 key->n = bignum_init(); in crypto_rsa_import_public_key()
79 key->e = bignum_init(); in crypto_rsa_import_public_key()
80 if (key->n == NULL || key->e == NULL) { in crypto_rsa_import_public_key()
81 crypto_rsa_free(key); in crypto_rsa_import_public_key()
104 pos = crypto_rsa_parse_integer(pos, end, key->n); in crypto_rsa_import_public_key()
105 pos = crypto_rsa_parse_integer(pos, end, key->e); in crypto_rsa_import_public_key()
117 return key; in crypto_rsa_import_public_key()
120 crypto_rsa_free(key); in crypto_rsa_import_public_key()
134 struct crypto_rsa_key *key; in crypto_rsa_import_private_key() local
139 key = os_zalloc(sizeof(*key)); in crypto_rsa_import_private_key()
140 if (key == NULL) in crypto_rsa_import_private_key()
143 key->private_key = 1; in crypto_rsa_import_private_key()
145 key->n = bignum_init(); in crypto_rsa_import_private_key()
146 key->e = bignum_init(); in crypto_rsa_import_private_key()
147 key->d = bignum_init(); in crypto_rsa_import_private_key()
148 key->p = bignum_init(); in crypto_rsa_import_private_key()
149 key->q = bignum_init(); in crypto_rsa_import_private_key()
150 key->dmp1 = bignum_init(); in crypto_rsa_import_private_key()
151 key->dmq1 = bignum_init(); in crypto_rsa_import_private_key()
152 key->iqmp = bignum_init(); in crypto_rsa_import_private_key()
154 if (key->n == NULL || key->e == NULL || key->d == NULL || in crypto_rsa_import_private_key()
155 key->p == NULL || key->q == NULL || key->dmp1 == NULL || in crypto_rsa_import_private_key()
156 key->dmq1 == NULL || key->iqmp == NULL) { in crypto_rsa_import_private_key()
157 crypto_rsa_free(key); in crypto_rsa_import_private_key()
200 pos = crypto_rsa_parse_integer(pos, end, key->n); in crypto_rsa_import_private_key()
201 pos = crypto_rsa_parse_integer(pos, end, key->e); in crypto_rsa_import_private_key()
202 pos = crypto_rsa_parse_integer(pos, end, key->d); in crypto_rsa_import_private_key()
203 pos = crypto_rsa_parse_integer(pos, end, key->p); in crypto_rsa_import_private_key()
204 pos = crypto_rsa_parse_integer(pos, end, key->q); in crypto_rsa_import_private_key()
205 pos = crypto_rsa_parse_integer(pos, end, key->dmp1); in crypto_rsa_import_private_key()
206 pos = crypto_rsa_parse_integer(pos, end, key->dmq1); in crypto_rsa_import_private_key()
207 pos = crypto_rsa_parse_integer(pos, end, key->iqmp); in crypto_rsa_import_private_key()
219 return key; in crypto_rsa_import_private_key()
222 crypto_rsa_free(key); in crypto_rsa_import_private_key()
232 size_t crypto_rsa_get_modulus_len(struct crypto_rsa_key *key) in crypto_rsa_get_modulus_len() argument
234 return bignum_get_unsigned_bin_len(key->n); in crypto_rsa_get_modulus_len()
249 struct crypto_rsa_key *key, int use_private) in crypto_rsa_exptmod() argument
255 if (use_private && !key->private_key) in crypto_rsa_exptmod()
264 if (bignum_cmp(key->n, tmp) < 0) { in crypto_rsa_exptmod()
289 if (bignum_exptmod(tmp, key->dmp1, key->p, a) < 0) in crypto_rsa_exptmod()
293 if (bignum_exptmod(tmp, key->dmq1, key->q, b) < 0) in crypto_rsa_exptmod()
298 bignum_mulmod(tmp, key->iqmp, key->p, tmp) < 0) in crypto_rsa_exptmod()
302 if (bignum_mul(tmp, key->q, tmp) < 0 || in crypto_rsa_exptmod()
308 if (bignum_exptmod(tmp, key->e, key->n, tmp) < 0) in crypto_rsa_exptmod()
312 modlen = crypto_rsa_get_modulus_len(key); in crypto_rsa_exptmod()
345 void crypto_rsa_free(struct crypto_rsa_key *key) in crypto_rsa_free() argument
347 if (key) { in crypto_rsa_free()
348 bignum_deinit(key->n); in crypto_rsa_free()
349 bignum_deinit(key->e); in crypto_rsa_free()
350 bignum_deinit(key->d); in crypto_rsa_free()
351 bignum_deinit(key->p); in crypto_rsa_free()
352 bignum_deinit(key->q); in crypto_rsa_free()
353 bignum_deinit(key->dmp1); in crypto_rsa_free()
354 bignum_deinit(key->dmq1); in crypto_rsa_free()
355 bignum_deinit(key->iqmp); in crypto_rsa_free()
356 os_free(key); in crypto_rsa_free()