Home
last modified time | relevance | path

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

12

/system/extras/verity/
Dgenerate_verity_key.c40 static int convert_to_mincrypt_format(RSA *rsa, RSAPublicKey *pkey) in convert_to_mincrypt_format() argument
63 pkey->len = RSANUMWORDS; in convert_to_mincrypt_format()
64 pkey->n0inv = 0 - BN_get_word(n0inv); in convert_to_mincrypt_format()
67 pkey->rr[i] = BN_get_word(rem); in convert_to_mincrypt_format()
69 pkey->n[i] = BN_get_word(rem); in convert_to_mincrypt_format()
71 pkey->exponent = BN_get_word(rsa->e); in convert_to_mincrypt_format()
89 RSAPublicKey pkey; in write_public_keyfile() local
97 if (convert_to_mincrypt_format(private_key, &pkey) < 0) in write_public_keyfile()
104 BIO_write(bfile, &pkey, sizeof(pkey)); in write_public_keyfile()
118 EVP_PKEY *pkey = NULL; in convert_x509() local
[all …]
Dverify_boot_signature.c324 EVP_PKEY *pkey = NULL; in verify_signature() local
336 if ((pkey = X509_get_pubkey(bs->certificate)) == NULL) { in verify_signature()
341 if ((rsa = EVP_PKEY_get1_RSA(pkey)) == NULL) { in verify_signature()
355 if (pkey) { in verify_signature()
356 EVP_PKEY_free(pkey); in verify_signature()
/system/keymaster/
Dopenssl_utils.cpp38 UniquePtr<EVP_PKEY, EVP_PKEY_Delete>* pkey) { in convert_pkcs8_blob_to_evp() argument
47 pkey->reset(EVP_PKCS82PKEY(pkcs8.get())); in convert_pkcs8_blob_to_evp()
48 if (!pkey->get()) in convert_pkcs8_blob_to_evp()
51 if (EVP_PKEY_type((*pkey)->type) != convert_to_evp(expected_algorithm)) { in convert_pkcs8_blob_to_evp()
52 LOG_E("EVP key algorithm was %d, not the expected %d", EVP_PKEY_type((*pkey)->type), in convert_pkcs8_blob_to_evp()
63 UniquePtr<EVP_PKEY, EVP_PKEY_Delete>* pkey) { in KeyMaterialToEvpKey() argument
68 expected_algorithm, pkey); in KeyMaterialToEvpKey()
71 keymaster_error_t EvpKeyToKeyMaterial(const EVP_PKEY* pkey, KeymasterKeyBlob* key_blob) { in EvpKeyToKeyMaterial() argument
72 int key_data_size = i2d_PrivateKey(pkey, NULL /* key_data*/); in EvpKeyToKeyMaterial()
80 i2d_PrivateKey(pkey, &tmp); in EvpKeyToKeyMaterial()
Dasymmetric_key.cpp32 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in key_material() local
33 if (pkey.get() == NULL) in key_material()
36 if (!InternalToEvp(pkey.get())) in key_material()
39 *size = i2d_PrivateKey(pkey.get(), NULL /* key_data*/); in key_material()
45 i2d_PrivateKey(pkey.get(), &tmp); in key_material()
59 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in formatted_key_material() local
60 if (!InternalToEvp(pkey.get())) in formatted_key_material()
63 int key_data_length = i2d_PUBKEY(pkey.get(), NULL); in formatted_key_material()
72 if (i2d_PUBKEY(pkey.get(), &tmp) != key_data_length) { in formatted_key_material()
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()
Drsa_key.cpp27 bool RsaKey::EvpToInternal(const EVP_PKEY* pkey) { in EvpToInternal() argument
28 rsa_key_.reset(EVP_PKEY_get1_RSA(const_cast<EVP_PKEY*>(pkey))); in EvpToInternal()
32 bool RsaKey::InternalToEvp(EVP_PKEY* pkey) const { in InternalToEvp()
33 return EVP_PKEY_set1_RSA(pkey, rsa_key_.get()) == 1; in InternalToEvp()
Dasymmetric_key_factory.cpp51 EVP_PKEY* pkey = in LoadKey() local
53 if (!pkey) in LoadKey()
55 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey_deleter(pkey); in LoadKey()
57 if (!asymmetric_key->EvpToInternal(pkey)) in LoadKey()
Dec_key_factory.cpp59 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in GenerateKey() local
60 if (ec_key.get() == NULL || pkey.get() == NULL) in GenerateKey()
79 if (EVP_PKEY_set1_EC_KEY(pkey.get(), ec_key.get()) != 1) in GenerateKey()
83 keymaster_error_t error = EvpKeyToKeyMaterial(pkey.get(), &key_material); in GenerateKey()
119 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey; in UpdateImportKeyDescription() local
121 KeyMaterialToEvpKey(key_format, key_material, keymaster_key_type(), &pkey); in UpdateImportKeyDescription()
125 UniquePtr<EC_KEY, EC_Delete> ec_key(EVP_PKEY_get1_EC_KEY(pkey.get())); in UpdateImportKeyDescription()
Drsa_key_factory.cpp79 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in GenerateKey() local
80 if (exponent.get() == NULL || rsa_key.get() == NULL || pkey.get() == NULL) in GenerateKey()
87 if (EVP_PKEY_set1_RSA(pkey.get(), rsa_key.get()) != 1) in GenerateKey()
91 keymaster_error_t error = EvpKeyToKeyMaterial(pkey.get(), &key_material); in GenerateKey()
129 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey; in UpdateImportKeyDescription() local
131 KeyMaterialToEvpKey(key_format, key_material, keymaster_key_type(), &pkey); in UpdateImportKeyDescription()
135 UniquePtr<RSA, RsaKey::RSA_Delete> rsa_key(EVP_PKEY_get1_RSA(pkey.get())); in UpdateImportKeyDescription()
Dasymmetric_key.h37 virtual bool InternalToEvp(EVP_PKEY* pkey) const = 0;
38 virtual bool EvpToInternal(const EVP_PKEY* pkey) = 0;
Dec_key.h35 bool InternalToEvp(EVP_PKEY* pkey) const override;
36 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;
Dkeymaster0_engine.cpp193 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(GetKeymaster0PublicKey(blob)); in BlobToRsaKey() local
194 if (!pkey) in BlobToRsaKey()
196 unique_ptr<RSA, RSA_Delete> public_rsa(EVP_PKEY_get1_RSA(pkey.get())); in BlobToRsaKey()
218 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(GetKeymaster0PublicKey(blob)); in BlobToEcKey() local
219 if (!pkey) in BlobToEcKey()
222 unique_ptr<EC_KEY, EC_Delete> public_ec_key(EVP_PKEY_get1_EC_KEY(pkey.get())); in BlobToEcKey()
Decdsa_operation.cpp40 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in CreateOperation() local
41 if (!ecdsa_key->InternalToEvp(pkey.get())) { in CreateOperation()
51 Operation* op = InstantiateOperation(digest, pkey.release()); in CreateOperation()
Dsoft_keymaster_context.cpp247 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in ParseOldSoftkeymasterBlob() local
248 if (pkey.get() == nullptr) in ParseOldSoftkeymasterBlob()
251 EVP_PKEY* tmp = pkey.get(); in ParseOldSoftkeymasterBlob()
261 keymaster_error_t error = FakeKeyAuthorizations(pkey.get(), sw_enforced, sw_enforced); in ParseOldSoftkeymasterBlob()
Dopenssl_utils.h74 UniquePtr<EVP_PKEY, EVP_PKEY_Delete>* pkey);
Drsa_operation.cpp49 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in GetRsaKey() local
50 if (!rsa_key->InternalToEvp(pkey.get())) { in GetRsaKey()
54 return pkey.release(); in GetRsaKey()
Dsoft_keymaster_device.cpp294 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKCS82PKEY(pkcs8.get())); in GetPkcs8KeyAlgorithm() local
295 if (pkey.get() == NULL) { in GetPkcs8KeyAlgorithm()
300 switch (EVP_PKEY_type(pkey->type)) { in GetPkcs8KeyAlgorithm()
308 LOG_E("Unsupported algorithm %d", EVP_PKEY_type(pkey->type)); in GetPkcs8KeyAlgorithm()
/system/security/softkeymaster/
Dkeymaster_openssl.cpp109 static int wrap_key(EVP_PKEY* pkey, int type, uint8_t** keyBlob, size_t* keyBlobLength) { in wrap_key() argument
115 int privateLen = i2d_PrivateKey(pkey, NULL); in wrap_key()
152 if (i2d_PrivateKey(pkey, &p) != privateLen) { in wrap_key()
211 Unique_EVP_PKEY pkey(EVP_PKEY_new()); in unwrap_key() local
212 if (pkey.get() == NULL) { in unwrap_key()
216 EVP_PKEY* tmp = pkey.get(); in unwrap_key()
223 return pkey.release(); in unwrap_key()
226 static int generate_dsa_keypair(EVP_PKEY* pkey, const keymaster_dsa_keygen_params_t* dsa_params) { in generate_dsa_keypair() argument
267 if (EVP_PKEY_assign_DSA(pkey, dsa.get()) == 0) { in generate_dsa_keypair()
276 static int generate_ec_keypair(EVP_PKEY* pkey, const keymaster_ec_keygen_params_t* ec_params) { in generate_ec_keypair() argument
[all …]
/system/core/adb/
Dadb_auth_host.cpp71 static int RSA_to_RSAPublicKey(RSA *rsa, RSAPublicKey *pkey) in RSA_to_RSAPublicKey() argument
96 pkey->len = RSANUMWORDS; in RSA_to_RSAPublicKey()
97 pkey->n0inv = 0 - BN_get_word(n0inv); in RSA_to_RSAPublicKey()
100 pkey->rr[i] = BN_get_word(rem); in RSA_to_RSAPublicKey()
102 pkey->n[i] = BN_get_word(rem); in RSA_to_RSAPublicKey()
104 pkey->exponent = BN_get_word(rsa->e); in RSA_to_RSAPublicKey()
158 RSAPublicKey pkey; in write_public_keyfile() local
171 if (!RSA_to_RSAPublicKey(private_key, &pkey)) { in write_public_keyfile()
185 if (!EVP_EncodedLength(&encoded_length, sizeof(pkey))) { in write_public_keyfile()
192 encoded_length = 1 + ((sizeof(pkey) + 2) / 3 * 4); in write_public_keyfile()
[all …]
/system/security/keystore-engine/
Deng_keystore.cpp133 Unique_EVP_PKEY pkey(d2i_PUBKEY(NULL, &tmp, pubkeyLen)); in keystore_loadkey() local
135 if (pkey.get() == NULL) { in keystore_loadkey()
140 switch (EVP_PKEY_type(pkey->type)) { in keystore_loadkey()
142 dsa_pkey_setup(e, pkey.get(), key_id); in keystore_loadkey()
146 rsa_pkey_setup(e, pkey.get(), key_id); in keystore_loadkey()
150 ecdsa_pkey_setup(e, pkey.get(), key_id); in keystore_loadkey()
154 ALOGE("Unsupported key type %d", EVP_PKEY_type(pkey->type)); in keystore_loadkey()
158 return pkey.release(); in keystore_loadkey()
Dandroid_engine.cpp424 Unique_EVP_PKEY pkey(d2i_PUBKEY(NULL, &inp, pubkey_len)); in EVP_PKEY_from_keystore() local
426 if (pkey.get() == NULL) { in EVP_PKEY_from_keystore()
434 switch (EVP_PKEY_type(pkey->type)) { in EVP_PKEY_from_keystore()
436 Unique_RSA public_rsa(EVP_PKEY_get1_RSA(pkey.get())); in EVP_PKEY_from_keystore()
441 Unique_EC_KEY public_ecdsa(EVP_PKEY_get1_EC_KEY(pkey.get())); in EVP_PKEY_from_keystore()
446 ALOGE("Unsupported key type %d", EVP_PKEY_type(pkey->type)); in EVP_PKEY_from_keystore()
Ddsa_meth.cpp124 int dsa_pkey_setup(ENGINE *e, EVP_PKEY *pkey, const char *key_id) { in dsa_pkey_setup() argument
125 Unique_DSA dsa(EVP_PKEY_get1_DSA(pkey)); in dsa_pkey_setup()
Decdsa_meth.cpp124 int ecdsa_pkey_setup(ENGINE *e, EVP_PKEY *pkey, const char *key_id) { in ecdsa_pkey_setup() argument
125 Unique_EC_KEY eckey(EVP_PKEY_get1_EC_KEY(pkey)); in ecdsa_pkey_setup()
Drsa_meth.cpp212 int rsa_pkey_setup(ENGINE *e, EVP_PKEY *pkey, const char *key_id) { in rsa_pkey_setup() argument
213 Unique_RSA rsa(EVP_PKEY_get1_RSA(pkey)); in rsa_pkey_setup()

12