diff options
author | nagendra modadugu <ngm@google.com> | 2019-02-22 17:26:13 -0800 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-02-22 17:26:13 -0800 |
commit | 31266a9780c800791333cd668b05d8a43323205b (patch) | |
tree | 074461c1c59a321ba0f8602c63d7f2aa2ddf1aae /keymaster | |
parent | 1dce037462385580c27b6ba2db7b7f691f1354ce (diff) | |
parent | d0a5c1dda521c07e2cca4cf426490e8da399f481 (diff) | |
download | android_hardware_interfaces-31266a9780c800791333cd668b05d8a43323205b.tar.gz android_hardware_interfaces-31266a9780c800791333cd668b05d8a43323205b.tar.bz2 android_hardware_interfaces-31266a9780c800791333cd668b05d8a43323205b.zip |
[DO NOT MERGE] keymaster: add an EC attestation test
am: d0a5c1dda5
Change-Id: I797704e86fb125a0986c3fb658ddc9b86df3b9fe
Diffstat (limited to 'keymaster')
-rw-r--r-- | keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp index 784ae30c0..a2b43f06d 100644 --- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp +++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp @@ -3899,6 +3899,33 @@ TEST_F(AttestationTest, EcAttestation) { } /* + * AttestationTest.EcAttestationByKeySize + * + * Verifies that attesting to EC keys works and generates the expected output. + */ +TEST_F(AttestationTest, EcAttestationByKeySize) { + ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() + .Authorization(TAG_NO_AUTH_REQUIRED) + .EcdsaSigningKey(256) + .Digest(Digest::SHA_2_256) + .Authorization(TAG_INCLUDE_UNIQUE_ID))); + + hidl_vec<hidl_vec<uint8_t>> cert_chain; + ASSERT_EQ(ErrorCode::OK, + AttestKey(AuthorizationSetBuilder() + .Authorization(TAG_ATTESTATION_CHALLENGE, HidlBuf("challenge")) + .Authorization(TAG_ATTESTATION_APPLICATION_ID, HidlBuf("foo")), + &cert_chain)); + EXPECT_GE(cert_chain.size(), 2U); + EXPECT_TRUE(verify_chain(cert_chain)); + + EXPECT_TRUE(verify_attestation_record("challenge", "foo", // + key_characteristics_.softwareEnforced, // + key_characteristics_.hardwareEnforced, // + SecLevel(), cert_chain[0])); +} + +/* * AttestationTest.EcAttestationRequiresAttestationAppId * * Verifies that attesting to EC keys requires app ID |