• Home
  • Raw
  • Download

Lines Matching refs:key

71 	struct crypto_rsa_key *key;  in crypto_rsa_import_public_key()  local
75 key = os_zalloc(sizeof(*key)); in crypto_rsa_import_public_key()
76 if (key == NULL) in crypto_rsa_import_public_key()
79 key->n = bignum_init(); in crypto_rsa_import_public_key()
80 key->e = bignum_init(); in crypto_rsa_import_public_key()
81 if (key->n == NULL || key->e == NULL) { in crypto_rsa_import_public_key()
82 crypto_rsa_free(key); in crypto_rsa_import_public_key()
105 pos = crypto_rsa_parse_integer(pos, end, key->n); in crypto_rsa_import_public_key()
106 pos = crypto_rsa_parse_integer(pos, end, key->e); in crypto_rsa_import_public_key()
118 return key; in crypto_rsa_import_public_key()
121 crypto_rsa_free(key); in crypto_rsa_import_public_key()
135 struct crypto_rsa_key *key; in crypto_rsa_import_private_key() local
140 key = os_zalloc(sizeof(*key)); in crypto_rsa_import_private_key()
141 if (key == NULL) in crypto_rsa_import_private_key()
144 key->private_key = 1; in crypto_rsa_import_private_key()
146 key->n = bignum_init(); in crypto_rsa_import_private_key()
147 key->e = bignum_init(); in crypto_rsa_import_private_key()
148 key->d = bignum_init(); in crypto_rsa_import_private_key()
149 key->p = bignum_init(); in crypto_rsa_import_private_key()
150 key->q = bignum_init(); in crypto_rsa_import_private_key()
151 key->dmp1 = bignum_init(); in crypto_rsa_import_private_key()
152 key->dmq1 = bignum_init(); in crypto_rsa_import_private_key()
153 key->iqmp = bignum_init(); in crypto_rsa_import_private_key()
155 if (key->n == NULL || key->e == NULL || key->d == NULL || in crypto_rsa_import_private_key()
156 key->p == NULL || key->q == NULL || key->dmp1 == NULL || in crypto_rsa_import_private_key()
157 key->dmq1 == NULL || key->iqmp == NULL) { in crypto_rsa_import_private_key()
158 crypto_rsa_free(key); in crypto_rsa_import_private_key()
201 pos = crypto_rsa_parse_integer(pos, end, key->n); in crypto_rsa_import_private_key()
202 pos = crypto_rsa_parse_integer(pos, end, key->e); in crypto_rsa_import_private_key()
203 pos = crypto_rsa_parse_integer(pos, end, key->d); in crypto_rsa_import_private_key()
204 pos = crypto_rsa_parse_integer(pos, end, key->p); in crypto_rsa_import_private_key()
205 pos = crypto_rsa_parse_integer(pos, end, key->q); in crypto_rsa_import_private_key()
206 pos = crypto_rsa_parse_integer(pos, end, key->dmp1); in crypto_rsa_import_private_key()
207 pos = crypto_rsa_parse_integer(pos, end, key->dmq1); in crypto_rsa_import_private_key()
208 pos = crypto_rsa_parse_integer(pos, end, key->iqmp); in crypto_rsa_import_private_key()
220 return key; in crypto_rsa_import_private_key()
223 crypto_rsa_free(key); in crypto_rsa_import_private_key()
233 size_t crypto_rsa_get_modulus_len(struct crypto_rsa_key *key) in crypto_rsa_get_modulus_len() argument
235 return bignum_get_unsigned_bin_len(key->n); in crypto_rsa_get_modulus_len()
250 struct crypto_rsa_key *key, int use_private) in crypto_rsa_exptmod() argument
256 if (use_private && !key->private_key) in crypto_rsa_exptmod()
265 if (bignum_cmp(key->n, tmp) < 0) { in crypto_rsa_exptmod()
290 if (bignum_exptmod(tmp, key->dmp1, key->p, a) < 0) in crypto_rsa_exptmod()
294 if (bignum_exptmod(tmp, key->dmq1, key->q, b) < 0) in crypto_rsa_exptmod()
299 bignum_mulmod(tmp, key->iqmp, key->p, tmp) < 0) in crypto_rsa_exptmod()
303 if (bignum_mul(tmp, key->q, tmp) < 0 || in crypto_rsa_exptmod()
309 if (bignum_exptmod(tmp, key->e, key->n, tmp) < 0) in crypto_rsa_exptmod()
313 modlen = crypto_rsa_get_modulus_len(key); in crypto_rsa_exptmod()
346 void crypto_rsa_free(struct crypto_rsa_key *key) in crypto_rsa_free() argument
348 if (key) { in crypto_rsa_free()
349 bignum_deinit(key->n); in crypto_rsa_free()
350 bignum_deinit(key->e); in crypto_rsa_free()
351 bignum_deinit(key->d); in crypto_rsa_free()
352 bignum_deinit(key->p); in crypto_rsa_free()
353 bignum_deinit(key->q); in crypto_rsa_free()
354 bignum_deinit(key->dmp1); in crypto_rsa_free()
355 bignum_deinit(key->dmq1); in crypto_rsa_free()
356 bignum_deinit(key->iqmp); in crypto_rsa_free()
357 os_free(key); in crypto_rsa_free()