/openssl/crypto/rsa/ |
H A D | rsa_sp800_56b_gen.c | 116 if (rsa->p == NULL || rsa->q == NULL) in ossl_rsa_fips186_4_gen_prob_primes() 139 ok = ossl_rsa_check_pminusq_diff(tmp, rsa->p, rsa->q, nbits); in ossl_rsa_fips186_4_gen_prob_primes() 146 rsa->dirty_cnt++; in ossl_rsa_fips186_4_gen_prob_primes() 289 if (rsa->n == NULL || !BN_mul(rsa->n, rsa->p, rsa->q, ctx)) in ossl_rsa_sp800_56b_derive_params_from_pq() 299 if (!BN_mod(rsa->dmp1, rsa->d, p1, ctx)) in ossl_rsa_sp800_56b_derive_params_from_pq() 308 if (!BN_mod(rsa->dmq1, rsa->d, q1, ctx)) in ossl_rsa_sp800_56b_derive_params_from_pq() 317 if (BN_mod_inverse(rsa->iqmp, rsa->q, rsa->p, ctx) == NULL) in ossl_rsa_sp800_56b_derive_params_from_pq() 407 if (info == NULL && BN_cmp(rsa->p, rsa->q) < 0) { in ossl_rsa_sp800_56b_generate_key() 409 rsa->p = rsa->q; in ossl_rsa_sp800_56b_generate_key() 450 && BN_mod_exp(tmp, k, rsa->e, rsa->n, ctx) in ossl_rsa_sp800_56b_pairwise_test() [all …]
|
H A D | rsa_ossl.c | 112 if (BN_ucmp(rsa->n, rsa->e) <= 0) { in rsa_ossl_public_encrypt() 194 if (!rsa->meth->bn_mod_exp(ret, f, rsa->e, rsa->n, ctx, in rsa_ossl_public_encrypt() 382 (rsa->dmp1 != NULL) && (rsa->dmq1 != NULL) && (rsa->iqmp != NULL))) { in rsa_ossl_private_encrypt() 383 if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) in rsa_ossl_private_encrypt() 630 (rsa->dmp1 != NULL) && (rsa->dmq1 != NULL) && (rsa->iqmp != NULL))) { in rsa_ossl_private_decrypt() 631 if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) in rsa_ossl_private_decrypt() 719 if (BN_ucmp(rsa->n, rsa->e) <= 0) { in rsa_ossl_public_decrypt() 768 if (!rsa->meth->bn_mod_exp(ret, f, rsa->e, rsa->n, ctx, in rsa_ossl_public_decrypt() 1111 if (rsa->e && rsa->n) { in rsa_ossl_mod_exp() 1118 if (!rsa->meth->bn_mod_exp(vrfy, r0, rsa->e, rsa->n, ctx, in rsa_ossl_mod_exp() [all …]
|
H A D | rsa_x931g.c | 34 if (rsa == NULL) in RSA_X931_derive_ex() 49 if (!rsa->e) { in RSA_X931_derive_ex() 51 if (!rsa->e) in RSA_X931_derive_ex() 54 e = rsa->e; in RSA_X931_derive_ex() 81 if (rsa->p == NULL || rsa->q == NULL) { in RSA_X931_derive_ex() 96 if (!BN_mul(rsa->n, rsa->p, rsa->q, ctx)) in RSA_X931_derive_ex() 117 rsa->d = BN_mod_inverse(NULL, rsa->e, r0, ctx2); /* d */ in RSA_X931_derive_ex() 125 if (!BN_mod(rsa->dmp1, rsa->d, r1, ctx)) in RSA_X931_derive_ex() 132 if (!BN_mod(rsa->dmq1, rsa->d, r2, ctx)) in RSA_X931_derive_ex() 136 rsa->iqmp = BN_mod_inverse(NULL, rsa->q, rsa->p, ctx2); in RSA_X931_derive_ex() [all …]
|
H A D | rsa_sp800_56b_check.c | 30 if (rsa->dmp1 == NULL || rsa->dmq1 == NULL || rsa->iqmp == NULL) { in ossl_rsa_check_crt_components() 31 if (rsa->dmp1 != NULL || rsa->dmq1 != NULL || rsa->iqmp != NULL) in ossl_rsa_check_crt_components() 63 && (BN_cmp(rsa->iqmp, rsa->p) < 0) in ossl_rsa_check_crt_components() 65 && BN_mod_mul(r, rsa->dmp1, rsa->e, p1, ctx) in ossl_rsa_check_crt_components() 68 && BN_mod_mul(r, rsa->dmq1, rsa->e, q1, ctx) in ossl_rsa_check_crt_components() 71 && BN_mod_mul(r, rsa->iqmp, rsa->q, rsa->p, ctx) in ossl_rsa_check_crt_components() 209 && BN_mod_mul(r, rsa->e, rsa->d, lcm, ctx) in ossl_rsa_check_private_exponent() 288 if (rsa->n == NULL || rsa->e == NULL) 358 if (rsa->d == NULL || rsa->n == NULL) 360 return BN_cmp(rsa->d, BN_value_one()) >= 0 && BN_cmp(rsa->d, rsa->n) < 0; [all …]
|
H A D | rsa_crpt.c | 36 return rsa->meth->rsa_pub_enc(flen, from, to, rsa, padding); in RSA_public_encrypt() 42 return rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding); in RSA_private_encrypt() 48 return rsa->meth->rsa_priv_dec(flen, from, to, rsa, padding); in RSA_private_decrypt() 54 return rsa->meth->rsa_pub_dec(flen, from, to, rsa, padding); in RSA_public_decrypt() 65 rsa->blinding = NULL; in RSA_blinding_off() 74 if (rsa->blinding != NULL) in RSA_blinding_on() 77 rsa->blinding = RSA_setup_blinding(rsa, ctx); in RSA_blinding_on() 136 if (rsa->e == NULL) { in RSA_setup_blinding() 137 e = rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx); in RSA_setup_blinding() 143 e = rsa->e; in RSA_setup_blinding() [all …]
|
H A D | rsa_gen.c | 44 return rsa->meth->rsa_keygen(rsa, bits, e_value, cb); in RSA_generate_key_ex() 66 return rsa->meth->rsa_keygen(rsa, bits, e_value, cb); in RSA_generate_multi_prime_key() 325 if (!rsa->n && ((rsa->n = BN_new()) == NULL)) in rsa_multiprime_keygen() 327 if (!rsa->d && ((rsa->d = BN_secure_new()) == NULL)) in rsa_multiprime_keygen() 330 if (!rsa->e && ((rsa->e = BN_new()) == NULL)) in rsa_multiprime_keygen() 332 if (!rsa->p && ((rsa->p = BN_secure_new()) == NULL)) in rsa_multiprime_keygen() 335 if (!rsa->q && ((rsa->q = BN_secure_new()) == NULL)) in rsa_multiprime_keygen() 432 if (!BN_mul(r1, rsa->p, rsa->q, ctx)) in rsa_multiprime_keygen() 519 if (BN_cmp(rsa->p, rsa->q) < 0) { in rsa_multiprime_keygen() 521 rsa->p = rsa->q; in rsa_multiprime_keygen() [all …]
|
H A D | rsa_backend.c | 75 if (rsa == NULL) in ossl_rsa_fromdata() 187 if (!ossl_rsa_multiprime_derive(rsa, RSA_bits(rsa), in ossl_rsa_fromdata() 458 if (rsa->engine != NULL || RSA_get_method(rsa) != RSA_PKCS1_OpenSSL()) in ossl_rsa_is_foreign() 479 if (ossl_rsa_is_foreign(rsa)) in ossl_rsa_dup() 513 dupkey->flags = rsa->flags; in ossl_rsa_dup() 545 if (rsa->pss != NULL) { in ossl_rsa_dup() 593 if (rsa != NULL in ossl_rsa_sync_to_pss_params_30() 686 RSA *rsa; in ossl_rsa_key_from_pkcs8() local 693 if (rsa == NULL) { in ossl_rsa_key_from_pkcs8() 698 RSA_free(rsa); in ossl_rsa_key_from_pkcs8() [all …]
|
H A D | rsa_local.h | 106 unsigned char *to, RSA *rsa, int padding); 119 int (*init) (RSA *rsa); 121 int (*finish) (RSA *rsa); 135 const RSA *rsa); 138 unsigned int siglen, const RSA *rsa); 153 int ossl_rsa_multiprime_derive(RSA *rsa, int bits, int primes, 166 int ossl_rsa_multip_calc_product(RSA *rsa); 180 int ossl_rsa_check_crt_components(const RSA *rsa, BN_CTX *ctx); 182 int ossl_rsa_sp800_56b_pairwise_test(RSA *rsa, BN_CTX *ctx); 183 int ossl_rsa_sp800_56b_check_public(const RSA *rsa); [all …]
|
H A D | rsa_meth.c | 104 unsigned char *to, RSA *rsa, int padding) in RSA_meth_get_pub_enc() 120 unsigned char *to, RSA *rsa, int padding) in RSA_meth_get_pub_dec() 136 unsigned char *to, RSA *rsa, int padding) in RSA_meth_get_priv_enc() 152 unsigned char *to, RSA *rsa, int padding) in RSA_meth_get_priv_dec() 168 (BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx) in RSA_meth_get_mod_exp() 202 int (*RSA_meth_get_init(const RSA_METHOD *meth)) (RSA *rsa) in RSA_meth_get_init() 214 int (*RSA_meth_get_finish(const RSA_METHOD *meth)) (RSA *rsa) in RSA_meth_get_finish() 229 const RSA *rsa) in RSA_meth_get_sign() 238 const RSA *rsa)) in RSA_meth_set_sign() argument 247 unsigned int siglen, const RSA *rsa) in RSA_meth_get_verify() [all …]
|
H A D | rsa_ameth.c | 32 const RSA *rsa = pkey->pkey.rsa; in rsa_param_encode() local 81 RSA *rsa = NULL; in rsa_pub_decode() local 88 RSA_free(rsa); in rsa_pub_decode() 106 RSA_free(rsa); in rsa_pub_decode() 123 if (BN_cmp(b->pkey.rsa->n, a->pkey.rsa->n) != 0 in rsa_pub_cmp() 124 || BN_cmp(b->pkey.rsa->e, a->pkey.rsa->e) != 0) in rsa_pub_cmp() 132 RSA *rsa; in old_rsa_priv_decode() local 178 if (rsa != NULL) { in rsa_priv_decode() 798 RSA *rsa = from->pkey.rsa; in rsa_int_export_to() local 807 if (RSA_get0_n(rsa) == NULL || RSA_get0_e(rsa) == NULL) in rsa_int_export_to() [all …]
|
H A D | rsa_pmeth.c | 341 int klen = RSA_size(rsa); in pkey_rsa_encrypt() 777 if (rsa->pss == NULL) in rsa_set_pss_param() 784 RSA *rsa = NULL; in pkey_rsa_keygen() local 794 rsa = RSA_new(); in pkey_rsa_keygen() 795 if (rsa == NULL) in pkey_rsa_keygen() 800 RSA_free(rsa); in pkey_rsa_keygen() 811 RSA_free(rsa); in pkey_rsa_keygen() 817 RSA_free(rsa); in pkey_rsa_keygen() 868 const RSA *rsa; in pkey_pss_init() local 879 if (rsa->pss == NULL) in pkey_pss_init() [all …]
|
H A D | rsa_pss.c | 31 int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, in RSA_verify_PKCS1_PSS() argument 35 return RSA_verify_PKCS1_PSS_mgf1(rsa, mHash, Hash, NULL, EM, sLen); in RSA_verify_PKCS1_PSS() 38 int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, in RSA_verify_PKCS1_PSS_mgf1() argument 82 MSBits = (BN_num_bits(rsa->n) - 1) & 0x7; in ossl_rsa_verify_PKCS1_PSS_mgf1() 83 emLen = RSA_size(rsa); in ossl_rsa_verify_PKCS1_PSS_mgf1() 158 int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, in RSA_padding_add_PKCS1_PSS() argument 165 int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, in RSA_padding_add_PKCS1_PSS_mgf1() argument 173 int ossl_rsa_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, in ossl_rsa_padding_add_PKCS1_PSS_mgf1() argument 220 MSBits = (BN_num_bits(rsa->n) - 1) & 0x7; in ossl_rsa_padding_add_PKCS1_PSS_mgf1() 221 emLen = RSA_size(rsa); in ossl_rsa_padding_add_PKCS1_PSS_mgf1() [all …]
|
H A D | rsa_depr.c | 34 RSA *rsa = RSA_new(); in RSA_generate_key() local 37 if (cb == NULL || rsa == NULL || e == NULL) in RSA_generate_key() 52 if (RSA_generate_key_ex(rsa, bits, e, cb)) { in RSA_generate_key() 55 return rsa; in RSA_generate_key() 59 RSA_free(rsa); in RSA_generate_key()
|
H A D | rsa_sign.c | 288 unsigned char *sigret, unsigned int *siglen, RSA *rsa) in RSA_sign() argument 296 if (rsa->meth->rsa_sign != NULL) in RSA_sign() 297 return rsa->meth->rsa_sign(type, m, m_len, sigret, siglen, rsa) > 0; in RSA_sign() 319 if (encoded_len + RSA_PKCS1_PADDING_SIZE > (size_t)RSA_size(rsa)) { in RSA_sign() 347 const unsigned char *sigbuf, size_t siglen, RSA *rsa) in ossl_rsa_verify() argument 353 if (siglen != (size_t)RSA_size(rsa)) { in ossl_rsa_verify() 363 len = RSA_public_decrypt((int)siglen, sigbuf, decrypt_buf, rsa, in ossl_rsa_verify() 462 const unsigned char *sigbuf, unsigned int siglen, RSA *rsa) in RSA_verify() argument 465 if (rsa->meth->rsa_verify != NULL) in RSA_verify() 466 return rsa->meth->rsa_verify(type, m, m_len, sigbuf, siglen, rsa); in RSA_verify() [all …]
|
H A D | rsa_saos.c | 26 RSA *rsa) in RSA_sign_ASN1_OCTET_STRING() argument 37 j = RSA_size(rsa); in RSA_sign_ASN1_OCTET_STRING() 47 i = RSA_private_encrypt(i, s, sigret, rsa, RSA_PKCS1_PADDING); in RSA_sign_ASN1_OCTET_STRING() 60 unsigned int siglen, RSA *rsa) in RSA_verify_ASN1_OCTET_STRING() argument 67 if (siglen != (unsigned int)RSA_size(rsa)) { in RSA_verify_ASN1_OCTET_STRING() 75 i = RSA_public_decrypt((int)siglen, sigbuf, s, rsa, RSA_PKCS1_PADDING); in RSA_verify_ASN1_OCTET_STRING()
|
/openssl/ssl/ |
H A D | ssl_rsa_legacy.c | 22 if (rsa == NULL) { in SSL_use_RSAPrivateKey() 31 RSA_up_ref(rsa); in SSL_use_RSAPrivateKey() 33 RSA_free(rsa); in SSL_use_RSAPrivateKey() 47 RSA *rsa = NULL; in SSL_use_RSAPrivateKey_file() local 81 RSA_free(rsa); in SSL_use_RSAPrivateKey_file() 91 RSA *rsa; in SSL_use_RSAPrivateKey_ASN1() local 100 RSA_free(rsa); in SSL_use_RSAPrivateKey_ASN1() 118 RSA_up_ref(rsa); in SSL_CTX_use_RSAPrivateKey() 168 RSA_free(rsa); in SSL_CTX_use_RSAPrivateKey_file() 179 RSA *rsa; in SSL_CTX_use_RSAPrivateKey_ASN1() local [all …]
|
/openssl/include/openssl/ |
H A D | rsa.h | 375 RSA *rsa); 501 int RSA_meth_set_pub_enc(RSA_METHOD *rsa, 511 int RSA_meth_set_pub_dec(RSA_METHOD *rsa, 521 int RSA_meth_set_priv_enc(RSA_METHOD *rsa, 531 int RSA_meth_set_priv_dec(RSA_METHOD *rsa, 540 int RSA_meth_set_mod_exp(RSA_METHOD *rsa, 561 int RSA_meth_set_init(RSA_METHOD *rsa, int (*init) (RSA *rsa)); 565 int RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish) (RSA *rsa)); 574 int RSA_meth_set_sign(RSA_METHOD *rsa, 587 int RSA_meth_set_verify(RSA_METHOD *rsa, [all …]
|
/openssl/providers/implementations/keymgmt/ |
H A D | rsa_kmgmt.c | 81 RSA *rsa; in rsa_newdata() local 87 if (rsa != NULL) { in rsa_newdata() 91 return rsa; in rsa_newdata() 97 RSA *rsa; in rsapss_newdata() local 103 if (rsa != NULL) { in rsapss_newdata() 107 return rsa; in rsapss_newdata() 332 RSA *rsa = key; in rsa_get_params() local 631 rsa = rsa_tmp; in rsa_gen() 636 return rsa; in rsa_gen() 656 RSA *rsa = NULL; in common_load() local [all …]
|
/openssl/doc/man7/ |
H A D | EVP_PKEY-RSA.pod | 39 =item "rsa-factor1" (B<OSSL_PKEY_PARAM_RSA_FACTOR1>) <unsigned integer> 41 =item "rsa-factor2" (B<OSSL_PKEY_PARAM_RSA_FACTOR2>) <unsigned integer> 43 =item "rsa-factor3" (B<OSSL_PKEY_PARAM_RSA_FACTOR3>) <unsigned integer> 45 =item "rsa-factor4" (B<OSSL_PKEY_PARAM_RSA_FACTOR4>) <unsigned integer> 47 =item "rsa-factor5" (B<OSSL_PKEY_PARAM_RSA_FACTOR5>) <unsigned integer> 49 =item "rsa-factor6" (B<OSSL_PKEY_PARAM_RSA_FACTOR6>) <unsigned integer> 51 =item "rsa-factor7" (B<OSSL_PKEY_PARAM_RSA_FACTOR7>) <unsigned integer> 53 =item "rsa-factor8" (B<OSSL_PKEY_PARAM_RSA_FACTOR8>) <unsigned integer> 55 =item "rsa-factor9" (B<OSSL_PKEY_PARAM_RSA_FACTOR9>) <unsigned integer> 57 =item "rsa-factor10" (B<OSSL_PKEY_PARAM_RSA_FACTOR10>) <unsigned integer> [all …]
|
/openssl/doc/man3/ |
H A D | RSA_meth_new.pod | 21 #include <openssl/rsa.h> 43 int RSA_meth_set_pub_enc(RSA_METHOD *rsa, 51 int RSA_meth_set_pub_dec(RSA_METHOD *rsa, 59 int RSA_meth_set_priv_enc(RSA_METHOD *rsa, 66 int RSA_meth_set_priv_dec(RSA_METHOD *rsa, 73 int RSA_meth_set_mod_exp(RSA_METHOD *rsa, 88 int RSA_meth_set_init(RSA_METHOD *rsa, int (*init (RSA *rsa)); 92 int RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish)(RSA *rsa)); 98 int RSA_meth_set_sign(RSA_METHOD *rsa, 107 int RSA_meth_set_verify(RSA_METHOD *rsa, [all …]
|
/openssl/test/ |
H A D | pem_read_depr_test.c | 153 RSA *rsa = NULL; in test_read_rsa_private() local 158 rsa = PEM_read_bio_RSAPrivateKey(infile, NULL, NULL, NULL); in test_read_rsa_private() 159 if (!TEST_ptr(rsa)) in test_read_rsa_private() 166 RSA_free(rsa); in test_read_rsa_private() 174 RSA *rsa = NULL; in test_read_rsa_public() local 179 rsa = PEM_read_bio_RSA_PUBKEY(infile, NULL, NULL, NULL); in test_read_rsa_public() 180 if (!TEST_ptr(rsa)) in test_read_rsa_public() 187 RSA_free(rsa); in test_read_rsa_public()
|
/openssl/providers/implementations/kem/ |
H A D | rsa_kem.c | 56 RSA *rsa; member 105 RSA_free(prsactx->rsa); in rsakem_freectx() 122 if (dstctx->rsa != NULL && !RSA_up_ref(dstctx->rsa)) { in rsakem_dupctx() 146 RSA_free(prsactx->rsa); in rsakem_init() 147 prsactx->rsa = vrsa; in rsakem_init() 155 prsactx->rsa, desc, protect)) in rsakem_init() 285 nlen = RSA_size(prsactx->rsa); in rsasve_generate() 315 if (!rsasve_gen_rand_bytes(prsactx->rsa, secret, nlen)) in rsasve_generate() 319 ret = RSA_public_encrypt(nlen, secret, out, prsactx->rsa, RSA_NO_PADDING); in rsasve_generate() 361 nlen = RSA_size(prsactx->rsa); in rsasve_recover() [all …]
|
/openssl/crypto/evp/ |
H A D | p_enc.c | 25 RSA *rsa = NULL; in EVP_PKEY_encrypt_old() local 32 rsa = evp_pkey_get0_RSA_int(pubk); in EVP_PKEY_encrypt_old() 33 if (rsa == NULL) in EVP_PKEY_encrypt_old() 37 RSA_public_encrypt(key_len, key, ek, rsa, RSA_PKCS1_PADDING); in EVP_PKEY_encrypt_old()
|
H A D | p_dec.c | 25 RSA *rsa = NULL; in EVP_PKEY_decrypt_old() local 32 rsa = evp_pkey_get0_RSA_int(priv); in EVP_PKEY_decrypt_old() 33 if (rsa == NULL) in EVP_PKEY_decrypt_old() 37 RSA_private_decrypt(ekl, ek, key, rsa, RSA_PKCS1_PADDING); in EVP_PKEY_decrypt_old()
|
/openssl/include/crypto/ |
H A D | rsa.h | 49 int ossl_rsa_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, 52 int ossl_rsa_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, 71 int ossl_rsa_is_foreign(const RSA *rsa); 72 RSA *ossl_rsa_dup(const RSA *rsa, int selection); 74 int ossl_rsa_todata(RSA *rsa, OSSL_PARAM_BLD *bld, OSSL_PARAM params[], 76 int ossl_rsa_fromdata(RSA *rsa, const OSSL_PARAM params[], int include_private); 88 int ossl_rsa_param_decode(RSA *rsa, const X509_ALGOR *alg); 115 size_t siglen, RSA *rsa);
|