/external/boringssl/src/crypto/rsa/ |
D | rsa.c | 79 RSA *rsa = OPENSSL_malloc(sizeof(RSA)); in RSA_new_method() local 80 if (rsa == NULL) { in RSA_new_method() 85 OPENSSL_memset(rsa, 0, sizeof(RSA)); in RSA_new_method() 88 rsa->meth = ENGINE_get_RSA_method(engine); in RSA_new_method() 91 if (rsa->meth == NULL) { in RSA_new_method() 92 rsa->meth = (RSA_METHOD*) &RSA_default_method; in RSA_new_method() 94 METHOD_ref(rsa->meth); in RSA_new_method() 96 rsa->references = 1; in RSA_new_method() 97 rsa->flags = rsa->meth->flags; in RSA_new_method() 98 CRYPTO_MUTEX_init(&rsa->lock); in RSA_new_method() [all …]
|
D | rsa_impl.c | 72 static int check_modulus_and_exponent_sizes(const RSA *rsa) { in check_modulus_and_exponent_sizes() argument 73 unsigned rsa_bits = BN_num_bits(rsa->n); in check_modulus_and_exponent_sizes() 91 if (BN_num_bits(rsa->e) > kMaxExponentBits) { in check_modulus_and_exponent_sizes() 104 assert(BN_ucmp(rsa->n, rsa->e) > 0); in check_modulus_and_exponent_sizes() 109 size_t rsa_default_size(const RSA *rsa) { in rsa_default_size() argument 110 return BN_num_bytes(rsa->n); in rsa_default_size() 113 int rsa_default_encrypt(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, in rsa_default_encrypt() argument 115 const unsigned rsa_size = RSA_size(rsa); in rsa_default_encrypt() 126 if (!check_modulus_and_exponent_sizes(rsa)) { in rsa_default_encrypt() 169 if (BN_ucmp(f, rsa->n) >= 0) { in rsa_default_encrypt() [all …]
|
D | rsa_test.cc | 628 bssl::UniquePtr<RSA> rsa( in TEST_P() local 630 ASSERT_TRUE(rsa); in TEST_P() 632 EXPECT_TRUE(RSA_check_key(rsa.get())); in TEST_P() 636 ASSERT_TRUE(RSA_decrypt(rsa.get(), &out_len, out, sizeof(out), param.enc, in TEST_P() 645 bssl::UniquePtr<RSA> rsa(RSA_new()); in TEST() local 647 ASSERT_TRUE(rsa); in TEST() 654 RSA_generate_multi_prime_key(rsa.get(), kBits, 3, e.get(), nullptr)); in TEST() 655 ASSERT_TRUE(RSA_check_key(rsa.get())); in TEST() 661 ASSERT_TRUE(RSA_encrypt(rsa.get(), &encrypted_len, encrypted, in TEST() 664 ASSERT_TRUE(RSA_decrypt(rsa.get(), &decrypted_len, decrypted, in TEST() [all …]
|
D | rsa_asn1.c | 146 int RSA_marshal_public_key(CBB *cbb, const RSA *rsa) { in RSA_marshal_public_key() argument 149 !marshal_integer(&child, rsa->n) || in RSA_marshal_public_key() 150 !marshal_integer(&child, rsa->e) || in RSA_marshal_public_key() 159 const RSA *rsa) { in RSA_public_key_to_bytes() argument 163 !RSA_marshal_public_key(&cbb, rsa) || in RSA_public_key_to_bytes() 312 int RSA_marshal_private_key(CBB *cbb, const RSA *rsa) { in RSA_marshal_private_key() argument 314 sk_RSA_additional_prime_num(rsa->additional_primes) > 0; in RSA_marshal_private_key() 320 !marshal_integer(&child, rsa->n) || in RSA_marshal_private_key() 321 !marshal_integer(&child, rsa->e) || in RSA_marshal_private_key() 322 !marshal_integer(&child, rsa->d) || in RSA_marshal_private_key() [all …]
|
D | internal.h | 72 size_t rsa_default_size(const RSA *rsa); 73 int rsa_default_encrypt(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, 75 int rsa_default_sign_raw(RSA *rsa, size_t *out_len, uint8_t *out, 78 int rsa_default_decrypt(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, 80 int rsa_default_private_transform(RSA *rsa, uint8_t *out, const uint8_t *in, 82 int rsa_default_multi_prime_keygen(RSA *rsa, int bits, int num_primes, 84 int rsa_default_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb); 116 int RSA_private_transform(RSA *rsa, uint8_t *out, const uint8_t *in,
|
/external/vboot_reference/tests/ |
D | vboot_common2_tests.c | 21 RSAPublicKey *rsa; in VerifyPublicKeyToRSA() local 34 rsa = PublicKeyToRSA(orig_key); in VerifyPublicKeyToRSA() 35 TEST_NEQ((size_t)rsa, 0, "PublicKeyToRSA() ok"); in VerifyPublicKeyToRSA() 36 if (rsa) { in VerifyPublicKeyToRSA() 37 TEST_EQ((int)rsa->algorithm, (int)key->algorithm, in VerifyPublicKeyToRSA() 39 RSAPublicKeyFree(rsa); in VerifyPublicKeyToRSA() 49 RSAPublicKey *rsa; in VerifyDataTest() local 54 rsa = PublicKeyToRSA(public_key); in VerifyDataTest() 55 TEST_PTR_NEQ(rsa, 0, "VerifyData() calculate rsa"); in VerifyDataTest() 57 if (!sig || !rsa) in VerifyDataTest() [all …]
|
D | vboot_common3_tests.c | 172 RSAPublicKey *rsa; in VerifyFirmwarePreambleTest() local 178 rsa = PublicKeyToRSA(public_key); in VerifyFirmwarePreambleTest() 181 TEST_NEQ(hdr && rsa, 0, "VerifyFirmwarePreamble() prerequisites"); in VerifyFirmwarePreambleTest() 187 TEST_EQ(VerifyFirmwarePreamble(hdr, hsize, rsa), 0, in VerifyFirmwarePreambleTest() 189 TEST_NEQ(VerifyFirmwarePreamble(hdr, 4, rsa), 0, in VerifyFirmwarePreambleTest() 191 TEST_NEQ(VerifyFirmwarePreamble(hdr, hsize - 1, rsa), 0, in VerifyFirmwarePreambleTest() 193 TEST_EQ(VerifyFirmwarePreamble(hdr, hsize + 1, rsa), 0, in VerifyFirmwarePreambleTest() 200 TEST_NEQ(VerifyFirmwarePreamble(h, hsize, rsa), 0, in VerifyFirmwarePreambleTest() 206 TEST_NEQ(VerifyFirmwarePreamble(h, hsize, rsa), 0, in VerifyFirmwarePreambleTest() 212 TEST_EQ(VerifyFirmwarePreamble(h, hsize, rsa), 0, in VerifyFirmwarePreambleTest() [all …]
|
D | vb20_common3_tests.c | 178 struct vb2_public_key rsa; in test_verify_fw_preamble() local 189 TEST_SUCC(vb2_unpack_key(&rsa, (uint8_t *)public_key, in test_verify_fw_preamble() 204 TEST_SUCC(vb2_verify_fw_preamble(h, hsize, &rsa, &wb), in test_verify_fw_preamble() 208 TEST_EQ(vb2_verify_fw_preamble(h, 4, &rsa, &wb), in test_verify_fw_preamble() 213 TEST_EQ(vb2_verify_fw_preamble(h, hsize - 1, &rsa, &wb), in test_verify_fw_preamble() 219 TEST_SUCC(vb2_verify_fw_preamble(h, hsize + 1, &rsa, &wb), in test_verify_fw_preamble() 226 TEST_EQ(vb2_verify_fw_preamble(h, hsize, &rsa, &wb), in test_verify_fw_preamble() 233 TEST_EQ(vb2_verify_fw_preamble(h, hsize, &rsa, &wb), in test_verify_fw_preamble() 240 TEST_SUCC(vb2_verify_fw_preamble(h, hsize, &rsa, &wb), in test_verify_fw_preamble() 246 TEST_EQ(vb2_verify_fw_preamble(h, hsize, &rsa, &wb), in test_verify_fw_preamble() [all …]
|
/external/boringssl/src/include/openssl/ |
D | rsa.h | 84 OPENSSL_EXPORT void RSA_free(RSA *rsa); 87 OPENSSL_EXPORT int RSA_up_ref(RSA *rsa); 95 OPENSSL_EXPORT void RSA_get0_key(const RSA *rsa, const BIGNUM **out_n, 101 OPENSSL_EXPORT void RSA_get0_factors(const RSA *rsa, const BIGNUM **out_p, 109 OPENSSL_EXPORT void RSA_get0_crt_params(const RSA *rsa, const BIGNUM **out_dmp1, 124 OPENSSL_EXPORT int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, 129 OPENSSL_EXPORT int RSA_generate_multi_prime_key(RSA *rsa, int bits, 152 OPENSSL_EXPORT int RSA_encrypt(RSA *rsa, size_t *out_len, uint8_t *out, 171 OPENSSL_EXPORT int RSA_decrypt(RSA *rsa, size_t *out_len, uint8_t *out, 185 uint8_t *to, RSA *rsa, int padding); [all …]
|
/external/boringssl/src/crypto/evp/ |
D | p_rsa_asn1.c | 79 !RSA_marshal_public_key(&key_bitstring, key->pkey.rsa) || in rsa_pub_encode() 106 RSA *rsa = RSA_parse_public_key_buggy(key); in rsa_pub_decode() local 107 if (rsa == NULL || CBS_len(key) != 0) { in rsa_pub_decode() 109 RSA_free(rsa); in rsa_pub_decode() 113 EVP_PKEY_assign_RSA(out, rsa); in rsa_pub_decode() 118 return BN_cmp(b->pkey.rsa->n, a->pkey.rsa->n) == 0 && in rsa_pub_cmp() 119 BN_cmp(b->pkey.rsa->e, a->pkey.rsa->e) == 0; in rsa_pub_cmp() 131 !RSA_marshal_private_key(&private_key, key->pkey.rsa) || in rsa_priv_encode() 150 RSA *rsa = RSA_parse_private_key(key); in rsa_priv_decode() local 151 if (rsa == NULL || CBS_len(key) != 0) { in rsa_priv_decode() [all …]
|
D | print.c | 136 static int do_rsa_print(BIO *out, const RSA *rsa, int off, in do_rsa_print() argument 143 update_buflen(rsa->n, &buf_len); in do_rsa_print() 144 update_buflen(rsa->e, &buf_len); in do_rsa_print() 147 update_buflen(rsa->d, &buf_len); in do_rsa_print() 148 update_buflen(rsa->p, &buf_len); in do_rsa_print() 149 update_buflen(rsa->q, &buf_len); in do_rsa_print() 150 update_buflen(rsa->dmp1, &buf_len); in do_rsa_print() 151 update_buflen(rsa->dmq1, &buf_len); in do_rsa_print() 152 update_buflen(rsa->iqmp, &buf_len); in do_rsa_print() 154 if (rsa->additional_primes != NULL) { in do_rsa_print() [all …]
|
D | p_rsa.c | 169 RSA *rsa = ctx->pkey->pkey.rsa; in pkey_rsa_sign() local 197 if (!RSA_sign(EVP_MD_type(rctx->md), tbs, tbslen, sig, &out_len, rsa)) { in pkey_rsa_sign() 205 !RSA_padding_add_PKCS1_PSS_mgf1(rsa, rctx->tbuf, tbs, rctx->md, in pkey_rsa_sign() 207 !RSA_sign_raw(rsa, siglen, sig, *siglen, rctx->tbuf, key_len, in pkey_rsa_sign() 218 return RSA_sign_raw(rsa, siglen, sig, *siglen, tbs, tbslen, rctx->pad_mode); in pkey_rsa_sign() 225 RSA *rsa = ctx->pkey->pkey.rsa; in pkey_rsa_verify() local 232 return RSA_verify(EVP_MD_type(rctx->md), tbs, tbslen, sig, siglen, rsa); in pkey_rsa_verify() 241 !RSA_verify_raw(rsa, &rslen, rctx->tbuf, key_len, sig, siglen, in pkey_rsa_verify() 243 !RSA_verify_PKCS1_PSS_mgf1(rsa, tbs, rctx->md, rctx->mgf1md, in pkey_rsa_verify() 255 !RSA_verify_raw(rsa, &rslen, rctx->tbuf, key_len, sig, siglen, in pkey_rsa_verify() [all …]
|
/external/openssh/ |
D | sshconnect1.c | 100 packet_put_bignum(idlist->keys[i]->rsa->n); in try_agent_authentication() 235 packet_put_bignum(public->rsa->n); in try_rsa_authentication() 314 respond_to_rsa_challenge(challenge, private->rsa); in try_rsa_authentication() 350 packet_put_int(BN_num_bits(host_key->rsa->n)); in try_rhosts_rsa_authentication() 351 packet_put_bignum(host_key->rsa->e); in try_rhosts_rsa_authentication() 352 packet_put_bignum(host_key->rsa->n); in try_rhosts_rsa_authentication() 378 respond_to_rsa_challenge(challenge, host_key->rsa); in try_rhosts_rsa_authentication() 519 packet_get_bignum(server_key->rsa->e); in ssh_kex() 520 packet_get_bignum(server_key->rsa->n); in ssh_kex() 522 rbits = BN_num_bits(server_key->rsa->n); in ssh_kex() [all …]
|
D | ssh-pkcs11.c | 69 int (*orig_finish)(RSA *rsa); 175 pkcs11_rsa_finish(RSA *rsa) in pkcs11_rsa_finish() argument 180 if ((k11 = RSA_get_app_data(rsa)) != NULL) { in pkcs11_rsa_finish() 182 rv = k11->orig_finish(rsa); in pkcs11_rsa_finish() 221 pkcs11_rsa_private_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa, in pkcs11_rsa_private_encrypt() argument 246 if ((k11 = RSA_get_app_data(rsa)) == NULL) { in pkcs11_rsa_private_encrypt() 247 error("RSA_get_app_data failed for rsa %p", rsa); in pkcs11_rsa_private_encrypt() 251 error("no pkcs11 (valid) provider for rsa %p", rsa); in pkcs11_rsa_private_encrypt() 294 tlen = RSA_size(rsa); in pkcs11_rsa_private_encrypt() 305 pkcs11_rsa_private_decrypt(int flen, const u_char *from, u_char *to, RSA *rsa, in pkcs11_rsa_private_decrypt() argument [all …]
|
D | sshkey.c | 272 return BN_num_bits(k->rsa->n); in sshkey_size() 462 RSA *rsa; in sshkey_new() local 472 k->rsa = NULL; in sshkey_new() 481 if ((rsa = RSA_new()) == NULL || in sshkey_new() 482 (rsa->n = BN_new()) == NULL || in sshkey_new() 483 (rsa->e = BN_new()) == NULL) { in sshkey_new() 484 if (rsa != NULL) in sshkey_new() 485 RSA_free(rsa); in sshkey_new() 489 k->rsa = rsa; in sshkey_new() 541 if (bn_maybe_alloc_failed(k->rsa->d) || in sshkey_add_private() [all …]
|
D | rsa.c | 162 rsa_generate_additional_parameters(RSA *rsa) in rsa_generate_additional_parameters() argument 175 if ((BN_sub(aux, rsa->q, BN_value_one()) == 0) || in rsa_generate_additional_parameters() 176 (BN_mod(rsa->dmq1, rsa->d, aux, ctx) == 0) || in rsa_generate_additional_parameters() 177 (BN_sub(aux, rsa->p, BN_value_one()) == 0) || in rsa_generate_additional_parameters() 178 (BN_mod(rsa->dmp1, rsa->d, aux, ctx) == 0)) { in rsa_generate_additional_parameters()
|
D | ssh-rsa.c | 56 if (key == NULL || key->rsa == NULL || in ssh_rsa_sign() 59 slen = RSA_size(key->rsa); in ssh_rsa_sign() 77 if (RSA_sign(nid, digest, dlen, sig, &len, key->rsa) != 1) { in ssh_rsa_sign() 130 if (key == NULL || key->rsa == NULL || in ssh_rsa_verify() 132 BN_num_bits(key->rsa->n) < SSH_RSA_MINIMUM_MODULUS_SIZE) in ssh_rsa_verify() 154 modlen = RSA_size(key->rsa); in ssh_rsa_verify() 180 key->rsa); in ssh_rsa_verify() 214 u_char *sigbuf, size_t siglen, RSA *rsa) in openssh_RSA_verify() argument 235 rsasize = RSA_size(rsa); in openssh_RSA_verify() 245 if ((len = RSA_public_decrypt(siglen, sigbuf, decrypted, rsa, in openssh_RSA_verify()
|
/external/boringssl/src/decrepit/rsa/ |
D | rsa_decrepit.c | 69 RSA *rsa = RSA_new(); in RSA_generate_key() local 72 if (rsa == NULL || in RSA_generate_key() 75 !RSA_generate_key_ex(rsa, bits, e, NULL)) { in RSA_generate_key() 80 return rsa; in RSA_generate_key() 84 RSA_free(rsa); in RSA_generate_key() 88 int RSA_padding_add_PKCS1_PSS(RSA *rsa, uint8_t *EM, const uint8_t *mHash, in RSA_padding_add_PKCS1_PSS() argument 90 return RSA_padding_add_PKCS1_PSS_mgf1(rsa, EM, mHash, Hash, NULL, sLen); in RSA_padding_add_PKCS1_PSS() 93 int RSA_verify_PKCS1_PSS(RSA *rsa, const uint8_t *mHash, const EVP_MD *Hash, in RSA_verify_PKCS1_PSS() argument 95 return RSA_verify_PKCS1_PSS_mgf1(rsa, mHash, Hash, NULL, EM, sLen); in RSA_verify_PKCS1_PSS()
|
/external/boringssl/src/crypto/x509/ |
D | x_all.c | 202 RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa) in d2i_RSAPrivateKey_fp() argument 204 return ASN1_d2i_fp_of(RSA, RSA_new, d2i_RSAPrivateKey, fp, rsa); in d2i_RSAPrivateKey_fp() 207 int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa) in i2d_RSAPrivateKey_fp() argument 209 return ASN1_i2d_fp_of_const(RSA, i2d_RSAPrivateKey, fp, rsa); in i2d_RSAPrivateKey_fp() 212 RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa) in d2i_RSAPublicKey_fp() argument 214 return ASN1_d2i_fp_of(RSA, RSA_new, d2i_RSAPublicKey, fp, rsa); in d2i_RSAPublicKey_fp() 217 RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa) in d2i_RSA_PUBKEY_fp() argument 221 (void **)rsa); in d2i_RSA_PUBKEY_fp() 224 int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa) in i2d_RSAPublicKey_fp() argument 226 return ASN1_i2d_fp_of_const(RSA, i2d_RSAPublicKey, fp, rsa); in i2d_RSAPublicKey_fp() [all …]
|
/external/boringssl/src/crypto/pem/ |
D | pem_all.c | 122 static RSA *pkey_get_rsa(EVP_PKEY *key, RSA **rsa); 137 static RSA *pkey_get_rsa(EVP_PKEY *key, RSA **rsa) in IMPLEMENT_PEM_rw() 146 if (rsa) { in IMPLEMENT_PEM_rw() 147 RSA_free(*rsa); in IMPLEMENT_PEM_rw() 148 *rsa = rtmp; in IMPLEMENT_PEM_rw() 153 RSA *PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **rsa, pem_password_cb *cb, in PEM_read_bio_RSAPrivateKey() argument 158 return pkey_get_rsa(pktmp, rsa); in PEM_read_bio_RSAPrivateKey() 163 RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **rsa, pem_password_cb *cb, void *u) in PEM_read_RSAPrivateKey() argument 167 return pkey_get_rsa(pktmp, rsa); in PEM_read_RSAPrivateKey()
|
/external/boringssl/src/ssl/test/runner/ |
D | sign.go | 102 _, ok := key.(*rsa.PrivateKey) 107 rsaKey, ok := key.(*rsa.PrivateKey) 112 return rsa.SignPKCS1v15(config.rand(), rsaKey, r.hash, r.computeHash(msg)) 116 rsaKey, ok := key.(*rsa.PublicKey) 121 return rsa.VerifyPKCS1v15(rsaKey, r.hash, r.computeHash(msg), sig) 212 var pssOptions = rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash} 219 _, ok := key.(*rsa.PrivateKey) 224 rsaKey, ok := key.(*rsa.PrivateKey) 231 return rsa.SignPSS(config.rand(), rsaKey, r.hash, h.Sum(nil), &pssOptions) 235 rsaKey, ok := key.(*rsa.PublicKey) [all …]
|
/external/webrtc/webrtc/base/ |
D | sslidentity.cc | 44 params_.rsa.mod_size = kRsaDefaultModSize; in KeyParams() 45 params_.rsa.pub_exp = kRsaDefaultExponent; in KeyParams() 54 kt.params_.rsa.mod_size = mod_size; in RSA() 55 kt.params_.rsa.pub_exp = pub_exp; in RSA() 68 return (params_.rsa.mod_size >= kRsaMinModSize && in IsValid() 69 params_.rsa.mod_size <= kRsaMaxModSize && in IsValid() 70 params_.rsa.pub_exp > params_.rsa.mod_size); in IsValid() 79 return params_.rsa; in rsa_params()
|
/external/curl/docs/examples/ |
D | usercertinmem.c | 50 RSA *rsa = NULL; in sslctx_function() local 148 rsa = PEM_read_bio_RSAPrivateKey(kbio, NULL, 0, NULL); in sslctx_function() 149 if(rsa == NULL) { in sslctx_function() 154 ret = SSL_CTX_use_RSAPrivateKey((SSL_CTX*)sslctx, rsa); in sslctx_function() 166 if(rsa) in sslctx_function() 167 RSA_free(rsa); in sslctx_function()
|
/external/google-tv-pairing-protocol/cpp/tests/polo/util/ |
D | certificateutiltest.cc | 73 RSA* rsa = PEM_read_bio_RSAPrivateKey(rsa_bio, NULL, NULL, NULL); in TEST() local 76 EVP_PKEY_assign_RSA(pkey, rsa); in TEST() 139 RSA* rsa = EVP_PKEY_get1_RSA(pkey); in TEST() local 140 ASSERT_TRUE(rsa); in TEST() 148 RSA* rsa = RSA_generate_key(1025, RSA_F4, NULL, NULL); in TEST() local 149 EVP_PKEY_assign_RSA(pkey, rsa); in TEST()
|
/external/boringssl/src/ssl/ |
D | ssl_file.c | 296 RSA *rsa = NULL; in SSL_use_RSAPrivateKey_file() local 311 rsa = d2i_RSAPrivateKey_bio(in, NULL); in SSL_use_RSAPrivateKey_file() 314 rsa = in SSL_use_RSAPrivateKey_file() 322 if (rsa == NULL) { in SSL_use_RSAPrivateKey_file() 326 ret = SSL_use_RSAPrivateKey(ssl, rsa); in SSL_use_RSAPrivateKey_file() 327 RSA_free(rsa); in SSL_use_RSAPrivateKey_file() 419 RSA *rsa = NULL; in SSL_CTX_use_RSAPrivateKey_file() local 434 rsa = d2i_RSAPrivateKey_bio(in, NULL); in SSL_CTX_use_RSAPrivateKey_file() 437 rsa = PEM_read_bio_RSAPrivateKey(in, NULL, ctx->default_passwd_callback, in SSL_CTX_use_RSAPrivateKey_file() 444 if (rsa == NULL) { in SSL_CTX_use_RSAPrivateKey_file() [all …]
|