1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-10-24 03:48:58 +03:00
Viktor Szakats b560cb4c7b crypto: de-duplicate/merge most file/blob codepaths
Replace separate codepath for loading private keys from filenames vs.
memory buffers (blobs), with unified functions that handle both. Either
filename or blob pointer + size must be passed to these functions.

To reduce code duplication and small/large differences and bugs between
these codepaths. Also to improve readability and ease maintenance.

Also fix:
- mbedtls: do not pass redundant null-terminator to
  `mbed_parse_openssh_key()` on in ECDSA blob codepath. (benign)
- libgcrypt: add support for RSA/DSA blobs.
- openssl: error handling code now applies to from-file codepath.
  Reported-and-alternate-patch-by: Martin Nowak
  Fixes #1652
- openssl: add file support for `ssh2_sk_pubkey()`.
  (not exposed via public API at this time.)
- openssl: fix to call `OSSL_INIT_IF_NEEDED()` from
  `ssh2_pub_privkey()`. (for wolfSSL-debug enabled builds.)
- openssl: fix error code returned by `ssh2_sk_pubkey()`.
  (to be consistent with rest of code.)
- openssl: fix potential NULL deref in `ssh2_ed25519_new_priv()` blob
  codepaths.
- openssl: fix potential dangling pointer in RSA, DSA, ECDSA codepaths
  (both file and blob) if BIO init failed.
- os400qc3: fix uninitialized structs in `os400_pub_privkey_*()`.
- os400qc3: drop unused local variable.

Notes:
- os400: use wrappers without actually merging the code.
  They are very different and difficult to read, also not possible to
  build test.
- openssl: ed25519 loader code has outlier code where the file/blob code
  is different (both rather short.)
- openssl: there is a file/blob function pair left to merge.
- pem: there remain two pairs of file/blob internal APIs.

Follow-up to 6a951168ce #2362
Follow-up to fe9442be4d #2359
Follow-up to 5b94157f1c #2354

Closes #2379
2026-07-21 19:34:19 +02:00
2026-07-21 00:22:39 +02:00
2026-07-16 03:55:53 +02:00
2026-04-10 18:39:11 +02:00
2026-07-16 03:55:53 +02:00
2023-06-07 08:18:55 +02:00
2023-08-18 11:20:58 +00:00
2011-04-04 13:31:33 +02: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:

Description
libssh2 - это библиотека, реализующая протокол SSH2, доступная по пересмотренной лицензии BSD
Readme 26 MiB
Languages
C 84.2%
CMake 3.7%
Perl 3.2%
M4 2.7%
Shell 2.3%
Other 3.7%