Skip to content

Commit

Permalink
Adds smaller seq num assert
Browse files Browse the repository at this point in the history
  • Loading branch information
maddeleine committed Jul 9, 2024
1 parent 246bd94 commit 34dd912
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crypto/cipher_extra/aead_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,12 @@ TEST(AEADTest, TestMonotonicityCheck) {
sizeof(ciphertext), nonce, sizeof(nonce), plaintext,
sizeof(plaintext), nullptr /* ad */, 0));
}

// Attempting to encrypt with a decreased sequence number causes the monotonicity check to fail.
nonce[last_byte] = 0;
ASSERT_FALSE(EVP_AEAD_CTX_seal(encrypt_ctx.get(), ciphertext, &out_len,
sizeof(ciphertext), nonce, sizeof(nonce), plaintext,
sizeof(plaintext), nullptr /* ad */, 0));
}
}

Expand Down

0 comments on commit 34dd912

Please sign in to comment.