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

Commit 47871581 authored by Bill Richardson's avatar Bill Richardson
Browse files

Fix segfault in EncryptionOperationsTest.RsaPkcs1Success



This test tries to modify an encrypted message to ensure that the
result can't be decrypted, but if encrypting the messsage fails
first then there's nothing to modify.

Bug: None
Test: Ran against a Strongbox implementation that refuses to
      encrypt the message using Digest::NONE
Signed-off-by: default avatarBill Richardson <wfrichar@google.com>
Change-Id: Ib4d389a47702edd56a4e7d2b334dc89d0c3972a1
parent 0b12cea8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2562,7 +2562,8 @@ TEST_P(EncryptionOperationsTest, RsaPkcs1Success) {
    string message = "Hello World!";
    auto params = AuthorizationSetBuilder().Padding(PaddingMode::RSA_PKCS1_1_5_ENCRYPT);
    string ciphertext1 = EncryptMessage(message, params);
    EXPECT_EQ(2048U / 8, ciphertext1.size());
    // Die here on failure because we try to modify ciphertext1 below
    ASSERT_EQ(2048U / 8, ciphertext1.size()) << "Failed to encrypt the message";

    string ciphertext2 = EncryptMessage(message, params);
    EXPECT_EQ(2048U / 8, ciphertext2.size());