mirror of
https://github.com/libssh2/libssh2.git
synced 2026-10-24 03:48:58 +03:00
libgcrypt: fix ssh2_bn_set_word() return value
It was returning a non-NULL address on success, which translated to permanent failure as mapped to this internal crypto API. Fix to match it with the rest of crypto backends and the expectation of callers. Reported by Copilot Bug: https://github.com/libssh2/libssh2/pull/2595#discussion_r3950301182 Follow-up to95c824d5d9#1354 Follow-up toc9d40afa14Closes #2596
This commit is contained in:
@@ -116,7 +116,7 @@
|
||||
|
||||
#define ssh2_bn struct gcry_mpi
|
||||
#define ssh2_bn_init() gcry_mpi_new(0)
|
||||
#define ssh2_bn_set_word(bn, word) gcry_mpi_set_ui(bn, word)
|
||||
#define ssh2_bn_set_word(bn, word) (gcry_mpi_set_ui(bn, word) ? 0 : 1)
|
||||
#define ssh2_bn_from_bin(bn, bin, len) \
|
||||
gcry_mpi_scan(bn, GCRYMPI_FMT_USG, bin, len, NULL)
|
||||
#define ssh2_bn_to_bin(bn, bin) \
|
||||
|
||||
Reference in New Issue
Block a user