Home
last modified time | relevance | path

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

12

/system/extras/verity/
Dgenerate_verity_key.c66 RSA *rsa = NULL; in convert_x509() local
91 rsa = EVP_PKEY_get1_RSA(pkey); in convert_x509()
92 if (!rsa) { in convert_x509()
97 if (write_public_keyfile(rsa, key_file) < 0) { in convert_x509()
114 if (rsa) { in convert_x509()
115 RSA_free(rsa); in convert_x509()
125 RSA* rsa = RSA_new(); in generate_key() local
129 if (!pkey || !exponent || !rsa) { in generate_key()
135 RSA_generate_key_ex(rsa, 2048, exponent, NULL); in generate_key()
136 EVP_PKEY_set1_RSA(pkey, rsa); in generate_key()
[all …]
/system/keymint/boringssl/src/
Drsa.rs9 rsa::{DecryptionMode, SignMode, PKCS1_UNDIGESTED_SIGNATURE_PADDING_OVERHEAD},
60 openssl::rsa::Rsa::generate_with_e(key_size.0, &exponent).map_err(openssl_err!( in generate_key()
66 Ok(crypto::KeyMaterial::Rsa(crypto::rsa::Key(asn1_data).into())) in generate_key()
71 key: OpaqueOr<crypto::rsa::Key>, in begin_decrypt()
81 key: OpaqueOr<crypto::rsa::Key>, in begin_sign()
86 SignMode::NoPadding => openssl::rsa::Padding::NONE, in begin_sign()
87 SignMode::Pkcs1_1_5Padding(_) => openssl::rsa::Padding::PKCS1, in begin_sign()
88 SignMode::PssPadding(_) => openssl::rsa::Padding::PKCS1_PSS, in begin_sign()
108 key: crypto::rsa::Key,
125 let rsa_key = ossl!(openssl::rsa::Rsa::private_key_from_der(&self.key.0))?; in finish()
[all …]
Dlib.rs25 pub mod rsa; module
/system/keymaster/legacy_support/
Dkeymaster1_engine.cpp132 unique_ptr<RSA, RSA_Delete> rsa(RSA_new_method(engine_.get())); in BuildRsaKey() local
133 if (!rsa) { in BuildRsaKey()
139 if (!RSA_set_ex_data(rsa.get(), rsa_index_, key_data)) { in BuildRsaKey()
156 rsa->n = BN_dup(public_rsa->n); in BuildRsaKey()
157 rsa->e = BN_dup(public_rsa->e); in BuildRsaKey()
158 if (!rsa->n || !rsa->e) { in BuildRsaKey()
164 return rsa.release(); in BuildRsaKey()
208 unique_ptr<RSA, RSA_Delete> rsa(EVP_PKEY_get1_RSA(key)); in GetData() local
209 return GetData(rsa.get()); in GetData()
222 Keymaster1Engine::KeyData* Keymaster1Engine::GetData(const RSA* rsa) const { in GetData()
[all …]
Drsa_keymaster1_operation.cpp126 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> rsa(GetEvpKey(rsa_km1_key, error)); in CreateOperation() local
127 if (!rsa) return nullptr; in CreateOperation()
132 key.hw_enforced_move(), key.sw_enforced_move(), digest, padding, rsa.release(), in CreateOperation()
136 key.hw_enforced_move(), key.sw_enforced_move(), digest, padding, rsa.release(), in CreateOperation()
Drsa_keymaster1_key.cpp122 RSA_Ptr rsa(engine_->BuildRsaKey(key_material, additional_params, &error)); in LoadKey() local
123 if (!rsa.get()) return error; in LoadKey()
126 RsaKeymaster1Key(rsa.release(), std::move(hw_enforced), std::move(sw_enforced), in LoadKey()
/system/keymaster/include/keymaster/legacy_support/
Dkeymaster1_engine.h75 KeyData* GetData(const RSA* rsa) const;
76 KeyData* GetData(const EC_KEY* rsa) const;
103 static int rsa_sign_raw(RSA* rsa, size_t* out_len, uint8_t* out, size_t max_out,
105 static int rsa_decrypt(RSA* rsa, size_t* out_len, uint8_t* out, size_t max_out,
/system/keymaster/km_openssl/
Drsa_operation.cpp78 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> rsa(GetRsaKey(key, error)); in CreateRsaOperation() local
79 if (!rsa.get()) return nullptr; in CreateRsaOperation()
82 padding, rsa.release()); in CreateRsaOperation()
333 UniquePtr<RSA, RSA_Delete> rsa(EVP_PKEY_get1_RSA(const_cast<EVP_PKEY*>(rsa_key_))); in SignUndigested() local
334 if (!rsa.get()) return TranslateLastOpenSslError(); in SignUndigested()
336 if (!output->Reinitialize(RSA_size(rsa.get()))) return KM_ERROR_MEMORY_ALLOCATION_FAILED; in SignUndigested()
351 bytes_encrypted = RSA_private_encrypt(key_len, to_encrypt, output->peek_write(), rsa.get(), in SignUndigested()
363 output->peek_write(), rsa.get(), RSA_PKCS1_PADDING); in SignUndigested()
430 UniquePtr<RSA, RSA_Delete> rsa(EVP_PKEY_get1_RSA(const_cast<EVP_PKEY*>(rsa_key_))); in VerifyUndigested() local
431 if (!rsa.get()) return KM_ERROR_UNKNOWN_ERROR; in VerifyUndigested()
[all …]
/system/keymint/common/src/crypto/
Dtraits.rs31 pub rsa: &'a dyn Rsa, field
244 rsa::import_pkcs8_key(data) in import_pkcs8_key()
255 fn subject_public_key(&self, key: &OpaqueOr<rsa::Key>) -> Result<Vec<u8>, Error> { in subject_public_key()
264 key: OpaqueOr<rsa::Key>, in begin_decrypt()
265 mode: rsa::DecryptionMode, in begin_decrypt()
274 key: OpaqueOr<rsa::Key>, in begin_sign()
275 mode: rsa::SignMode, in begin_sign()
572 _key: OpaqueOr<rsa::Key>, in begin_decrypt()
573 _mode: rsa::DecryptionMode, in begin_decrypt()
580 _key: OpaqueOr<rsa::Key>, in begin_sign()
[all …]
Drsa.rs109 rsa: &dyn super::Rsa, in subject_public_key_info()
111 let pub_key = rsa.subject_public_key(self)?; in subject_public_key_info()
/system/security/keystore-engine/
Dkeystore2_engine.cpp85 extern "C" int rsa_private_transform(RSA* rsa, uint8_t* out, const uint8_t* in, size_t len);
137 bssl::UniquePtr<RSA> rsa(RSA_new_method(Keystore2Engine::get().engine())); in wrap_rsa() local
138 if (rsa.get() == nullptr) { in wrap_rsa()
144 if (!RSA_set_ex_data(rsa.get(), Keystore2Engine::get().rsa_ex_index(), key_backend_copy)) { in wrap_rsa()
151 if (n == nullptr || e == nullptr || !RSA_set0_key(rsa.get(), n.get(), e.get(), nullptr)) { in wrap_rsa()
158 if (result.get() == nullptr || !EVP_PKEY_assign_RSA(result.get(), rsa.get())) { in wrap_rsa()
161 OWNERSHIP_TRANSFERRED(rsa); in wrap_rsa()
261 extern "C" int rsa_private_transform(RSA* rsa, uint8_t* out, const uint8_t* in, size_t len) { in rsa_private_transform() argument
263 RSA_get_ex_data(rsa, Keystore2Engine::get().rsa_ex_index())); in rsa_private_transform()
/system/keymaster/include/keymaster/km_openssl/
Drsa_key.h50 RsaKey(RSA* rsa, AuthorizationSet hw_enforced, AuthorizationSet sw_enforced, in RsaKey() argument
52 : AsymmetricKey(std::move(hw_enforced), std::move(sw_enforced), key_factory), rsa_key_(rsa) in RsaKey()
/system/update_engine/payload_consumer/
Dpayload_verifier.cc203 RSA* rsa = EVP_PKEY_get0_RSA(const_cast<EVP_PKEY*>(public_key)); in GetRawHashFromSignature() local
205 TEST_AND_RETURN_FALSE(rsa != nullptr); in GetRawHashFromSignature()
206 unsigned int keysize = RSA_size(rsa); in GetRawHashFromSignature()
215 sig_data.size(), sig_data.data(), hash_data.data(), rsa, RSA_NO_PADDING); in GetRawHashFromSignature()
Ddelta_performer_integration_test.cc352 RSA* rsa = RSA_new(); in SignGeneratedShellPayload() local
355 ASSERT_EQ(1, RSA_generate_key_ex(rsa, 2048, e, nullptr)); in SignGeneratedShellPayload()
361 fprikey, rsa, nullptr, nullptr, 0, nullptr, nullptr)); in SignGeneratedShellPayload()
363 RSA_free(rsa); in SignGeneratedShellPayload()
/system/security/ondevice-signing/
DCertUtils.cpp316 RSA* rsa = EVP_PKEY_get0_RSA(pkey); in extractPublicKey() local
317 auto num_bytes = BN_num_bytes(RSA_get0_n(rsa)); in extractPublicKey()
319 int res = BN_bn2bin(RSA_get0_n(rsa), pubKey.data()); in extractPublicKey()
356 RSA* rsa = EVP_PKEY_get0_RSA(pkey); in extractRsaPublicKey() local
357 if (rsa == nullptr) { in extractRsaPublicKey()
362 int size = i2d_RSAPublicKey(rsa, &out); in extractRsaPublicKey()
/system/update_engine/payload_generator/
Dpayload_signer.cc297 RSA* rsa = EVP_PKEY_get0_RSA(private_key.get()); in SignHash() local
298 TEST_AND_RETURN_FALSE(rsa != nullptr); in SignHash()
301 PayloadVerifier::PadRSASHA256Hash(&padded_hash, RSA_size(rsa)); in SignHash()
303 signature.resize(RSA_size(rsa)); in SignHash()
307 rsa, in SignHash()
/system/keymaster/key_blob_utils/
Dsoftware_keyblobs.cpp119 RSA_Ptr rsa(EVP_PKEY_get1_RSA(pubkey)); in FakeKeyAuthorizations() local
120 if (!rsa) return TranslateLastOpenSslError(); in FakeKeyAuthorizations()
121 hw_enforced->push_back(TAG_KEY_SIZE, RSA_size(rsa.get()) * 8); in FakeKeyAuthorizations()
122 uint64_t public_exponent = BN_get_word(rsa->e); in FakeKeyAuthorizations()
/system/keymint/common/src/
Dcrypto.rs23 pub mod rsa; module
102 opaque_from_key!(rsa::Key);
118 Rsa(OpaqueOr<rsa::Key>),
166 rsa: &dyn Rsa, in subject_public_key_info()
169 Self::Rsa(key) => Some(key.subject_public_key_info(buf, rsa)?), in subject_public_key_info()
252 Ok(Self::Rsa(rsa::Key(raw_key).into())) in from_cbor_value()
Dtag.rs5 crypto::{rsa::DecryptionMode, *},
280 Algorithm::Rsa => check_rsa_import_params(imp.rsa, params, sec_level, key_format, key_data), in extract_key_import_characteristics()
395 rsa: &dyn Rsa, in check_rsa_import_params()
409 let (key, key_size, public_exponent) = rsa.import_pkcs8_key(key_data, params)?; in check_rsa_import_params()
/system/keymint/ta/src/
Dkeys.rs9 crypto::{self, aes, rsa, KeyMaterial, OpaqueOr},
188 .rsa in sign_cert_data()
189 .begin_sign(key, rsa::SignMode::Pkcs1_1_5Padding(Digest::Sha256))?; in sign_cert_data()
267 self.imp.rsa.generate_key(&mut *self.imp.rng, key_size, pub_exponent, params)? in generate_key_material()
344 self.imp.rsa, in finish_keyblob_creation()
514 let mut crypto_op = self.imp.rsa.begin_decrypt(key, decrypt_mode)?; in import_wrapped_key()
Doperation.rs375 let mode = crypto::rsa::DecryptionMode::new(&params)?; in begin_operation()
376 CryptoOperation::RsaDecrypt(self.imp.rsa.begin_decrypt(key, mode)?) in begin_operation()
379 let mode = crypto::rsa::SignMode::new(&params)?; in begin_operation()
380 CryptoOperation::RsaSign(self.imp.rsa.begin_sign(key, mode)?) in begin_operation()
/system/apex/tools/
Dcreate_apex_skeleton.sh68 openssl req -x509 -config csr.conf -newkey rsa:4096 -nodes -days 999999 -keyout key.pem -out ${APEX…
/system/keymint/tests/src/bin/
Dauth-keyblob-parse.rs148 Algorithm::Rsa => KeyMaterial::Rsa(rsa::Key(raw_key).into()), in process()
/system/update_engine/
DAndroid.bp920 …cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &…
921 …"openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" +
922 …"openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096…
/system/security/keystore2/tests/
Dkeystore2_client_test_utils.rs23 use openssl::rsa::Padding;

12