Skip to content

Commit

Permalink
Fixing aegis test failure in //mode/opt
Browse files Browse the repository at this point in the history
Summary: Fixing [aegis test failure](https://www.internalfb.com/omh/view/secure_pipes/tests) in //mode/opt

Reviewed By: mingtaoy

Differential Revision: D47417779

fbshipit-source-id: 798de04256593010a2e8b6efc3575e5f54df12ea
  • Loading branch information
Huilin Chen authored and facebook-github-bot committed Jul 13, 2023
1 parent cdfe0b8 commit afd2d9d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fizz/crypto/aead/AEGISCipher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,14 @@ folly::Optional<std::unique_ptr<folly::IOBuf>> AEGISCipher::tryDecrypt(
// Set up the tag buffer now
const auto& lastBuf = ciphertext->prev();
folly::MutableByteRange tagOut;
std::array<uint8_t, kTagLength> tag;
if (lastBuf->length() >= tagLength_) {
// We can directly carve out this buffer from the last IOBuf
// Adjust buffer sizes
lastBuf->trimEnd(tagLength_);

tagOut = {lastBuf->writableTail(), tagLength_};
} else {
std::array<uint8_t, kTagLength> tag;
// buffer to copy the tag into when we decrypt
tagOut = {tag.data(), tagLength_};
trimBytes(*ciphertext, tagOut);
Expand Down

0 comments on commit afd2d9d

Please sign in to comment.