1
1
Paul Capron b3a8a6d27c
Fix _libssh2_random() silently discarding errors (#520)
Notes:
* Make _libssh2_random return code consistent

Previously, _libssh2_random was advertized in HACKING.CRYPTO as
returning `void` (and was implemented that way in os400qc3.c), but that
was in other crypto backends a lie; _libssh2_random is (a macro
expanding) to an int-value expression or function.

Moreover, that returned code was:
  — 0 or success, -1 on error for the MbedTLS & WinCNG crypto backends
But also:
  — 1 on success, -1 or 0 on error for the OpenSSL backend!
  – 1 on success, error cannot happen for libgcrypt!

This commit makes explicit that _libssh2_random can fail (because most of
the underlying crypto functions can indeed fail!), and it makes its result
code consistent: 0 on success, -1 on error.

This is related to issue #519 https://github.com/libssh2/libssh2/issues/519
It fixes the first half of it.

* Don't silent errors of _libssh2_random

Make sure to check the returned code of _libssh2_random(), and
propagates any failure.

A new LIBSSH_ERROR_RANDGEN constant is added to libssh2.h
None of the existing error constants seemed fit.

This commit is related to d74285b68450c0e9ea6d5f8070450837fb1e74a7
and to https://github.com/libssh2/libssh2/issues/519 (see the issue
for more info.)  It closes #519.

Credit:
Paul Capron
2021-05-11 14:06:18 -07:00
2016-02-24 23:44:13 +01:00
2016-03-15 21:58:26 +00:00
2019-08-02 16:38:08 -07:00
2019-06-20 10:47:44 -07:00
2011-04-04 13:31:33 +02:00
2016-02-24 23:44:13 +01:00
2018-08-02 14:00:25 -07:00
2011-04-04 13:31:33 +02:00
2016-02-24 23:44:13 +01:00
2019-06-19 11:11:28 -07:00

libssh2 - SSH2 library

libssh2 is a library implementing the SSH2 protocol, available under the revised BSD license.

Web site

Mailing list

BSD Licensed

Web site source code

Installation instructions:

Описание
The SSH library (BSD license)
https://www.libssh2.org
Readme 4,1 MiB
2023-03-09 23:34:13 +03:00
Languages
C 84.6%
M4 3.2%
Makefile 2.9%
Shell 2.2%
CMake 2.2%
Разное 4.7%