Skip to content

Conversation

willco007
Copy link
Member

File: libssh2.h

Notes:
Update the min, preferred and max DH group values based on RFC 8270.

Credit:
Will Cosgrove, noted from email list by Mitchell Holland

File: libssh2.h

Notes:
Update the min, preferred and max DH group values based on RFC 8270.

Credit:
Will Cosgrove, noted from email list by Mitchell Holland
@willco007 willco007 merged commit 1c3a03e into master Jul 1, 2020
@willco007 willco007 deleted the willco007-patch-1 branch July 1, 2020 18:37
willco007 added a commit to willco007/libssh2 that referenced this pull request Sep 2, 2020
File: libssh2.h

Notes:
Update the min, preferred and max DH group values based on RFC 8270.

Credit:
Will Cosgrove, noted from email list by Mitchell Holland
cy384 pushed a commit to cy384/opentransport-libssh2 that referenced this pull request Jan 9, 2021
File: libssh2.h

Notes:
Update the min, preferred and max DH group values based on RFC 8270.

Credit:
Will Cosgrove, noted from email list by Mitchell Holland
vszakats pushed a commit that referenced this pull request Apr 29, 2024
In 1c3a03e #493,
`LIBSSH2_DH_GEX_MAXGROUP` was introduced to specify
crypto-backend-specific modulus sizes. Unfortunately, the max size for
the wincng DH modulus was defined to 8192, probably because this is the
value most other backends support.

According to Microsoft documentation [1], `BCryptGenerateKeyPair`
currently only supports up to 4096-bit keys when the selected algorithm
is `BCRYPT_DH_ALGORITHM`. Requesting larger keys when calling
`BCryptGenerateKeyPair` in `_libssh2_dh_key_pair` always results in
`STATUS_INVALID_PARAMETER` being returned and ultimately key exchange
failing.

When attempting to connect to any server that offers 8192 bit DH, this
causes key exchange to always fail when using the wincng backend.
Reducing `LIBSSH2_DH_GEX_MAXGROUP` to 4096 fixes the issue.

[1] https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgeneratekeypair

Closes #1372
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
In 1c3a03e libssh2#493,
`LIBSSH2_DH_GEX_MAXGROUP` was introduced to specify
crypto-backend-specific modulus sizes. Unfortunately, the max size for
the wincng DH modulus was defined to 8192, probably because this is the
value most other backends support.

According to Microsoft documentation [1], `BCryptGenerateKeyPair`
currently only supports up to 4096-bit keys when the selected algorithm
is `BCRYPT_DH_ALGORITHM`. Requesting larger keys when calling
`BCryptGenerateKeyPair` in `_libssh2_dh_key_pair` always results in
`STATUS_INVALID_PARAMETER` being returned and ultimately key exchange
failing.

When attempting to connect to any server that offers 8192 bit DH, this
causes key exchange to always fail when using the wincng backend.
Reducing `LIBSSH2_DH_GEX_MAXGROUP` to 4096 fixes the issue.

[1] https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgeneratekeypair

Closes libssh2#1372
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.

1 participant