Lines Matching refs:prsactx

82     PROV_RSA_CTX *prsactx;  in rsa_newctx()  local
86 prsactx = OPENSSL_zalloc(sizeof(PROV_RSA_CTX)); in rsa_newctx()
87 if (prsactx == NULL) in rsa_newctx()
89 prsactx->libctx = PROV_LIBCTX_OF(provctx); in rsa_newctx()
91 return prsactx; in rsa_newctx()
97 PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx; in rsa_init() local
99 if (!ossl_prov_is_running() || prsactx == NULL || vrsa == NULL) in rsa_init()
102 if (!ossl_rsa_check_key(prsactx->libctx, vrsa, operation)) in rsa_init()
107 RSA_free(prsactx->rsa); in rsa_init()
108 prsactx->rsa = vrsa; in rsa_init()
109 prsactx->operation = operation; in rsa_init()
111 switch (RSA_test_flags(prsactx->rsa, RSA_FLAG_TYPE_MASK)) { in rsa_init()
113 prsactx->pad_mode = RSA_PKCS1_PADDING; in rsa_init()
120 return rsa_set_ctx_params(prsactx, params); in rsa_init()
138 PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx; in rsa_encrypt() local
145 size_t len = RSA_size(prsactx->rsa); in rsa_encrypt()
155 if (prsactx->pad_mode == RSA_PKCS1_OAEP_PADDING) { in rsa_encrypt()
156 int rsasize = RSA_size(prsactx->rsa); in rsa_encrypt()
163 if (prsactx->oaep_md == NULL) { in rsa_encrypt()
165 prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, "SHA-1", NULL); in rsa_encrypt()
170 ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(prsactx->libctx, tbuf, in rsa_encrypt()
172 prsactx->oaep_label, in rsa_encrypt()
173 prsactx->oaep_labellen, in rsa_encrypt()
174 prsactx->oaep_md, in rsa_encrypt()
175 prsactx->mgf1_md); in rsa_encrypt()
181 ret = RSA_public_encrypt(rsasize, tbuf, out, prsactx->rsa, in rsa_encrypt()
185 ret = RSA_public_encrypt(inlen, in, out, prsactx->rsa, in rsa_encrypt()
186 prsactx->pad_mode); in rsa_encrypt()
198 PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx; in rsa_decrypt() local
200 size_t len = RSA_size(prsactx->rsa); in rsa_decrypt()
205 if (prsactx->pad_mode == RSA_PKCS1_WITH_TLS_PADDING) { in rsa_decrypt()
230 if (prsactx->pad_mode == RSA_PKCS1_OAEP_PADDING in rsa_decrypt()
231 || prsactx->pad_mode == RSA_PKCS1_WITH_TLS_PADDING) { in rsa_decrypt()
238 ret = RSA_private_decrypt(inlen, in, tbuf, prsactx->rsa, in rsa_decrypt()
249 if (prsactx->pad_mode == RSA_PKCS1_OAEP_PADDING) { in rsa_decrypt()
250 if (prsactx->oaep_md == NULL) { in rsa_decrypt()
251 prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, "SHA-1", NULL); in rsa_decrypt()
252 if (prsactx->oaep_md == NULL) { in rsa_decrypt()
260 prsactx->oaep_label, in rsa_decrypt()
261 prsactx->oaep_labellen, in rsa_decrypt()
262 prsactx->oaep_md, in rsa_decrypt()
263 prsactx->mgf1_md); in rsa_decrypt()
266 if (prsactx->client_version <= 0) { in rsa_decrypt()
272 prsactx->libctx, out, outsize, tbuf, len, in rsa_decrypt()
273 prsactx->client_version, prsactx->alt_version); in rsa_decrypt()
277 ret = RSA_private_decrypt(inlen, in, out, prsactx->rsa, in rsa_decrypt()
278 prsactx->pad_mode); in rsa_decrypt()
287 PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx; in rsa_freectx() local
289 RSA_free(prsactx->rsa); in rsa_freectx()
291 EVP_MD_free(prsactx->oaep_md); in rsa_freectx()
292 EVP_MD_free(prsactx->mgf1_md); in rsa_freectx()
293 OPENSSL_free(prsactx->oaep_label); in rsa_freectx()
295 OPENSSL_free(prsactx); in rsa_freectx()
334 PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx; in rsa_get_ctx_params() local
337 if (prsactx == NULL) in rsa_get_ctx_params()
344 if (!OSSL_PARAM_set_int(p, prsactx->pad_mode)) in rsa_get_ctx_params()
353 if (prsactx->pad_mode == (int)padding_item[i].id) { in rsa_get_ctx_params()
372 if (p != NULL && !OSSL_PARAM_set_utf8_string(p, prsactx->oaep_md == NULL in rsa_get_ctx_params()
374 : EVP_MD_get0_name(prsactx->oaep_md))) in rsa_get_ctx_params()
379 EVP_MD *mgf1_md = prsactx->mgf1_md == NULL ? prsactx->oaep_md in rsa_get_ctx_params()
380 : prsactx->mgf1_md; in rsa_get_ctx_params()
390 !OSSL_PARAM_set_octet_ptr(p, prsactx->oaep_label, in rsa_get_ctx_params()
391 prsactx->oaep_labellen)) in rsa_get_ctx_params()
395 if (p != NULL && !OSSL_PARAM_set_uint(p, prsactx->client_version)) in rsa_get_ctx_params()
399 if (p != NULL && !OSSL_PARAM_set_uint(p, prsactx->alt_version)) in rsa_get_ctx_params()
424 PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx; in rsa_set_ctx_params() local
430 if (prsactx == NULL) in rsa_set_ctx_params()
448 EVP_MD_free(prsactx->oaep_md); in rsa_set_ctx_params()
449 prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, mdname, mdprops); in rsa_set_ctx_params()
451 if (prsactx->oaep_md == NULL) in rsa_set_ctx_params()
489 if (pad_mode == RSA_PKCS1_OAEP_PADDING && prsactx->oaep_md == NULL) { in rsa_set_ctx_params()
490 prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, "SHA1", mdprops); in rsa_set_ctx_params()
491 if (prsactx->oaep_md == NULL) in rsa_set_ctx_params()
494 prsactx->pad_mode = pad_mode; in rsa_set_ctx_params()
512 EVP_MD_free(prsactx->mgf1_md); in rsa_set_ctx_params()
513 prsactx->mgf1_md = EVP_MD_fetch(prsactx->libctx, mdname, str); in rsa_set_ctx_params()
515 if (prsactx->mgf1_md == NULL) in rsa_set_ctx_params()
526 OPENSSL_free(prsactx->oaep_label); in rsa_set_ctx_params()
527 prsactx->oaep_label = (unsigned char *)tmp_label; in rsa_set_ctx_params()
528 prsactx->oaep_labellen = tmp_labellen; in rsa_set_ctx_params()
537 prsactx->client_version = client_version; in rsa_set_ctx_params()
546 prsactx->alt_version = alt_version; in rsa_set_ctx_params()