Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a01b8259 authored by David Drysdale's avatar David Drysdale Committed by Automerger Merge Worker
Browse files

Merge "KeyMint VTS: allow for stricter SharedSecret impls" am: f854cde5

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1749644

Change-Id: I4c1faec6657066df55c9c15b3d4938b28cf07e7a
parents 201b0831 f854cde5
Loading
Loading
Loading
Loading
+20 −8
Original line number Original line Diff line number Diff line
@@ -268,10 +268,16 @@ TEST_F(SharedSecretAidlTest, ComputeSharedSecretShortNonce) {
                    << "Shared secret service that provided tweaked param should fail to compute "
                    << "Shared secret service that provided tweaked param should fail to compute "
                       "shared secret";
                       "shared secret";
        } else {
        } else {
            EXPECT_EQ(ErrorCode::OK, responses[i].error) << "Others should succeed";
            // Other services *may* succeed, or may notice the invalid size for the nonce.
            // However, if another service completes the computation, it should get the 'wrong'
            // answer.
            if (responses[i].error == ErrorCode::OK) {
                EXPECT_NE(correct_response, responses[i].sharing_check)
                EXPECT_NE(correct_response, responses[i].sharing_check)
                        << "Others should calculate a different shared secret, due to the tweaked "
                        << "Others should calculate a different shared secret, due to the tweaked "
                           "nonce.";
                           "nonce.";
            } else {
                EXPECT_EQ(ErrorCode::INVALID_ARGUMENT, responses[i].error);
            }
        }
        }
    }
    }
}
}
@@ -348,10 +354,16 @@ TEST_F(SharedSecretAidlTest, ComputeSharedSecretShortSeed) {
                    << "Shared secret service that provided tweaked param should fail to compute "
                    << "Shared secret service that provided tweaked param should fail to compute "
                       "shared secret";
                       "shared secret";
        } else {
        } else {
            EXPECT_EQ(ErrorCode::OK, responses[i].error) << "Others should succeed";
            // Other services *may* succeed, or may notice the invalid size for the seed.
            // However, if another service completes the computation, it should get the 'wrong'
            // answer.
            if (responses[i].error == ErrorCode::OK) {
                EXPECT_NE(correct_response, responses[i].sharing_check)
                EXPECT_NE(correct_response, responses[i].sharing_check)
                        << "Others should calculate a different shared secret, due to the tweaked "
                        << "Others should calculate a different shared secret, due to the tweaked "
                       "nonce.";
                           "seed.";
            } else {
                EXPECT_EQ(ErrorCode::INVALID_ARGUMENT, responses[i].error);
            }
        }
        }
    }
    }
}
}