Test CRYPTO_gcm128_tag in gcm_test.cc. CRYPTO_gcm128_encrypt should be paired with CRYPTO_gcm128_tag, not CRYPTO_gcm128_finish. Change-Id: Ia3023a196fe5b613e9309b5bac19ea849dbc33b7 Reviewed-on: https://boringssl-review.googlesource.com/c/34265 Commit-Queue: Adam Langley <agl@google.com> Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/fipsmodule/modes/gcm_test.cc b/crypto/fipsmodule/modes/gcm_test.cc index a6b7fc0..16d9d09 100644 --- a/crypto/fipsmodule/modes/gcm_test.cc +++ b/crypto/fipsmodule/modes/gcm_test.cc
@@ -90,7 +90,10 @@ CRYPTO_gcm128_encrypt(&ctx, &aes_key, plaintext.data(), out.data(), plaintext.size()); } - ASSERT_TRUE(CRYPTO_gcm128_finish(&ctx, tag.data(), tag.size())); + + std::vector<uint8_t> got_tag(tag.size()); + CRYPTO_gcm128_tag(&ctx, got_tag.data(), got_tag.size()); + EXPECT_EQ(Bytes(tag), Bytes(got_tag)); EXPECT_EQ(Bytes(ciphertext), Bytes(out)); CRYPTO_gcm128_setiv(&ctx, &aes_key, nonce.data(), nonce.size());