summaryrefslogtreecommitdiff
path: root/security/keymint/aidl/vts/functional/KeyMintTest.cpp
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-05-14 22:49:12 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-05-14 22:49:12 +0000
commit561d79e024996695bc64221868477bd93b8ea573 (patch)
treecfab57b3a66844936c4a3a907300042fafa8284a /security/keymint/aidl/vts/functional/KeyMintTest.cpp
parent36a8274a0c5ef868afe7671a2364a4906522513e (diff)
parentff02c3fc1051488bb8a4e741195c5fe7d6181e68 (diff)
Merge "KeyMint VTS: fix 3DES key sizes" am: 4862e3f6f3 am: 9f4239423d am: ff02c3fc10
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1699808 Change-Id: I26847c3c4f124f774813958ad9b5b93b2c3c83b2
Diffstat (limited to 'security/keymint/aidl/vts/functional/KeyMintTest.cpp')
-rw-r--r--security/keymint/aidl/vts/functional/KeyMintTest.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index cd7d603a09..bcf8b951df 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -3329,7 +3329,7 @@ TEST_P(ImportKeyTest, TripleDesSuccess) {
*/
TEST_P(ImportKeyTest, TripleDesFailure) {
string key = hex2str("a49d7564199e97cb529d2c9d97bf2f98d35edf57ba1f7358");
- uint32_t bitlen = key.size() * 8;
+ uint32_t bitlen = key.size() * 7;
for (uint32_t key_size : {bitlen - 1, bitlen + 1, bitlen - 8, bitlen + 8}) {
// Explicit key size doesn't match that of the provided key.
auto result = ImportKey(AuthorizationSetBuilder()
@@ -3343,19 +3343,19 @@ TEST_P(ImportKeyTest, TripleDesFailure) {
<< "unexpected result: " << result;
}
// Explicit key size matches that of the provided key, but it's not a valid size.
- string long_key = hex2str("a49d7564199e97cb529d2c9d97bf2f98d35edf57ba1f7358");
+ string long_key = hex2str("a49d7564199e97cb529d2c9d97bf2f98d35edf57ba1f735800");
ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
ImportKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .TripleDesEncryptionKey(long_key.size() * 8)
+ .TripleDesEncryptionKey(long_key.size() * 7)
.EcbMode()
.Padding(PaddingMode::PKCS7),
KeyFormat::RAW, long_key));
- string short_key = hex2str("a49d7564199e97cb529d2c9d97bf2f98d35edf57ba1f7358");
+ string short_key = hex2str("a49d7564199e97cb529d2c9d97bf2f98d35edf57ba1f73");
ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
ImportKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
- .TripleDesEncryptionKey(short_key.size() * 8)
+ .TripleDesEncryptionKey(short_key.size() * 7)
.EcbMode()
.Padding(PaddingMode::PKCS7),
KeyFormat::RAW, short_key));