1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-08-05 20:55:47 +03:00

src: check hash init success

Before this patch, SHA2 and SHA1 init function results were cast to
`void`. This patch makes sure to verify these values.

Also:
- exclude an `assert(0)` from release builds in `_libssh2_sha_algo_ctx_init()`.
  (return error instead)
- fix indentation / whitespace

Reviewed-by: Michael Buckley
Closes #1301
This commit is contained in:
Viktor Szakats
2023-12-27 02:38:49 +00:00
parent f64885b6ab
commit 2ed9eb92f3
4 changed files with 54 additions and 20 deletions

View File

@@ -588,6 +588,7 @@ typedef struct _LIBSSH2_POLLFD {
#define LIBSSH2_ERROR_MISSING_USERAUTH_BANNER -50
#define LIBSSH2_ERROR_ALGO_UNSUPPORTED -51
#define LIBSSH2_ERROR_MAC_FAILURE -52
#define LIBSSH2_ERROR_HASH_INIT -53
/* this is a define to provide the old (<= 1.2.7) name */
#define LIBSSH2_ERROR_BANNER_NONE LIBSSH2_ERROR_BANNER_RECV