summaryrefslogtreecommitdiffstats
path: root/keymaster
diff options
context:
space:
mode:
authornagendra modadugu <ngm@google.com>2018-06-25 19:56:35 -0700
committerKeun Soo Yim <yim@google.com>2018-08-28 15:17:31 -0700
commit8414fb8556182a9f03cd230b30258453614a9541 (patch)
tree9d6c8c08def0b6d2663b179a541c084b754f5e56 /keymaster
parente1e08f8ddeaff517eb51851d5a97bd3980307a38 (diff)
downloadandroid_hardware_interfaces-8414fb8556182a9f03cd230b30258453614a9541.tar.gz
android_hardware_interfaces-8414fb8556182a9f03cd230b30258453614a9541.tar.bz2
android_hardware_interfaces-8414fb8556182a9f03cd230b30258453614a9541.zip
keymaster: spec does not require that update produce output
Remove out of spec enforcement on the amount of data returned by update, as this is not specified in the HAL. Bug: 109771020 Test: yes it is Merged-In: Ic41afbd01d51faf48d3c0fe090409ebcd257cc1e Change-Id: Ic41afbd01d51faf48d3c0fe090409ebcd257cc1e (cherry picked from commit 7b75f015a7a7ebc40722fd4f36c9ca70e7e58e59)
Diffstat (limited to 'keymaster')
-rw-r--r--keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp7
1 files changed, 4 insertions, 3 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 c327d9f8c..5dc0c7faf 100644
--- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
+++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -3005,6 +3005,7 @@ TEST_F(EncryptionOperationsTest, AesGcmAadNoData) {
* Verifies that AES GCM mode works when provided additional authenticated data in multiple chunks.
*/
TEST_F(EncryptionOperationsTest, AesGcmMultiPartAad) {
+ const size_t tag_bits = 128;
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
.AesEncryptionKey(128)
@@ -3016,7 +3017,7 @@ TEST_F(EncryptionOperationsTest, AesGcmMultiPartAad) {
auto begin_params = AuthorizationSetBuilder()
.BlockMode(BlockMode::GCM)
.Padding(PaddingMode::NONE)
- .Authorization(TAG_MAC_LENGTH, 128);
+ .Authorization(TAG_MAC_LENGTH, tag_bits);
AuthorizationSet begin_out_params;
auto update_params =
@@ -3038,10 +3039,11 @@ TEST_F(EncryptionOperationsTest, AesGcmMultiPartAad) {
EXPECT_EQ(ErrorCode::OK, Update(op_handle_, update_params, message, &update_out_params,
&ciphertext, &input_consumed));
EXPECT_EQ(message.size(), input_consumed);
- EXPECT_EQ(message.size(), ciphertext.size());
EXPECT_TRUE(update_out_params.empty());
EXPECT_EQ(ErrorCode::OK, Finish("" /* input */, &ciphertext));
+ // Expect 128-bit (16-byte) tag appended to ciphertext.
+ EXPECT_EQ(message.size() + (tag_bits >> 3), ciphertext.size());
// Grab nonce.
begin_params.push_back(begin_out_params);
@@ -3097,7 +3099,6 @@ TEST_F(EncryptionOperationsTest, AesGcmAadOutOfOrder) {
EXPECT_EQ(ErrorCode::OK, Update(op_handle_, update_params, message, &update_out_params,
&ciphertext, &input_consumed));
EXPECT_EQ(message.size(), input_consumed);
- EXPECT_EQ(message.size(), ciphertext.size());
EXPECT_TRUE(update_out_params.empty());
// More AAD