Home
last modified time | relevance | path

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

12

/system/extras/verity/
Dgenerate_verity_key.c65 EVP_PKEY *pkey = NULL; in convert_x509() local
85 pkey = X509_get_pubkey(cert); in convert_x509()
86 if (!pkey) { in convert_x509()
91 rsa = EVP_PKEY_get1_RSA(pkey); in convert_x509()
111 if (pkey) { in convert_x509()
112 EVP_PKEY_free(pkey); in convert_x509()
127 EVP_PKEY* pkey = EVP_PKEY_new(); in generate_key() local
129 if (!pkey || !exponent || !rsa) { in generate_key()
136 EVP_PKEY_set1_RSA(pkey, rsa); in generate_key()
144 if (!PEM_write_PrivateKey(f, pkey, NULL, NULL, 0, NULL, NULL)) { in generate_key()
[all …]
/system/keymaster/km_openssl/
Dopenssl_utils.cpp79 UniquePtr<EVP_PKEY, EVP_PKEY_Delete>* pkey) { in convert_pkcs8_blob_to_evp() argument
88 pkey->reset(EVP_PKCS82PKEY(pkcs8.get())); in convert_pkcs8_blob_to_evp()
89 if (!pkey->get()) in convert_pkcs8_blob_to_evp()
92 if (EVP_PKEY_type((*pkey)->type) != convert_to_evp(expected_algorithm)) { in convert_pkcs8_blob_to_evp()
93 LOG_E("EVP key algorithm was %d, not the expected %d", EVP_PKEY_type((*pkey)->type), in convert_pkcs8_blob_to_evp()
104 UniquePtr<EVP_PKEY, EVP_PKEY_Delete>* pkey) { in KeyMaterialToEvpKey() argument
109 expected_algorithm, pkey); in KeyMaterialToEvpKey()
112 keymaster_error_t EvpKeyToKeyMaterial(const EVP_PKEY* pkey, KeymasterKeyBlob* key_blob) { in EvpKeyToKeyMaterial() argument
113 int key_data_size = i2d_PrivateKey(pkey, nullptr /* key_data*/); in EvpKeyToKeyMaterial()
121 i2d_PrivateKey(pkey, &tmp); in EvpKeyToKeyMaterial()
Dec_key.cpp27 bool EcKey::EvpToInternal(const EVP_PKEY* pkey) { in EvpToInternal() argument
28 ec_key_.reset(EVP_PKEY_get1_EC_KEY(const_cast<EVP_PKEY*>(pkey))); in EvpToInternal()
32 bool EcKey::InternalToEvp(EVP_PKEY* pkey) const { in InternalToEvp()
33 return EVP_PKEY_set1_EC_KEY(pkey, ec_key_.get()) == 1; in InternalToEvp()
Dasymmetric_key.cpp44 EVP_PKEY_Ptr pkey(EVP_PKEY_new()); in formatted_key_material() local
45 if (!InternalToEvp(pkey.get())) in formatted_key_material()
48 int key_data_length = i2d_PUBKEY(pkey.get(), nullptr); in formatted_key_material()
57 if (i2d_PUBKEY(pkey.get(), &tmp) != key_data_length) { in formatted_key_material()
Drsa_key.cpp26 bool RsaKey::EvpToInternal(const EVP_PKEY* pkey) { in EvpToInternal() argument
27 rsa_key_.reset(EVP_PKEY_get1_RSA(const_cast<EVP_PKEY*>(pkey))); in EvpToInternal()
31 bool RsaKey::InternalToEvp(EVP_PKEY* pkey) const { in InternalToEvp()
32 return EVP_PKEY_set1_RSA(pkey, rsa_key_.get()) == 1; in InternalToEvp()
Dasymmetric_key_factory.cpp54 EVP_PKEY* pkey = in LoadKey() local
57 if (!pkey) in LoadKey()
59 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey_deleter(pkey); in LoadKey()
61 if (!asym_key->EvpToInternal(pkey)) in LoadKey()
Drsa_key_factory.cpp83 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in GenerateKey() local
84 if (exponent.get() == nullptr || rsa_key.get() == nullptr || pkey.get() == nullptr) in GenerateKey()
91 if (EVP_PKEY_set1_RSA(pkey.get(), rsa_key.get()) != 1) in GenerateKey()
95 keymaster_error_t error = EvpKeyToKeyMaterial(pkey.get(), &key_material); in GenerateKey()
133 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey; in UpdateImportKeyDescription() local
135 KeyMaterialToEvpKey(key_format, key_material, keymaster_key_type(), &pkey); in UpdateImportKeyDescription()
139 UniquePtr<RSA, RsaKey::RSA_Delete> rsa_key(EVP_PKEY_get1_RSA(pkey.get())); in UpdateImportKeyDescription()
Dec_key_factory.cpp95 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in GenerateKey() local
96 if (ec_key.get() == nullptr || pkey.get() == nullptr) in GenerateKey()
115 if (EVP_PKEY_set1_EC_KEY(pkey.get(), ec_key.get()) != 1) in GenerateKey()
119 error = EvpKeyToKeyMaterial(pkey.get(), &key_material); in GenerateKey()
155 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey; in UpdateImportKeyDescription() local
157 KeyMaterialToEvpKey(key_format, key_material, keymaster_key_type(), &pkey); in UpdateImportKeyDescription()
161 UniquePtr<EC_KEY, EC_KEY_Delete> ec_key(EVP_PKEY_get1_EC_KEY(pkey.get())); in UpdateImportKeyDescription()
Decdsa_operation.cpp35 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in CreateOperation() local
36 if (!ecdsa_key.InternalToEvp(pkey.get())) { in CreateOperation()
48 digest, pkey.release())); in CreateOperation()
/system/core/adb/crypto/include/adb/crypto/
Dkey.h31 explicit Key(bssl::UniquePtr<EVP_PKEY>&& pkey, adb::proto::KeyType type) in Key() argument
32 : pkey_(std::move(pkey)), key_type_(type) {} in Key()
38 static std::string ToPEMString(EVP_PKEY* pkey);
Dx509_generator.h25 bssl::UniquePtr<X509> GenerateX509Certificate(EVP_PKEY* pkey);
/system/core/adb/crypto/
Drsa_2048_key.cpp71 bssl::UniquePtr<EVP_PKEY> pkey(EVP_PKEY_new()); in CreateRSA2048Key() local
74 if (!pkey || !exponent || !rsa) { in CreateRSA2048Key()
81 EVP_PKEY_set1_RSA(pkey.get(), rsa.get()); in CreateRSA2048Key()
83 return std::optional<Key>{Key(std::move(pkey), adb::proto::KeyType::RSA_2048)}; in CreateRSA2048Key()
Dx509_generator.cpp57 bssl::UniquePtr<X509> GenerateX509Certificate(EVP_PKEY* pkey) { in GenerateX509Certificate() argument
58 CHECK(pkey); in GenerateX509Certificate()
70 if (!X509_set_pubkey(x509.get(), pkey)) { in GenerateX509Certificate()
95 int bytes = X509_sign(x509.get(), pkey, EVP_sha256()); in GenerateX509Certificate()
Dkey.cpp28 std::string Key::ToPEMString(EVP_PKEY* pkey) { in ToPEMString() argument
30 int rc = PEM_write_bio_PKCS8PrivateKey(bio.get(), pkey, nullptr, nullptr, 0, nullptr, nullptr); in ToPEMString()
/system/keymaster/include/keymaster/km_openssl/
Dasymmetric_key.h37 virtual bool InternalToEvp(EVP_PKEY* pkey) const = 0;
38 virtual bool EvpToInternal(const EVP_PKEY* pkey) = 0;
Dec_key.h36 bool InternalToEvp(EVP_PKEY* pkey) const override;
37 bool EvpToInternal(const EVP_PKEY* pkey) override;
Drsa_key.h32 bool InternalToEvp(EVP_PKEY* pkey) const override;
33 bool EvpToInternal(const EVP_PKEY* pkey) override;
Dopenssl_utils.h89 UniquePtr<EVP_PKEY, EVP_PKEY_Delete>* pkey);
/system/security/keystore-engine/
Dandroid_engine.cpp352 bssl::UniquePtr<EVP_PKEY> pkey(d2i_PUBKEY(nullptr, &inp, pubkey_len)); in EVP_PKEY_from_keystore() local
353 if (pkey.get() == nullptr) { in EVP_PKEY_from_keystore()
359 switch (EVP_PKEY_type(pkey->type)) { in EVP_PKEY_from_keystore()
361 bssl::UniquePtr<RSA> public_rsa(EVP_PKEY_get1_RSA(pkey.get())); in EVP_PKEY_from_keystore()
366 bssl::UniquePtr<EC_KEY> public_ecdsa(EVP_PKEY_get1_EC_KEY(pkey.get())); in EVP_PKEY_from_keystore()
371 ALOGE("Unsupported key type %d", EVP_PKEY_type(pkey->type)); in EVP_PKEY_from_keystore()
/system/keymaster/legacy_support/
Decdsa_keymaster1_operation.cpp90 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in GetEvpKey() local
91 if (!key.InternalToEvp(pkey.get())) { in GetEvpKey()
95 return pkey.release(); in GetEvpKey()
Drsa_keymaster1_operation.cpp111 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in GetEvpKey() local
112 if (!key.InternalToEvp(pkey.get())) { in GetEvpKey()
116 return pkey.release(); in GetEvpKey()
Dkeymaster0_engine.cpp173 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(GetKeymaster0PublicKey(blob)); in BlobToRsaKey() local
174 if (!pkey) in BlobToRsaKey()
176 unique_ptr<RSA, RSA_Delete> public_rsa(EVP_PKEY_get1_RSA(pkey.get())); in BlobToRsaKey()
198 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(GetKeymaster0PublicKey(blob)); in BlobToEcKey() local
199 if (!pkey) in BlobToEcKey()
202 unique_ptr<EC_KEY, EC_KEY_Delete> public_ec_key(EVP_PKEY_get1_EC_KEY(pkey.get())); in BlobToEcKey()
Dkeymaster1_engine.cpp153 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey( in BuildRsaKey() local
158 unique_ptr<RSA, RSA_Delete> public_rsa(EVP_PKEY_get1_RSA(pkey.get())); in BuildRsaKey()
193 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey( in BuildEcKey() local
198 unique_ptr<EC_KEY, EC_KEY_Delete> public_ec_key(EVP_PKEY_get1_EC_KEY(pkey.get())); in BuildEcKey()
/system/keymaster/key_blob_utils/
Dsoftware_keyblobs.cpp220 EVP_PKEY_Ptr pkey(d2i_PrivateKey(type, nullptr, &p, privateLen)); in ParseOldSoftkeymasterBlob() local
221 if (pkey.get() == nullptr) { in ParseOldSoftkeymasterBlob()
229 keymaster_error_t error = FakeKeyAuthorizations(pkey.get(), sw_enforced, sw_enforced); in ParseOldSoftkeymasterBlob()
/system/core/adb/client/
Dauth.cpp301 bssl::UniquePtr<EVP_PKEY> pkey(EVP_PKEY_new()); in adb_auth_get_user_privkey() local
302 if (!pkey) { in adb_auth_get_user_privkey()
307 EVP_PKEY_set1_RSA(pkey.get(), rsa_privkey.get()); in adb_auth_get_user_privkey()
308 return pkey; in adb_auth_get_user_privkey()

12