From ee1ccd88babeacc91dbcac3c1e690eaca9e9434d Mon Sep 17 00:00:00 2001 From: Max Bires Date: Tue, 3 Dec 2019 09:42:49 -0800 Subject: [PATCH] Fixing RSA tests not using the correct exponent The Keymaster 4.0 HAL specifies that the public exponent for RSA is F4 (2^16+1). There were a few tests still using 3 as the exponent. This patch updates those incorrect exponents accordingly. Bug: 143404829 Test: atest VtsHalKeymasterV4_0TargetTest Change-Id: Ibc82a8a912bc5926bcdd544e0370e4185a888c0d --- .../vts/functional/keymaster_hidl_hal_test.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 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 0e1228398b..4409bdea57 100644 --- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp +++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp @@ -527,9 +527,9 @@ TEST_F(NewKeyGenerationTest, Rsa) { HidlBuf key_blob; KeyCharacteristics key_characteristics; ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() - .RsaSigningKey(key_size, 3) - .Digest(Digest::NONE) - .Padding(PaddingMode::NONE), + .RsaSigningKey(key_size, 65537) + .Digest(Digest::NONE) + .Padding(PaddingMode::NONE), &key_blob, &key_characteristics)); ASSERT_GT(key_blob.size(), 0U); @@ -579,11 +579,12 @@ TEST_F(NewKeyGenerationTest, NoInvalidRsaSizes) { for (auto key_size : InvalidKeySizes(Algorithm::RSA)) { HidlBuf key_blob; KeyCharacteristics key_characteristics; - ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE, GenerateKey(AuthorizationSetBuilder() - .RsaSigningKey(key_size, 3) - .Digest(Digest::NONE) - .Padding(PaddingMode::NONE), - &key_blob, &key_characteristics)); + ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE, + GenerateKey(AuthorizationSetBuilder() + .RsaSigningKey(key_size, 65537) + .Digest(Digest::NONE) + .Padding(PaddingMode::NONE), + &key_blob, &key_characteristics)); } }