/system/extras/verity/ |
D | generate_verity_key.c | 40 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 …]
|
D | verify_boot_signature.c | 316 EVP_PKEY *pkey = NULL; in verify_signature() local 328 if ((pkey = X509_get_pubkey(bs->certificate)) == NULL) { in verify_signature() 333 if ((rsa = EVP_PKEY_get1_RSA(pkey)) == NULL) { in verify_signature() 347 if (pkey) { in verify_signature() 348 EVP_PKEY_free(pkey); in verify_signature()
|
/system/security/softkeymaster/ |
D | keymaster_openssl.cpp | 109 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/keymaster/ |
D | openssl_utils.cpp | 84 UniquePtr<EVP_PKEY, EVP_PKEY_Delete>* pkey) { in convert_pkcs8_blob_to_evp() argument 93 pkey->reset(EVP_PKCS82PKEY(pkcs8.get())); in convert_pkcs8_blob_to_evp() 94 if (!pkey->get()) in convert_pkcs8_blob_to_evp() 97 if (EVP_PKEY_type((*pkey)->type) != convert_to_evp(expected_algorithm)) { in convert_pkcs8_blob_to_evp() 98 LOG_E("EVP key algorithm was %d, not the expected %d", EVP_PKEY_type((*pkey)->type), in convert_pkcs8_blob_to_evp() 109 UniquePtr<EVP_PKEY, EVP_PKEY_Delete>* pkey) { in KeyMaterialToEvpKey() argument 114 expected_algorithm, pkey); in KeyMaterialToEvpKey() 117 keymaster_error_t EvpKeyToKeyMaterial(const EVP_PKEY* pkey, KeymasterKeyBlob* key_blob) { in EvpKeyToKeyMaterial() argument 118 int key_data_size = i2d_PrivateKey(pkey, NULL /* key_data*/); in EvpKeyToKeyMaterial() 126 i2d_PrivateKey(pkey, &tmp); in EvpKeyToKeyMaterial()
|
D | ec_key.cpp | 27 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()
|
D | rsa_key.cpp | 27 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()
|
D | asymmetric_key_factory.cpp | 52 EVP_PKEY* pkey = in LoadKey() local 54 if (!pkey) in LoadKey() 56 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey_deleter(pkey); in LoadKey() 58 if (!asymmetric_key->EvpToInternal(pkey)) in LoadKey()
|
D | rsa_key_factory.cpp | 79 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()
|
D | ec_key_factory.cpp | 95 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in GenerateKey() local 96 if (ec_key.get() == NULL || pkey.get() == NULL) 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()
|
D | asymmetric_key.h | 42 virtual bool InternalToEvp(EVP_PKEY* pkey) const = 0; 43 virtual bool EvpToInternal(const EVP_PKEY* pkey) = 0;
|
D | ec_key.h | 35 bool InternalToEvp(EVP_PKEY* pkey) const override; 36 bool EvpToInternal(const EVP_PKEY* pkey) override;
|
D | ecdsa_keymaster1_operation.cpp | 91 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in GetEvpKey() local 92 if (!key.InternalToEvp(pkey.get())) { in GetEvpKey() 96 return pkey.release(); in GetEvpKey()
|
D | rsa_key.h | 32 bool InternalToEvp(EVP_PKEY* pkey) const override; 33 bool EvpToInternal(const EVP_PKEY* pkey) override;
|
D | asymmetric_key.cpp | 123 EVP_PKEY_Ptr pkey(EVP_PKEY_new()); in formatted_key_material() local 124 if (!InternalToEvp(pkey.get())) in formatted_key_material() 127 int key_data_length = i2d_PUBKEY(pkey.get(), NULL); in formatted_key_material() 136 if (i2d_PUBKEY(pkey.get(), &tmp) != key_data_length) { in formatted_key_material() 277 EVP_PKEY_Ptr pkey(EVP_PKEY_new()); in GenerateAttestation() local 278 if (!InternalToEvp(pkey.get())) in GenerateAttestation() 336 !add_public_key(pkey.get(), certificate.get(), &error) || in GenerateAttestation()
|
D | rsa_keymaster1_operation.cpp | 107 UniquePtr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in GetEvpKey() local 108 if (!key.InternalToEvp(pkey.get())) { in GetEvpKey() 112 return pkey.release(); in GetEvpKey()
|
D | keymaster0_engine.cpp | 191 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(GetKeymaster0PublicKey(blob)); in BlobToRsaKey() local 192 if (!pkey) in BlobToRsaKey() 194 unique_ptr<RSA, RSA_Delete> public_rsa(EVP_PKEY_get1_RSA(pkey.get())); in BlobToRsaKey() 216 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(GetKeymaster0PublicKey(blob)); in BlobToEcKey() local 217 if (!pkey) in BlobToEcKey() 220 unique_ptr<EC_KEY, EC_KEY_Delete> public_ec_key(EVP_PKEY_get1_EC_KEY(pkey.get())); in BlobToEcKey()
|
D | keymaster1_engine.cpp | 154 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey( in BuildRsaKey() local 156 if (!pkey) { in BuildRsaKey() 161 unique_ptr<RSA, RSA_Delete> public_rsa(EVP_PKEY_get1_RSA(pkey.get())); in BuildRsaKey() 196 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey( in BuildEcKey() local 198 if (!pkey) { in BuildEcKey() 203 unique_ptr<EC_KEY, EC_KEY_Delete> public_ec_key(EVP_PKEY_get1_EC_KEY(pkey.get())); in BuildEcKey()
|
D | ecdsa_operation.cpp | 40 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()
|
D | soft_keymaster_context.cpp | 583 unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); in ParseOldSoftkeymasterBlob() local 584 if (pkey.get() == nullptr) in ParseOldSoftkeymasterBlob() 587 EVP_PKEY* tmp = pkey.get(); in ParseOldSoftkeymasterBlob() 597 keymaster_error_t error = FakeKeyAuthorizations(pkey.get(), sw_enforced, sw_enforced); in ParseOldSoftkeymasterBlob() 776 EVP_PKEY* pkey = d2i_PrivateKey(evp_key_type, nullptr /* pkey */, &key, key_length); in AttestationKey() local 777 if (!pkey) in AttestationKey() 780 return pkey; in AttestationKey()
|
/system/core/adb/ |
D | adb_auth_host.cpp | 62 static int RSA_to_RSAPublicKey(RSA *rsa, RSAPublicKey *pkey) in RSA_to_RSAPublicKey() argument 87 pkey->len = RSANUMWORDS; in RSA_to_RSAPublicKey() 88 pkey->n0inv = 0 - BN_get_word(n0inv); in RSA_to_RSAPublicKey() 91 pkey->rr[i] = BN_get_word(rem); in RSA_to_RSAPublicKey() 93 pkey->n[i] = BN_get_word(rem); in RSA_to_RSAPublicKey() 95 pkey->exponent = BN_get_word(rsa->e); in RSA_to_RSAPublicKey() 149 RSAPublicKey pkey; in write_public_keyfile() local 162 if (!RSA_to_RSAPublicKey(private_key, &pkey)) { in write_public_keyfile() 176 if (!EVP_EncodedLength(&encoded_length, sizeof(pkey))) { in write_public_keyfile() 183 encoded_length = 1 + ((sizeof(pkey) + 2) / 3 * 4); in write_public_keyfile() [all …]
|
/system/security/keystore-engine/ |
D | eng_keystore.cpp | 133 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()
|
D | android_engine.cpp | 425 Unique_EVP_PKEY pkey(d2i_PUBKEY(NULL, &inp, pubkey_len)); in EVP_PKEY_from_keystore() local 427 if (pkey.get() == NULL) { in EVP_PKEY_from_keystore() 435 switch (EVP_PKEY_type(pkey->type)) { in EVP_PKEY_from_keystore() 437 Unique_RSA public_rsa(EVP_PKEY_get1_RSA(pkey.get())); in EVP_PKEY_from_keystore() 442 Unique_EC_KEY public_ecdsa(EVP_PKEY_get1_EC_KEY(pkey.get())); in EVP_PKEY_from_keystore() 447 ALOGE("Unsupported key type %d", EVP_PKEY_type(pkey->type)); in EVP_PKEY_from_keystore()
|
D | ecdsa_meth.cpp | 124 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()
|
D | dsa_meth.cpp | 124 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()
|
/system/connectivity/shill/shims/ |
D | crypto_util.cc | 178 EVP_PKEY* pkey = *pkey_ptr; in VerifyCredentialsImpl() local 179 if (!rsa || !pkey) { in VerifyCredentialsImpl() 193 if (!EVP_PKEY_assign_RSA(pkey, rsa)) { in VerifyCredentialsImpl() 216 if (X509_verify(x509, pkey) <= 0) { in VerifyCredentialsImpl() 317 EVP_PKEY* pkey = NULL; in VerifyCredentials() local 322 &rsa, &pkey, &raw_certificate_bio, &x509); in VerifyCredentials() 331 if (pkey) { in VerifyCredentials() 332 EVP_PKEY_free(pkey); in VerifyCredentials() 333 pkey = NULL; in VerifyCredentials()
|