Home
last modified time | relevance | path

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

12

/system/security/keystore-engine/
Drsa_meth.cpp44 int keystore_rsa_priv_enc(int flen, const unsigned char* from, unsigned char* to, RSA* rsa, in keystore_rsa_priv_enc() argument
46 ALOGV("keystore_rsa_priv_enc(%d, %p, %p, %p, %d)", flen, from, to, rsa, padding); in keystore_rsa_priv_enc()
48 int num = RSA_size(rsa); in keystore_rsa_priv_enc()
76 uint8_t* key_id = reinterpret_cast<uint8_t*>(RSA_get_ex_data(rsa, rsa_key_handle)); in keystore_rsa_priv_enc()
111 ALOGV("rsa=%p keystore_rsa_priv_enc => returning %p len %llu", rsa, to, in keystore_rsa_priv_enc()
116 int keystore_rsa_priv_dec(int flen, const unsigned char* from, unsigned char* to, RSA* rsa, in keystore_rsa_priv_dec() argument
118 ALOGV("keystore_rsa_priv_dec(%d, %p, %p, %p, %d)", flen, from, to, rsa, padding); in keystore_rsa_priv_dec()
120 uint8_t* key_id = reinterpret_cast<uint8_t*>(RSA_get_ex_data(rsa, rsa_key_handle)); in keystore_rsa_priv_dec()
135 int num = RSA_size(rsa); in keystore_rsa_priv_dec()
180 ALOGV("rsa=%p keystore_rsa_priv_dec => returning %p len %d", rsa, to, outSize); in keystore_rsa_priv_dec()
[all …]
Dandroid_engine.cpp130 const char* rsa_get_key_id(const RSA* rsa) { in rsa_get_key_id() argument
132 RSA_get_ex_data(rsa, g_keystore_engine->rsa_ex_index())); in rsa_get_key_id()
139 int rsa_private_transform(RSA *rsa, uint8_t *out, const uint8_t *in, size_t len) { in rsa_private_transform() argument
140 ALOGV("rsa_private_transform(%p, %p, %p, %u)", rsa, out, in, (unsigned) len); in rsa_private_transform()
142 const char *key_id = rsa_get_key_id(rsa); in rsa_private_transform()
191 ALOGV("rsa=%p keystore_rsa_priv_dec successful", rsa); in rsa_private_transform()
324 Unique_RSA rsa(RSA_new_method(g_keystore_engine->engine())); in wrap_rsa() local
325 if (rsa.get() == NULL) { in wrap_rsa()
334 if (!RSA_set_ex_data(rsa.get(), g_keystore_engine->rsa_ex_index(), in wrap_rsa()
340 rsa->n = BN_dup(public_rsa->n); in wrap_rsa()
[all …]
/system/extras/verity/
Dgenerate_verity_key.c40 static int convert_to_mincrypt_format(RSA *rsa, RSAPublicKey *pkey) in convert_to_mincrypt_format() argument
45 if (RSA_size(rsa) != RSANUMBYTES) in convert_to_mincrypt_format()
57 BN_copy(n, rsa->n); in convert_to_mincrypt_format()
71 pkey->exponent = BN_get_word(rsa->e); in convert_to_mincrypt_format()
119 RSA *rsa = NULL; in convert_x509() local
144 rsa = EVP_PKEY_get1_RSA(pkey); in convert_x509()
145 if (!rsa) { in convert_x509()
150 if (write_public_keyfile(rsa, key_file) < 0) { in convert_x509()
167 if (rsa) { in convert_x509()
168 RSA_free(rsa); in convert_x509()
[all …]
Dverify_boot_signature.c317 RSA *rsa = NULL; in verify_signature() local
333 if ((rsa = EVP_PKEY_get1_RSA(pkey)) == NULL) { in verify_signature()
339 bs->signature->data, bs->signature->length, rsa)) { in verify_signature()
351 if (rsa) { in verify_signature()
352 RSA_free(rsa); in verify_signature()
/system/connectivity/shill/shims/
Dcrypto_util.cc80 RSA* rsa = *rsa_ptr; in EncryptByteStringImpl() local
81 if (!rsa) { in EncryptByteStringImpl()
86 vector<unsigned char> rsa_output(RSA_size(rsa)); in EncryptByteStringImpl()
94 rsa, in EncryptByteStringImpl()
121 RSA* rsa = NULL; in EncryptByteString() local
124 message.public_key(), message.data(), &rsa, &encrypted_output); in EncryptByteString()
125 if (rsa) { in EncryptByteString()
126 RSA_free(rsa); in EncryptByteString()
127 rsa = NULL; in EncryptByteString()
176 RSA* rsa = *rsa_ptr; in VerifyCredentialsImpl() local
[all …]
/system/core/adb/
Dadb_auth_host.cpp55 RSA *rsa; member
62 static int RSA_to_RSAPublicKey(RSA *rsa, RSAPublicKey *pkey) in RSA_to_RSAPublicKey() argument
75 if (RSA_size(rsa) != RSANUMBYTES) { in RSA_to_RSAPublicKey()
81 BN_copy(n, rsa->n); in RSA_to_RSAPublicKey()
95 pkey->exponent = BN_get_word(rsa->e); in RSA_to_RSAPublicKey()
215 RSA* rsa = RSA_new(); in generate_key() local
222 if (!pkey || !exponent || !rsa) { in generate_key()
228 RSA_generate_key_ex(rsa, 2048, exponent, NULL); in generate_key()
229 EVP_PKEY_set1_RSA(pkey, rsa); in generate_key()
247 if (!write_public_keyfile(rsa, file)) { in generate_key()
[all …]
/system/keymaster/
Dkeymaster0_engine.cpp182 unique_ptr<RSA, RSA_Delete> rsa(RSA_new_method(engine_)); in BlobToRsaKey() local
183 if (!rsa) in BlobToRsaKey()
187 if (!blob_copy->key_material || !RSA_set_ex_data(rsa.get(), rsa_index_, blob_copy)) in BlobToRsaKey()
197 rsa->n = BN_dup(public_rsa->n); in BlobToRsaKey()
198 rsa->e = BN_dup(public_rsa->e); in BlobToRsaKey()
199 if (!rsa->n || !rsa->e) in BlobToRsaKey()
202 return rsa.release(); in BlobToRsaKey()
231 const keymaster_key_blob_t* Keymaster0Engine::RsaKeyToBlob(const RSA* rsa) const { in RsaKeyToBlob()
232 return reinterpret_cast<keymaster_key_blob_t*>(RSA_get_ex_data(rsa, rsa_index_)); in RsaKeyToBlob()
263 int Keymaster0Engine::rsa_private_transform(RSA* rsa, uint8_t* out, const uint8_t* in, size_t len) { in rsa_private_transform() argument
[all …]
Dkeymaster1_engine.cpp140 unique_ptr<RSA, RSA_Delete> rsa(RSA_new_method(engine_.get())); in BuildRsaKey() local
141 if (!rsa) { in BuildRsaKey()
147 if (!RSA_set_ex_data(rsa.get(), rsa_index_, key_data)) { in BuildRsaKey()
167 rsa->n = BN_dup(public_rsa->n); in BuildRsaKey()
168 rsa->e = BN_dup(public_rsa->e); in BuildRsaKey()
169 if (!rsa->n || !rsa->e) { in BuildRsaKey()
175 return rsa.release(); in BuildRsaKey()
222 unique_ptr<RSA, RSA_Delete> rsa(EVP_PKEY_get1_RSA(key)); in GetData() local
223 return GetData(rsa.get()); in GetData()
236 Keymaster1Engine::KeyData* Keymaster1Engine::GetData(const RSA* rsa) const { in GetData()
[all …]
Dkeymaster0_engine.h59 const keymaster_key_blob_t* RsaKeyToBlob(const RSA* rsa) const;
60 const keymaster_key_blob_t* EcKeyToBlob(const EC_KEY* rsa) const;
74 static int rsa_private_transform(RSA* rsa, uint8_t* out, const uint8_t* in, size_t len);
87 int RsaPrivateTransform(RSA* rsa, uint8_t* out, const uint8_t* in, size_t len) const;
Dkeymaster1_engine.h77 KeyData* GetData(const RSA* rsa) const;
78 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,
Drsa_keymaster1_operation.cpp127 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> rsa(GetEvpKey(rsa_km1_key, error)); in CreateOperation() local
128 if (!rsa) in CreateOperation()
133 return new RsaKeymaster1Operation<RsaSignOperation>(digest, padding, rsa.release(), in CreateOperation()
136 return new RsaKeymaster1Operation<RsaDecryptOperation>(digest, padding, rsa.release(), in CreateOperation()
Drsa_operation.cpp79 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> rsa(GetRsaKey(key, error)); in CreateRsaOperation() local
80 if (!rsa.get()) in CreateRsaOperation()
83 RsaOperation* op = InstantiateOperation(digest, padding, rsa.release()); in CreateRsaOperation()
323 UniquePtr<RSA, RSA_Delete> rsa(EVP_PKEY_get1_RSA(const_cast<EVP_PKEY*>(rsa_key_))); in SignUndigested() local
324 if (!rsa.get()) in SignUndigested()
327 if (!output->Reinitialize(RSA_size(rsa.get()))) in SignUndigested()
344 bytes_encrypted = RSA_private_encrypt(key_len, to_encrypt, output->peek_write(), rsa.get(), in SignUndigested()
356 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()) in VerifyUndigested()
[all …]
Drsa_key.h45 RsaKey(RSA* rsa, const AuthorizationSet& hw_enforced, const AuthorizationSet& sw_enforced, in RsaKey() argument
47 : AsymmetricKey(hw_enforced, sw_enforced, error), rsa_key_(rsa) {} in RsaKey()
Drsa_keymaster1_key.cpp113 unique_ptr<RSA, RSA_Delete> rsa(engine_->BuildRsaKey(key_material, additional_params, &error)); in LoadKey() local
114 if (!rsa) in LoadKey()
118 RsaKeymaster1Key(rsa.release(), hw_enforced, sw_enforced, &error)); in LoadKey()
Drsa_keymaster0_key.cpp112 unique_ptr<RSA, RSA_Delete> rsa(engine_->BlobToRsaKey(key_material)); in LoadKey() local
113 if (!rsa) in LoadKey()
118 RsaKeymaster0Key(rsa.release(), hw_enforced, sw_enforced, &error)); in LoadKey()
/system/update_engine/payload_consumer/
Dpayload_verifier.cc148 RSA* rsa = PEM_read_RSA_PUBKEY(fpubkey, nullptr, nullptr, dummy_password); in GetRawHashFromSignature() local
150 TEST_AND_RETURN_FALSE(rsa != nullptr); in GetRawHashFromSignature()
151 unsigned int keysize = RSA_size(rsa); in GetRawHashFromSignature()
154 RSA_free(rsa); in GetRawHashFromSignature()
163 rsa, in GetRawHashFromSignature()
165 RSA_free(rsa); in GetRawHashFromSignature()
/system/tpm/trunks/
Dsession_manager_test.cc68 TPM2B_PUBLIC_KEY_RSA rsa; in GetValidRSAPublicKey() local
69 rsa.size = bytes.size(); in GetValidRSAPublicKey()
70 memcpy(rsa.buffer, bytes.data(), bytes.size()); in GetValidRSAPublicKey()
71 return rsa; in GetValidRSAPublicKey()
108 public_data.public_area.unique.rsa = GetValidRSAPublicKey(); in TEST_F()
127 public_data.public_area.unique.rsa.size = 32; in TEST_F()
138 public_data.public_area.unique.rsa = GetValidRSAPublicKey(); in TEST_F()
154 public_data.public_area.unique.rsa = GetValidRSAPublicKey(); in TEST_F()
Dsession_manager_impl.cc156 public_data.public_area.unique.rsa.size = 0; in EncryptSalt()
173 BN_bin2bn(public_data.public_area.unique.rsa.buffer, in EncryptSalt()
174 public_data.public_area.unique.rsa.size, nullptr); in EncryptSalt()
Dtrunks_client_test.cc992 crypto::ScopedRSA rsa(RSA_new()); in GenerateRSAKeyPair() local
995 CHECK(RSA_generate_key_ex(rsa.get(), 2048, exponent.get(), nullptr)) in GenerateRSAKeyPair()
998 crypto::ScopedRSA rsa(RSA_generate_key(2048, 0x10001, nullptr, nullptr)); in GenerateRSAKeyPair()
999 CHECK(rsa.get()); in GenerateRSAKeyPair()
1001 modulus->resize(BN_num_bytes(rsa.get()->n), 0); in GenerateRSAKeyPair()
1002 BN_bn2bin(rsa.get()->n, in GenerateRSAKeyPair()
1004 prime_factor->resize(BN_num_bytes(rsa.get()->p), 0); in GenerateRSAKeyPair()
1005 BN_bn2bin(rsa.get()->p, in GenerateRSAKeyPair()
1009 int length = i2d_RSAPublicKey(rsa.get(), &buffer); in GenerateRSAKeyPair()
1020 crypto::ScopedRSA rsa(d2i_RSAPublicKey(nullptr, &asn1_ptr, in VerifyRSASignature() local
[all …]
Dtpm_utility_test.cc497 public_area.public_area.unique.rsa.size = 0; in TEST_F()
523 public_area.public_area.unique.rsa.size = 0; in TEST_F()
566 public_area.public_area.unique.rsa.size = 0; in TEST_F()
596 public_area.public_area.unique.rsa.size = 0; in TEST_F()
626 public_area.public_area.unique.rsa.size = 0; in TEST_F()
654 public_area.public_area.unique.rsa.size = 0; in TEST_F()
711 public_area.public_area.unique.rsa.size = 0; in TEST_F()
743 public_area.public_area.unique.rsa.size = 0; in TEST_F()
775 public_area.public_area.unique.rsa.size = 0; in TEST_F()
801 public_area.public_area.unique.rsa.size = 0; in TEST_F()
[all …]
/system/tpm/attestation/common/
Dcrypto_utility_impl.cc169 crypto::ScopedRSA rsa(d2i_RSAPublicKey(nullptr, &asn1_ptr, in GetRSASubjectPublicKeyInfo() local
171 if (!rsa.get()) { in GetRSASubjectPublicKeyInfo()
177 int length = i2d_RSA_PUBKEY(rsa.get(), &buffer); in GetRSASubjectPublicKeyInfo()
192 crypto::ScopedRSA rsa(d2i_RSA_PUBKEY(NULL, &asn1_ptr, in GetRSAPublicKey() local
194 if (!rsa.get()) { in GetRSAPublicKey()
200 int length = i2d_RSAPublicKey(rsa.get(), &buffer); in GetRSAPublicKey()
243 crypto::ScopedRSA rsa(d2i_RSA_PUBKEY(NULL, &asn1_ptr, in EncryptIdentityCredential() local
245 if (!rsa.get()) { in EncryptIdentityCredential()
251 if (!TpmCompatibleOAEPEncrypt(asym_content, rsa.get(), in EncryptIdentityCredential()
280 crypto::ScopedRSA rsa(d2i_RSA_PUBKEY(NULL, &asn1_ptr, public_key.size())); in EncryptForUnbind() local
[all …]
Dtpm_utility_v1.cc694 crypto::ScopedRSA rsa(RSA_new()); in ConvertPublicKeyToDER() local
695 CHECK(rsa.get()); in ConvertPublicKeyToDER()
698 rsa.get()->e = BN_new(); in ConvertPublicKeyToDER()
699 CHECK(rsa.get()->e); in ConvertPublicKeyToDER()
700 BN_set_word(rsa.get()->e, kWellKnownExponent); in ConvertPublicKeyToDER()
702 rsa.get()->e = BN_bin2bn(parms->exponent, parms->exponentSize, nullptr); in ConvertPublicKeyToDER()
703 CHECK(rsa.get()->e); in ConvertPublicKeyToDER()
706 rsa.get()->n = BN_bin2bn(parsed.pubKey.key, parsed.pubKey.keyLength, nullptr); in ConvertPublicKeyToDER()
707 CHECK(rsa.get()->n); in ConvertPublicKeyToDER()
710 int der_length = i2d_RSAPublicKey(rsa.get(), nullptr); in ConvertPublicKeyToDER()
[all …]
/system/core/libmincrypt/
DAndroid.mk7 LOCAL_SRC_FILES := dsa_sig.c p256.c p256_ec.c p256_ecdsa.c rsa.c sha.c sha256.c
13 LOCAL_SRC_FILES := dsa_sig.c p256.c p256_ec.c p256_ecdsa.c rsa.c sha.c sha256.c
/system/security/softkeymaster/
Dkeymaster_openssl.cpp344 Unique_RSA rsa(RSA_new()); in generate_rsa_keypair() local
345 if (rsa.get() == NULL) { in generate_rsa_keypair()
350 if (!RSA_generate_key_ex(rsa.get(), rsa_params->modulus_size, bn.get(), NULL) || in generate_rsa_keypair()
351 RSA_check_key(rsa.get()) < 0) { in generate_rsa_keypair()
356 if (EVP_PKEY_assign_RSA(pkey, rsa.get()) == 0) { in generate_rsa_keypair()
360 release_because_ownership_transferred(rsa); in generate_rsa_keypair()
548 Unique_RSA rsa(EVP_PKEY_get1_RSA(pkey)); in sign_rsa() local
549 if (rsa.get() == NULL) { in sign_rsa()
561 if (RSA_private_encrypt(dataLength, data, tmp, rsa.get(), RSA_NO_PADDING) <= 0) { in sign_rsa()
670 Unique_RSA rsa(EVP_PKEY_get1_RSA(pkey)); in verify_rsa() local
[all …]
/system/update_engine/payload_generator/
Dpayload_signer.cc362 RSA* rsa = PEM_read_RSAPrivateKey(fprikey, nullptr, nullptr, nullptr); in SignHash() local
364 TEST_AND_RETURN_FALSE(rsa != nullptr); in SignHash()
365 brillo::Blob signature(RSA_size(rsa)); in SignHash()
369 rsa, in SignHash()
371 RSA_free(rsa); in SignHash()

12