From aa8a75840fd0788ef422d0f40f6bd85c9ce9afe6 Mon Sep 17 00:00:00 2001 From: Brian J Murray Date: Mon, 6 Dec 2021 22:13:50 -0800 Subject: [PATCH] Avoid SIGSEGV if attest key generation fails. Add an explicit check that `attested_key_cert_chain.size() > 0`. Bug: 209672758 Test: atest 'PerInstance/AttestKeyTest#AllEcCurves/1_android_hardware_security_keymint_IKeyMintDevice_strongbox' Signed-off-by: Brian J Murray Change-Id: I4f7cb4fb1a30f26e6ef15c54714699f6ae91ba36 --- security/keymint/aidl/vts/functional/AttestKeyTest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp index 64550eff2d..73c382092e 100644 --- a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp +++ b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp @@ -583,6 +583,7 @@ TEST_P(AttestKeyTest, AllEcCurves) { attest_key, &attested_key_blob, &attested_key_characteristics, &attested_key_cert_chain)); + ASSERT_GT(attested_key_cert_chain.size(), 0); CheckedDeleteKey(&attested_key_blob); AuthorizationSet hw_enforced = HwEnforcedAuthorizations(attested_key_characteristics); @@ -612,6 +613,7 @@ TEST_P(AttestKeyTest, AllEcCurves) { attest_key, &attested_key_blob, &attested_key_characteristics, &attested_key_cert_chain)); + ASSERT_GT(attested_key_cert_chain.size(), 0); CheckedDeleteKey(&attested_key_blob); CheckedDeleteKey(&attest_key.keyBlob);