You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
changed the title [-]wolfSSL: libssh2_session_handshake failed -12 and -44[/-][+]wolfSSL: libssh2_session_handshake failed: -12 and -44[/+]on May 2, 2023
changed the title [-]wolfSSL: libssh2_session_handshake failed: -12 and -44[/-][+]wolfSSL: libssh2_session_handshake failed: -12/-44 DECRYPT/ENCRYPT[/+]on May 2, 2023
Reverting the AES-GCM patch #797 / 3c953c0 fixes it.
The issue might be inside openssl.c / _libssh2_cipher_crypt(). Possibly with the interpretation of the return value of EVP_Cipher(), or EVP_CIPHER_CTX_ctrl().
Update: reverting locally the patches for 0048f30 and 3c953c0 did not solve the problem.
Here is one additional data point: this only happens on an M1 Mac connecting to an M1 Mac, or a CentOS machine. It does not happen from an Intel Mac to those systems, and does not happen with iPhone/iPad on device or simulator.
In case someone else runs into this: the issue on the M1 Mac was not related to the AES-GCM patch, that's why it did not make a difference. For some reason the version of OpenSSL I was using on Mac on ARM did not include the LIBSSH2_EC_CURVE_NISTP256 (NID_X9_62_prime256v1) curve, so the call to _libssh2_ecsa_curve_name_with_octal_new was failing which in turn made curve25519_sha256 fail.
Mind you, this code was not being triggered with the currently public version of libssh2
I was able to reproduce the failures you're seeing here. Some failures are being caused by our AES-GCM streaming support not being enabled, you can enable this support while building wolfSSL by passing --enable-aesgcm-stream to ./configure. I will add this to --enable-libssh2 once I've confirmed it's working as expected.
I am still working on debugging the remaining test failures.
Opened a PR to detect AES-GCM via WOLFSSL_AESGCM_STREAM (instead of HAVE_AESGCM): #1045
Does this look correct to you?
I think it'd be useful for most users if the Homebrew package came enabled with everything necessary for AES-GCM. At the moment it lists --enable-aesgcmtwice, perhaps one of those was to meant to enable stream support? (as for DSA and DES3, I think the they are OK as disabled by default, libssh2 will adapt.)
Building wolfSSL from source in CI requires constant maintenance (bumping on each upgrade). Also makes CI builds much slower and complex. I'd like to avoid this and rely on package defaults. This is also what users will encounter on this platform by default.
This particular issue is also present with AES-GCM disabled, so keeping it open.
Activity
[-]wolfSSL: libssh2_session_handshake failed -12 and -44[/-][+]wolfSSL: libssh2_session_handshake failed: -12 and -44[/+][-]wolfSSL: libssh2_session_handshake failed: -12 and -44[/-][+]wolfSSL: libssh2_session_handshake failed: -12/-44 DECRYPT/ENCRYPT[/+]vszakats commentedon May 2, 2023
Reverting the AES-GCM patch #797 / 3c953c0 fixes it.
The issue might be inside
openssl.c/_libssh2_cipher_crypt(). Possibly with the interpretation of the return value ofEVP_Cipher(), orEVP_CIPHER_CTX_ctrl().@dfandrich Can you take a look?
The issue happens with both AES-GCM disabled for wolfSSL (as in master) or enabled.
UPDATE: Now enabled in master: df513c0.
openssl: enable AES-GCM with wolfSSL
dfandrich commentedon May 3, 2023
I'll take a look.
migueldeicaza commentedon May 9, 2023
I also have one user getting this error with OpenSSL, the trace looks like this:
https://gist.github.com/migueldeicaza/da684d07f91716ddefafe6ef298c3d64
migueldeicaza commentedon May 9, 2023
Update: reverting locally the patches for 0048f30 and 3c953c0 did not solve the problem.
Here is one additional data point: this only happens on an M1 Mac connecting to an M1 Mac, or a CentOS machine. It does not happen from an Intel Mac to those systems, and does not happen with iPhone/iPad on device or simulator.
migueldeicaza commentedon May 9, 2023
In case someone else runs into this: the issue on the M1 Mac was not related to the AES-GCM patch, that's why it did not make a difference. For some reason the version of OpenSSL I was using on Mac on ARM did not include the
LIBSSH2_EC_CURVE_NISTP256(NID_X9_62_prime256v1) curve, so the call to_libssh2_ecsa_curve_name_with_octal_newwas failing which in turn madecurve25519_sha256fail.Mind you, this code was not being triggered with the currently public version of libssh2
kareem-wolfssl commentedon May 24, 2023
Hi @vszakats ,
I was able to reproduce the failures you're seeing here. Some failures are being caused by our AES-GCM streaming support not being enabled, you can enable this support while building wolfSSL by passing --enable-aesgcm-stream to ./configure. I will add this to --enable-libssh2 once I've confirmed it's working as expected.
I am still working on debugging the remaining test failures.
I would strongly recommend you manually build wolfSSL with
--enable-libssh2 --enable-aesgcm-streamfor your tests. The test appears to be using the Brew package of wolfSSL, which does not enable DES3, DSA or AES-CTR: https://github.com/Homebrew/homebrew-core/blob/7fd778f54e75e1f9f85f41486094a7182225d839/Formula/wolfssl.rb These algorithms are enabled by --enable-libssh2, and if they aren't enabled they will cause additional test failures.wolfssl.sh: enable AES-GCM stream [ci skip]
wolfssl: fix detection of AES-GCM feature
vszakats commentedon May 25, 2023
@kareem-wolfssl, thanks for jumping in!
Opened a PR to detect AES-GCM via
WOLFSSL_AESGCM_STREAM(instead ofHAVE_AESGCM): #1045Does this look correct to you?
I think it'd be useful for most users if the Homebrew package came enabled with everything necessary for AES-GCM. At the moment it lists
--enable-aesgcmtwice, perhaps one of those was to meant to enable stream support? (as for DSA and DES3, I think the they are OK as disabled by default, libssh2 will adapt.)Building wolfSSL from source in CI requires constant maintenance (bumping on each upgrade). Also makes CI builds much slower and complex. I'd like to avoid this and rely on package defaults. This is also what users will encounter on this platform by default.
This particular issue is also present with AES-GCM disabled, so keeping it open.
15 remaining items
ci/GHA: add Linux job with latest wolfSSL built from source
ci/GHA: add Linux job with latest wolfSSL built from source
ci/GHA: add Linux job with latest wolfSSL built from source
wolfssl: require v5.4.0 for AES-GCM
wolfssl: require v5.4.0 for AES-GCM
wolfssl: require v5.4.0 for AES-GCM
wolfssl: fix `EVP_Cipher()` use with v5.6.0 and older
openssl: enable AES-GCM with wolfSSL
wolfssl: fix detection of AES-GCM feature
ci/GHA: add Linux job with latest wolfSSL built from source
wolfssl: require v5.4.0 for AES-GCM
wolfssl: fix `EVP_Cipher()` use with v5.6.0 and older