/system/keymaster/android_keymaster/ |
D | operation.cpp | 39 bool OperationFactory::supported(keymaster_digest_t digest) const { in supported() 43 if (digest == supported_digests[i]) return true; in supported() 112 keymaster_digest_t* digest, in GetAndValidateDigest() argument 114 return GetAndValidateDigest(begin_params, key, digest, error, false); in GetAndValidateDigest() 118 keymaster_digest_t* digest, keymaster_error_t* error, in GetAndValidateDigest() argument 121 if (!begin_params.GetTagValue(TAG_DIGEST, digest)) { in GetAndValidateDigest() 126 *digest = KM_DIGEST_NONE; in GetAndValidateDigest() 132 } else if (!supported(*digest)) { in GetAndValidateDigest() 133 LOG_E("Digest %d not supported", *digest); in GetAndValidateDigest() 139 !key.authorizations().Contains(TAG_DIGEST, *digest) && in GetAndValidateDigest() [all …]
|
/system/security/keystore2/tests/ |
D | keystore2_client_hmac_key_tests.rs | 36 digest: Digest, in create_hmac_key_and_operation() 39 key_generations::generate_hmac_key(sec_level, alias, key_size, min_mac_len, digest)?; in create_hmac_key_and_operation() 45 .digest(digest) in create_hmac_key_and_operation() 75 for digest in digests { in keystore2_hmac_key_op_success() 76 let alias = format!("ks_hmac_test_key_{}", digest.0); in keystore2_hmac_key_op_success() 86 digest, in keystore2_hmac_key_op_success() 97 let digest = Digest::SHA_2_256; in keystore2_hmac_gen_keys_fails_expect_unsupported_key_size() localVariable 109 digest, in keystore2_hmac_gen_keys_fails_expect_unsupported_key_size() 128 let digest = Digest::SHA_2_256; in keystore2_hmac_gen_keys_fails_expect_unsupported_min_mac_length() localVariable 141 digest, in keystore2_hmac_gen_keys_fails_expect_unsupported_min_mac_length() [all …]
|
D | keystore2_client_ec_key_tests.rs | 38 ( $test_name:ident, $digest:expr, $ec_curve:expr ) => { 41 perform_ec_sign_key_op_success(stringify!($test_name), $digest, $ec_curve); 47 ( $test_name:ident, $digest:expr, $ec_curve:expr ) => { 52 $digest, 64 digest: Digest, in create_ec_key_and_operation() 68 key_generations::generate_ec_key(sec_level, domain, nspace, alias, ec_curve, digest)?; in create_ec_key_and_operation() 72 &authorizations::AuthSetBuilder::new().purpose(KeyPurpose::SIGN).digest(digest), in create_ec_key_and_operation() 77 fn perform_ec_sign_key_op_success(alias: &str, digest: Digest, ec_curve: EcCurve) { in perform_ec_sign_key_op_success() 86 digest, in perform_ec_sign_key_op_success() 102 fn perform_ec_sign_key_op_with_none_or_md5_digest(alias: &str, digest: Digest, ec_curve: EcCurve) { in perform_ec_sign_key_op_with_none_or_md5_digest() [all …]
|
D | keystore2_client_authorizations_tests.rs | 63 .digest(Digest::SHA_2_256) in gen_key_including_unique_id() 147 &authorizations::AuthSetBuilder::new().purpose(KeyPurpose::SIGN).digest(Digest::SHA_2_256), in generate_key_and_perform_op_with_max_usage_limit() 169 .digest(Digest::SHA_2_256) in keystore2_gen_key_auth_active_datetime_test_success() 178 &authorizations::AuthSetBuilder::new().purpose(KeyPurpose::SIGN).digest(Digest::SHA_2_256), in keystore2_gen_key_auth_active_datetime_test_success() 201 .digest(Digest::SHA_2_256) in keystore2_gen_key_auth_future_active_datetime_test_op_fail() 210 &authorizations::AuthSetBuilder::new().purpose(KeyPurpose::SIGN).digest(Digest::SHA_2_256), in keystore2_gen_key_auth_future_active_datetime_test_op_fail() 233 .digest(Digest::SHA_2_256) in keystore2_gen_key_auth_future_origination_expire_datetime_test_success() 242 &authorizations::AuthSetBuilder::new().purpose(KeyPurpose::SIGN).digest(Digest::SHA_2_256), in keystore2_gen_key_auth_future_origination_expire_datetime_test_success() 265 .digest(Digest::SHA_2_256) in keystore2_gen_key_auth_origination_expire_datetime_test_op_fail() 274 &authorizations::AuthSetBuilder::new().purpose(KeyPurpose::SIGN).digest(Digest::SHA_2_256), in keystore2_gen_key_auth_origination_expire_datetime_test_op_fail() [all …]
|
/system/keymaster/include/keymaster/km_openssl/ |
D | rsa_operation.h | 39 keymaster_purpose_t purpose, keymaster_digest_t digest, in RsaOperation() argument 42 padding_(padding), digest_(digest), digest_algorithm_(nullptr) {} in RsaOperation() 53 keymaster_digest_t digest() const { return digest_; } in digest() function 79 keymaster_purpose_t purpose, keymaster_digest_t digest, 95 keymaster_digest_t digest, keymaster_padding_t padding, EVP_PKEY* key) in RsaSignOperation() argument 97 digest, padding, key) {} in RsaSignOperation() 119 keymaster_digest_t digest, keymaster_padding_t padding, EVP_PKEY* key) in RsaVerifyOperation() argument 121 digest, padding, key) {} in RsaVerifyOperation() 143 keymaster_purpose_t purpose, keymaster_digest_t digest, in RsaCryptOperation() argument 145 : RsaOperation(std::move(hw_enforced), std::move(sw_enforced), purpose, digest, padding, in RsaCryptOperation() [all …]
|
D | ecdsa_operation.h | 36 keymaster_purpose_t purpose, keymaster_digest_t digest, EVP_PKEY* key) in EcdsaOperation() argument 37 : Operation(purpose, std::move(hw_enforced), std::move(sw_enforced)), digest_(digest), in EcdsaOperation() 59 keymaster_digest_t digest, EVP_PKEY* key) in EcdsaSignOperation() argument 60 : EcdsaOperation(std::move(hw_enforced), std::move(sw_enforced), KM_PURPOSE_SIGN, digest, in EcdsaSignOperation() 75 keymaster_digest_t digest, EVP_PKEY* key) in EcdsaVerifyOperation() argument 76 : EcdsaOperation(std::move(hw_enforced), std::move(sw_enforced), KM_PURPOSE_VERIFY, digest, in EcdsaVerifyOperation() 91 keymaster_digest_t digest, EVP_PKEY* key) in Ed25519SignOperation() argument 92 : EcdsaSignOperation(std::move(hw_enforced), std::move(sw_enforced), digest, key) {} in Ed25519SignOperation() 116 keymaster_digest_t digest, EVP_PKEY* key) = 0; 123 keymaster_digest_t digest, EVP_PKEY* key) override { in InstantiateOperation() argument [all …]
|
D | hmac.h | 40 bool Sign(const Buffer& data, uint8_t* digest, size_t digest_len) const; 41 bool Sign(const uint8_t* data, size_t data_len, uint8_t* digest, size_t digest_len) const; 49 bool Verify(const Buffer& data, const Buffer& digest) const; 50 bool Verify(const uint8_t* data, size_t data_len, const uint8_t* digest,
|
/system/keymaster/km_openssl/ |
D | hmac.cpp | 58 uint8_t* digest = tmp; in Sign() local 59 if (digest_len >= SHA256_DIGEST_LENGTH) digest = out_digest; in Sign() 61 if (nullptr == ::HMAC(EVP_sha256(), key_.get(), key_len_, data, data_len, digest, nullptr)) { in Sign() 69 bool HmacSha256::Verify(const Buffer& data, const Buffer& digest) const { in Verify() 70 return Verify(data.peek_read(), data.available_read(), digest.peek_read(), in Verify() 71 digest.available_read()); in Verify() 74 bool HmacSha256::Verify(const uint8_t* data, size_t data_len, const uint8_t* digest, in Verify() argument 81 return 0 == CRYPTO_memcmp(digest, computed_digest, SHA256_DIGEST_LENGTH); in Verify()
|
D | hmac_operation.cpp | 66 keymaster_digest_t digest; in CreateOperation() local 67 if (!key.authorizations().GetTagValue(TAG_DIGEST, &digest)) { in CreateOperation() 75 std::move(key), purpose(), digest, mac_length_bits / 8, min_mac_length_bits / 8)); in CreateOperation() 94 HmacOperation::HmacOperation(Key&& key, keymaster_purpose_t purpose, keymaster_digest_t digest, in HmacOperation() argument 102 switch (digest) { in HmacOperation() 176 uint8_t digest[EVP_MAX_MD_SIZE]; in Finish() local 178 if (!HMAC_Final(&ctx_, digest, &digest_len)) return TranslateLastOpenSslError(); in Finish() 183 if (!output->reserve(mac_length_) || !output->write(digest, mac_length_)) in Finish() 191 if (CRYPTO_memcmp(signature.peek_read(), digest, siglen) != 0) in Finish()
|
D | hkdf.cpp | 58 UniquePtr<uint8_t[]> digest(new (std::nothrow) uint8_t[digest_size_]); in GenerateKey() local 59 if (buf.get() == nullptr || digest.get() == nullptr) return false; in GenerateKey() 67 memcpy(buf.get(), digest.get(), digest_size_); in GenerateKey() 73 result = hmac.Sign(buf.get(), block_input_len, digest.get(), digest_size_); in GenerateKey() 78 memcpy(output + i * digest_size_, digest.get(), block_output_len); in GenerateKey()
|
D | rsa_key.cpp | 63 bool RsaKey::SupportedMode(keymaster_purpose_t purpose, keymaster_digest_t digest) { in SupportedMode() argument 70 return digest == KM_DIGEST_NONE || digest == KM_DIGEST_SHA_2_256; in SupportedMode()
|
D | rsa_operation.cpp | 72 keymaster_digest_t digest = KM_DIGEST_NONE; in CreateRsaOperation() local 74 if (require_digest && !GetAndValidateDigest(begin_params, key, &digest, error, true)) { in CreateRsaOperation() 81 RsaOperation* op = InstantiateOperation(key.hw_enforced_move(), key.sw_enforced_move(), digest, in CreateRsaOperation() 108 if (op->digest() != KM_DIGEST_NONE) { in CreateRsaOperation() 115 if (op->digest() == KM_DIGEST_NONE) { in CreateRsaOperation() 131 const AuthorizationSet& begin_params, const Key& key, keymaster_digest_t* digest) const { in GetAndValidateMgfDigest() 132 *digest = KM_DIGEST_SHA1; in GetAndValidateMgfDigest() 134 *digest = KM_DIGEST_NONE; in GetAndValidateMgfDigest() 138 if (!begin_params.GetTagValue(TAG_RSA_OAEP_MGF_DIGEST, digest)) { in GetAndValidateMgfDigest() 149 } else if (!supported(*digest) || (*digest == KM_DIGEST_NONE)) { in GetAndValidateMgfDigest() [all …]
|
/system/keymaster/legacy_support/ |
D | keymaster1_legacy_support.cpp | 119 keymaster_digest_t digest, const T& params, in findUnsupportedDigest() argument 126 if (digest != KM_DIGEST_NONE && !contains(supported_digests->second, digest)) { in findUnsupportedDigest() 127 LOG(WARNING) << "Digest " << digest << " requested but not supported by KM1 hal"; in findUnsupportedDigest() 143 keymaster_digest_t digest, const T& params, in requiresSoftwareDigesting() argument 156 if (!findUnsupportedDigest(algorithm, purpose, digest, params, digest_map)) { in requiresSoftwareDigesting() 188 bool Keymaster1LegacySupport::RequiresSoftwareDigesting(const keymaster_digest_t digest, in RequiresSoftwareDigesting() argument 204 if (requiresSoftwareDigesting(algorithm, purpose, digest, key_description, in RequiresSoftwareDigesting() 266 keymaster_digest_t digest; in LoadKey() local 267 if (!additional_params.GetTagValue(TAG_DIGEST, &digest)) { in LoadKey() 268 digest = KM_DIGEST_NONE; in LoadKey() [all …]
|
/system/nvram/core/ |
D | crypto_boringssl.cpp | 31 uint8_t* digest, in SHA256() argument 40 memcpy(digest, buffer, digest_size); in SHA256() 42 memcpy(digest, buffer, sizeof(buffer)); in SHA256() 43 memset(digest + sizeof(buffer), 0, digest_size - sizeof(buffer)); in SHA256()
|
/system/security/ondevice-signing/ |
D | KeystoreHmacKey.cpp | 83 KeyParameter digest; in createKey() local 84 digest.tag = Tag::DIGEST; in createKey() 85 digest.value = KeyParameterValue::make<KeyParameterValue::digest>(Digest::SHA_2_256); in createKey() 86 params.push_back(digest); in createKey() 164 KeyParameter digest; in getVerifyOpParameters() local 165 digest.tag = Tag::DIGEST; in getVerifyOpParameters() 166 digest.value = KeyParameterValue::make<KeyParameterValue::digest>(Digest::SHA_2_256); in getVerifyOpParameters() 167 opParameters.push_back(digest); in getVerifyOpParameters() 190 KeyParameter digest; in getSignOpParameters() local 191 digest.tag = Tag::DIGEST; in getSignOpParameters() [all …]
|
D | VerityUtils.cpp | 78 struct libfsverity_digest* digest; in createDigest() local 79 ret = libfsverity_compute_digest(&fd, &read_callback, ¶ms, &digest); in createDigest() 84 if (digest->digest_size != expected_digest_size) { in createDigest() 86 << " actual: " << digest->digest_size; in createDigest() 88 std::vector<uint8_t> digestVector(&digest->digest[0], &digest->digest[expected_digest_size]); in createDigest() 89 free(digest); in createDigest() 132 return toHex({&d->digest[0], &d->digest[d->digest_size]}); in measureFsVerity() 196 auto digest = OR_RETURN(measureFsVerity(fd)); in addFilesToVerityRecursive() local 197 digests[it->path()] = digest; in addFilesToVerityRecursive()
|
D | KeystoreKey.cpp | 85 KeyParameter digest; in createKey() local 86 digest.tag = Tag::DIGEST; in createKey() 87 digest.value = KeyParameterValue::make<KeyParameterValue::digest>(Digest::SHA_2_256); in createKey() 88 params.push_back(digest); in createKey() 276 KeyParameter digest; in getSignOpParameters() local 277 digest.tag = Tag::DIGEST; in getSignOpParameters() 278 digest.value = KeyParameterValue::make<KeyParameterValue::digest>(Digest::SHA_2_256); in getSignOpParameters() 279 opParameters.push_back(digest); in getSignOpParameters()
|
/system/security/keystore2/src/crypto/tests/ |
D | certificate_utils_test.cpp | 59 const EVP_MD* getMD(Digest digest) { in getMD() argument 60 switch (digest) { in getMD() 138 auto [curve_nid, digest] = param.param; in paramToStringEc() 139 s << param.index << "_" << curveNidToString(curve_nid) << "_" << toString(digest); in paramToStringEc() 151 Digest digest; in TEST_P() local 152 std::tie(curve_nid, digest) = GetParam(); in TEST_P() 187 EVP_DigestSignInit(sign_ctx.get(), nullptr, getMD(digest), nullptr, pkey.get())); in TEST_P() 195 Algo::ECDSA, Padding::Ignored, digest)); in TEST_P() 218 auto [key_size, padding, digest] = param.param; in paramsToStringRsa() 230 s << "_" << toString(digest); in paramsToStringRsa() [all …]
|
/system/keymaster/tests/ |
D | hmac_test.cpp | 33 uint8_t digest[32]; member 70 uint8_t digest_copy[sizeof(test.digest)]; in TEST() 71 memcpy(digest_copy, test.digest, sizeof(test.digest)); in TEST()
|
/system/security/fsverity/ |
D | fsverity_manifest_generator.py | 60 digest = digests.digests[os.path.relpath(f, args.base_dir)] variable 61 digest.digest = _digest(args.fsverity_path, f) 62 digest.hash_alg = HASH_ALGORITHM
|
/system/keymint/boringssl/src/ |
D | hmac.rs | 33 digest: Digest, in begin() 45 let digest = digest_into_openssl_ffi(digest)?; in begin() localVariable 58 digest, in begin() 119 fn digest_into_openssl_ffi(digest: Digest) -> Result<*const ffi::EVP_MD, Error> { in digest_into_openssl_ffi() 122 match digest { in digest_into_openssl_ffi()
|
/system/apex/apexd/ |
D | apexd_verity.cpp | 107 auto digest = builder->root_hash(); in GenerateHashTree() local 110 digest.resize(golden_digest.size()); in GenerateHashTree() 111 if (digest != golden_digest) { in GenerateHashTree() 173 auto digest = CalculateRootDigest(hashtree_file, verity_data); in PrepareHashTree() local 174 if (!digest.ok()) { in PrepareHashTree() 175 return digest.error(); in PrepareHashTree() 177 if (*digest != verity_data.root_digest) { in PrepareHashTree() 180 << *digest << "\nvs\n" in PrepareHashTree()
|
/system/keymint/common/src/ |
D | tag.rs | 826 let digest = get_tag_value!(params, Digest, ErrorCode::UnsupportedDigest)?; in check_hmac_params() localVariable 827 if digest == Digest::None { in check_hmac_params() 828 return Err(km_err!(UnsupportedDigest, "unsupported digest {:?}", digest)); in check_hmac_params() 898 if let Some(digest) = get_opt_tag_value!(params, Digest)? { in reject_some_digest() 899 if *digest != Digest::None { in reject_some_digest() 900 return Err(km_err!(InvalidTag, "digest {:?} not allowed", digest)); in reject_some_digest() 939 digest: bool, field 1028 if check.digest { in check_begin_params() 1029 if let Some(digest) = get_opt_tag_value!(params, Digest, UnsupportedDigest)? { in check_begin_params() 1030 if !contains_tag_value!(chars, Digest, *digest) { in check_begin_params() [all …]
|
/system/keymint/tests/src/ |
D | lib.rs | 164 digest: Digest, in test_hmac() field 173 digest: Digest::Sha256, in test_hmac() 180 digest: Digest::Sha512, in test_hmac() 188 digest: Digest::Sha256, in test_hmac() 197 digest: Digest::Sha224, in test_hmac() 207 digest: Digest::Sha256, in test_hmac() 217 digest: Digest::Sha384, in test_hmac() 228 digest: Digest::Sha512, in test_hmac() 241 digest: Digest::Sha224, in test_hmac() 251 digest: Digest::Sha256, in test_hmac() [all …]
|
/system/security/keystore2/src/crypto/ |
D | crypto.cpp | 73 const EVP_MD* digest = EVP_sha256(); in hmacSha256() local 75 uint8_t* p = HMAC(digest, key, key_size, msg, msg_size, out, &actual_out_size); in hmacSha256() 196 const EVP_MD* digest = EVP_sha256(); in PBKDF2() local 200 digest = EVP_sha1(); in PBKDF2() 203 PKCS5_PBKDF2_HMAC(pw, pw_len, salt, SALT_SIZE, 8192, digest, key_len, key); in PBKDF2() 210 const EVP_MD* digest = EVP_sha256(); in HKDFExtract() local 211 auto result = HKDF_extract(out_key, out_len, digest, secret, secret_len, salt, salt_len); in HKDFExtract() 217 const EVP_MD* digest = EVP_sha256(); in HKDFExpand() local 218 auto result = HKDF_expand(out_key, out_len, digest, prk, prk_len, info, info_len); in HKDFExpand()
|