Home
last modified time | relevance | path

Searched refs:rsa (Results 1 – 25 of 139) sorted by relevance

123456

/external/boringssl/src/crypto/fipsmodule/rsa/
Drsa_impl.c75 static int check_modulus_and_exponent_sizes(const RSA *rsa) { in check_modulus_and_exponent_sizes() argument
76 unsigned rsa_bits = BN_num_bits(rsa->n); in check_modulus_and_exponent_sizes()
94 if (BN_num_bits(rsa->e) > kMaxExponentBits) { in check_modulus_and_exponent_sizes()
107 assert(BN_ucmp(rsa->n, rsa->e) > 0); in check_modulus_and_exponent_sizes()
112 size_t rsa_default_size(const RSA *rsa) { in rsa_default_size() argument
113 return BN_num_bytes(rsa->n); in rsa_default_size()
116 int RSA_encrypt(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, in RSA_encrypt() argument
118 if (rsa->n == NULL || rsa->e == NULL) { in RSA_encrypt()
123 const unsigned rsa_size = RSA_size(rsa); in RSA_encrypt()
134 if (!check_modulus_and_exponent_sizes(rsa)) { in RSA_encrypt()
[all …]
Drsa.c84 RSA *rsa = OPENSSL_malloc(sizeof(RSA)); in RSA_new_method() local
85 if (rsa == NULL) { in RSA_new_method()
90 OPENSSL_memset(rsa, 0, sizeof(RSA)); in RSA_new_method()
93 rsa->meth = ENGINE_get_RSA_method(engine); in RSA_new_method()
96 if (rsa->meth == NULL) { in RSA_new_method()
97 rsa->meth = (RSA_METHOD *) RSA_default_method(); in RSA_new_method()
99 METHOD_ref(rsa->meth); in RSA_new_method()
101 rsa->references = 1; in RSA_new_method()
102 rsa->flags = rsa->meth->flags; in RSA_new_method()
103 CRYPTO_MUTEX_init(&rsa->lock); in RSA_new_method()
[all …]
Dinternal.h74 size_t rsa_default_size(const RSA *rsa);
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,
113 int RSA_private_transform(RSA *rsa, uint8_t *out, const uint8_t *in,
/external/vboot_reference/tests/
Dvboot_common2_tests.c21 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 …]
Dvboot_common3_tests.c172 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 …]
Dvb20_common3_tests.c178 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/
Drsa.h84 OPENSSL_EXPORT void RSA_free(RSA *rsa);
87 OPENSSL_EXPORT int RSA_up_ref(RSA *rsa);
93 OPENSSL_EXPORT unsigned RSA_bits(const RSA *rsa);
98 OPENSSL_EXPORT void RSA_get0_key(const RSA *rsa, const BIGNUM **out_n,
103 OPENSSL_EXPORT void RSA_get0_factors(const RSA *rsa, const BIGNUM **out_p,
110 OPENSSL_EXPORT void RSA_get0_crt_params(const RSA *rsa, const BIGNUM **out_dmp1,
120 OPENSSL_EXPORT int RSA_set0_key(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d);
127 OPENSSL_EXPORT int RSA_set0_factors(RSA *rsa, BIGNUM *p, BIGNUM *q);
134 OPENSSL_EXPORT int RSA_set0_crt_params(RSA *rsa, BIGNUM *dmp1, BIGNUM *dmq1,
148 OPENSSL_EXPORT int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e,
[all …]
/external/boringssl/src/crypto/rsa_extra/
Drsa_test.cc462 bssl::UniquePtr<RSA> rsa( in TEST() local
464 ASSERT_TRUE(rsa); in TEST()
466 EXPECT_TRUE(RSA_check_key(rsa.get())); in TEST()
471 rsa.get(), &out_len, out, sizeof(out), kTwoPrimeEncryptedMessage, in TEST()
477 bssl::UniquePtr<RSA> rsa( in TEST() local
479 ASSERT_TRUE(rsa); in TEST()
480 EXPECT_TRUE(RSA_check_fips(rsa.get())); in TEST()
490 bssl::UniquePtr<RSA> rsa(RSA_new()); in TEST() local
491 ASSERT_TRUE(rsa); in TEST()
494 EXPECT_FALSE(RSA_generate_key_fips(rsa.get(), 512, nullptr)); in TEST()
[all …]
Drsa_asn1.c127 int RSA_marshal_public_key(CBB *cbb, const RSA *rsa) { in RSA_marshal_public_key() argument
130 !marshal_integer(&child, rsa->n) || in RSA_marshal_public_key()
131 !marshal_integer(&child, rsa->e) || in RSA_marshal_public_key()
140 const RSA *rsa) { in RSA_public_key_to_bytes() argument
144 !RSA_marshal_public_key(&cbb, rsa) || in RSA_public_key_to_bytes()
216 int RSA_marshal_private_key(CBB *cbb, const RSA *rsa) { in RSA_marshal_private_key() argument
220 !marshal_integer(&child, rsa->n) || in RSA_marshal_private_key()
221 !marshal_integer(&child, rsa->e) || in RSA_marshal_private_key()
222 !marshal_integer(&child, rsa->d) || in RSA_marshal_private_key()
223 !marshal_integer(&child, rsa->p) || in RSA_marshal_private_key()
[all …]
/external/boringssl/src/crypto/evp/
Dp_rsa_asn1.c79 !RSA_marshal_public_key(&key_bitstring, key->pkey.rsa) || in rsa_pub_encode()
100 RSA *rsa = RSA_parse_public_key(key); in rsa_pub_decode() local
101 if (rsa == NULL || CBS_len(key) != 0) { in rsa_pub_decode()
103 RSA_free(rsa); in rsa_pub_decode()
107 EVP_PKEY_assign_RSA(out, rsa); in rsa_pub_decode()
112 return BN_cmp(b->pkey.rsa->n, a->pkey.rsa->n) == 0 && in rsa_pub_cmp()
113 BN_cmp(b->pkey.rsa->e, a->pkey.rsa->e) == 0; in rsa_pub_cmp()
125 !RSA_marshal_private_key(&private_key, key->pkey.rsa) || in rsa_priv_encode()
144 RSA *rsa = RSA_parse_private_key(key); in rsa_priv_decode() local
145 if (rsa == NULL || CBS_len(key) != 0) { in rsa_priv_decode()
[all …]
Dp_rsa.c174 RSA *rsa = ctx->pkey->pkey.rsa; in pkey_rsa_sign() local
191 if (!RSA_sign(EVP_MD_type(rctx->md), tbs, tbslen, sig, &out_len, rsa)) { in pkey_rsa_sign()
198 return RSA_sign_pss_mgf1(rsa, siglen, sig, *siglen, tbs, tbslen, in pkey_rsa_sign()
206 return RSA_sign_raw(rsa, siglen, sig, *siglen, tbs, tbslen, rctx->pad_mode); in pkey_rsa_sign()
213 RSA *rsa = ctx->pkey->pkey.rsa; in pkey_rsa_verify() local
218 return RSA_verify(EVP_MD_type(rctx->md), tbs, tbslen, sig, siglen, rsa); in pkey_rsa_verify()
221 return RSA_verify_pss_mgf1(rsa, tbs, tbslen, rctx->md, rctx->mgf1md, in pkey_rsa_verify()
232 !RSA_verify_raw(rsa, &rslen, rctx->tbuf, key_len, sig, siglen, in pkey_rsa_verify()
246 RSA *rsa = ctx->pkey->pkey.rsa; in pkey_rsa_verify_recover() local
260 return RSA_verify_raw(rsa, out_len, out, *out_len, sig, sig_len, in pkey_rsa_verify_recover()
[all …]
Dprint.c136 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()
161 if (rsa->n != NULL) { in do_rsa_print()
[all …]
/external/boringssl/src/decrepit/rsa/
Drsa_decrepit.c69 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/
Dx_all.c202 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/nos/host/android/hals/keymaster/test/
Dimport_key_test.cpp126 const hidl_vec<KeyParameter>& params, const RSA *rsa) in ImportKeyRequestMatcher() argument
128 rsa_(rsa), in ImportKeyRequestMatcher()
199 if (request.rsa().e() != BN_get_word(e)) { in MatchAndExplainRSA()
203 << request.rsa().e(); in MatchAndExplainRSA()
213 if (request.rsa().d().size() != BN_num_bytes(n) && in MatchAndExplainRSA()
214 memcmp(request.rsa().d().data(), d_buf.get(), in MatchAndExplainRSA()
225 if (request.rsa().n().size() != BN_num_bytes(n) && in MatchAndExplainRSA()
226 memcmp(request.rsa().n().data(), n_buf.get(), in MatchAndExplainRSA()
333 const hidl_vec<KeyParameter>& params, const RSA *rsa) { in ImportKeyRequestEq() argument
334 return MakeMatcher(new ImportKeyRequestMatcher(params, rsa)); in ImportKeyRequestEq()
[all …]
/external/boringssl/src/crypto/pem/
Dpem_all.c122 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/
Dssl_privkey.cc254 RSA *rsa = EVP_PKEY_get0_RSA(ssl->cert->privatekey); in ssl_private_key_decrypt() local
255 if (rsa == NULL) { in ssl_private_key_decrypt()
263 if (!RSA_decrypt(rsa, out_len, out, max_out, in.data(), in.size(), in ssl_private_key_decrypt()
296 int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa) { in SSL_use_RSAPrivateKey() argument
297 if (rsa == NULL) { in SSL_use_RSAPrivateKey()
304 !EVP_PKEY_set1_RSA(pkey.get(), rsa)) { in SSL_use_RSAPrivateKey()
313 UniquePtr<RSA> rsa(RSA_private_key_from_bytes(der, der_len)); in SSL_use_RSAPrivateKey_ASN1() local
314 if (!rsa) { in SSL_use_RSAPrivateKey_ASN1()
319 return SSL_use_RSAPrivateKey(ssl, rsa.get()); in SSL_use_RSAPrivateKey_ASN1()
348 int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa) { in SSL_CTX_use_RSAPrivateKey() argument
[all …]
Dssl_file.cc296 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 …]
/external/boringssl/src/ssl/test/runner/
Dsign.go104 _, ok := key.(*rsa.PrivateKey)
109 rsaKey, ok := key.(*rsa.PrivateKey)
114 return rsa.SignPKCS1v15(config.rand(), rsaKey, r.hash, r.computeHash(msg))
118 rsaKey, ok := key.(*rsa.PublicKey)
123 return rsa.VerifyPKCS1v15(rsaKey, r.hash, r.computeHash(msg), sig)
214 var pssOptions = rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash}
221 _, ok := key.(*rsa.PrivateKey)
226 rsaKey, ok := key.(*rsa.PrivateKey)
233 return rsa.SignPSS(config.rand(), rsaKey, r.hash, h.Sum(nil), &pssOptions)
237 rsaKey, ok := key.(*rsa.PublicKey)
[all …]
/external/boringssl/src/crypto/fipsmodule/self_check/
Dself_check.c178 RSA *rsa = RSA_new(); in self_test_rsa_key() local
179 if (rsa == NULL || in self_test_rsa_key()
180 !set_bignum(&rsa->n, kN, sizeof(kN)) || in self_test_rsa_key()
181 !set_bignum(&rsa->e, kE, sizeof(kE)) || in self_test_rsa_key()
182 !set_bignum(&rsa->d, kD, sizeof(kD)) || in self_test_rsa_key()
183 !set_bignum(&rsa->p, kP, sizeof(kP)) || in self_test_rsa_key()
184 !set_bignum(&rsa->q, kQ, sizeof(kQ)) || in self_test_rsa_key()
185 !set_bignum(&rsa->dmp1, kDModPMinusOne, sizeof(kDModPMinusOne)) || in self_test_rsa_key()
186 !set_bignum(&rsa->dmq1, kDModQMinusOne, sizeof(kDModQMinusOne)) || in self_test_rsa_key()
187 !set_bignum(&rsa->iqmp, kQInverseModP, sizeof(kQInverseModP))) { in self_test_rsa_key()
[all …]
/external/nos/test/system-test-harness/src/
Dkeymaster-import-wrapped-key-tests.cc211 blob.b.key.rsa.rsa.e = 65537; in TEST_F()
212 blob.b.key.rsa.rsa.N.dmax = sizeof(wrapping_key_N) / sizeof(uint32_t); in TEST_F()
213 blob.b.key.rsa.rsa.d.dmax = sizeof(wrapping_key_D) / sizeof(uint32_t); in TEST_F()
215 memcpy(&blob.b.key.rsa.N_bytes, wrapping_key_N, sizeof(wrapping_key_N)); in TEST_F()
216 memcpy(&blob.b.key.rsa.d_bytes, wrapping_key_D, sizeof(wrapping_key_D)); in TEST_F()
/external/webrtc/webrtc/base/
Dsslidentity.cc44 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/
Dusercertinmem.c49 RSA *rsa = NULL; in sslctx_function() local
147 rsa = PEM_read_bio_RSAPrivateKey(kbio, NULL, 0, NULL); in sslctx_function()
148 if(rsa == NULL) { in sslctx_function()
153 ret = SSL_CTX_use_RSAPrivateKey((SSL_CTX*)sslctx, rsa); in sslctx_function()
165 if(rsa) in sslctx_function()
166 RSA_free(rsa); in sslctx_function()
/external/google-tv-pairing-protocol/cpp/tests/polo/util/
Dcertificateutiltest.cc73 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/vboot_reference/firmware/lib/
Dvboot_common.c125 RSAPublicKey *rsa; in PublicKeyToRSA() local
138 rsa = RSAPublicKeyFromBuf(GetPublicKeyDataC(key), key->key_size); in PublicKeyToRSA()
139 if (!rsa) in PublicKeyToRSA()
142 rsa->algorithm = (unsigned int)key->algorithm; in PublicKeyToRSA()
143 return rsa; in PublicKeyToRSA()
255 RSAPublicKey *rsa; in KeyBlockVerify() local
265 rsa = PublicKeyToRSA(key); in KeyBlockVerify()
266 if (!rsa) { in KeyBlockVerify()
274 RSAPublicKeyFree(rsa); in KeyBlockVerify()
279 rv = VerifyData((const uint8_t *)block, size, sig, rsa); in KeyBlockVerify()
[all …]

123456