Skip to content

Fix another AES-GCM EVP control command issue. - #5205

Merged
dgarske merged 1 commit into
wolfSSL:masterfrom
haydenroche5:evp_cipher_aes_gcm
Jun 3, 2022
Merged

dgarske merged 1 commit into
wolfSSL:masterfrom
haydenroche5:evp_cipher_aes_gcm

Conversation

@haydenroche5

@haydenroche5 haydenroche5 commented Jun 2, 2022 •

Copy link
Copy Markdown
Contributor

Description

With PR 5170, I added logic that requires a EVP_CTRL_GCM_SET_IV_FIXED command be issued before a EVP_CTRL_GCM_IV_GEN command. This matches OpenSSL's behavior. However, OpenSSL also clears the flag enabling EVP_CTRL_GCM_IV_GEN after EVP_CTRL_GCM_SET_IV_FIXED if EVP_CipherInit is called with a NULL key. Otherwise, the flag retains its value. We didn't mirror this logic, and that caused problems in OpenSSH unit testing. This commit aligns our logic with OpenSSL's and adds a regression test to test_evp_cipher_aes_gcm for this case.

Testing

  • Wrote a simple test program and confirmed OpenSSL and wolfSSL behavior match after this commit.
  • This commit resolved OpenSSH 8.5p1 unit test failures.
  • Added the above mentioned regression test to our unit tests.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

With PR 5170, I added logic that requires a EVP_CTRL_GCM_SET_IV_FIXED command be
issued before a EVP_CTRL_GCM_IV_GEN command. This matches OpenSSL's behavior.
However, OpenSSL also clears the flag enabling EVP_CTRL_GCM_IV_GEN after
EVP_CTRL_GCM_SET_IV_FIXED if EVP_CipherInit is called with a NULL key.
Otherwise, the flag retains its value. We didn't mirror this logic, and that
caused problems in OpenSSH unit testing. This commit aligns our logic with
OpenSSL's and adds a regression test to test_evp_cipher_aes_gcm for this case.
@haydenroche5 haydenroche5 self-assigned this Jun 2, 2022
@haydenroche5
haydenroche5 requested review from SparkiDev and dgarske June 3, 2022 17:29
@haydenroche5 haydenroche5 assigned dgarske and unassigned haydenroche5 Jun 3, 2022
@dgarske
dgarske merged commit 2af09a7 into wolfSSL:master Jun 3, 2022
vszakats added a commit to libssh2/libssh2 that referenced this pull request Jun 24, 2024
Earlier versions crash while running tests.

This patch is part of a series of fixes to make wolfSSL AES-GCM support
work together with libssh2.

Possibly related is this wolfSSL bugfix patch, released in v5.4.0:
wolfSSL/wolfssl#5205
wolfSSL/wolfssl@fb3c611
"Fix another AES-GCM EVP control command issue"

Ref: #1020
Ref: #1299
Cherry-picked from #1407
Closes #1411
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
Earlier versions crash while running tests.

This patch is part of a series of fixes to make wolfSSL AES-GCM support
work together with libssh2.

Possibly related is this wolfSSL bugfix patch, released in v5.4.0:
wolfSSL/wolfssl#5205
wolfSSL/wolfssl@fb3c611
"Fix another AES-GCM EVP control command issue"

Ref: libssh2#1020
Ref: libssh2#1299
Cherry-picked from libssh2#1407
Closes libssh2#1411
vszakats added a commit to libssh2/libssh2 that referenced this pull request Jun 17, 2026
To enable support AES-GCM for both, and ed25519 for LibreSSL.

wolfSSL requires this version for AES-GCM due to bug:
wolfSSL/wolfssl#5205
(Before this, libssh2 tests crash with AES-GCM enabled)

Also:
- openssl: add in-source version check for LibreSSL, OpenSSL and
  wolfSSL.
- openssl: include `openssl/opensslv.h` to rely on other headers pulling
  it in.
- cmake: add version check for wolfSSL.
- mbedtls: do the in-source version check earlier. To match openssl.
- sync up wording for #error messages

Follow-up to 16ef3a2 #2008

Closes #2073
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants