1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-10-24 03:48:58 +03:00
Files
libssh2/include
Viktor Szakats 5b94157f1c hostkey, userauth: merge from-filename, from-memory codepaths
In libssh2 for what looks like historical reasons, the codepaths for
reading keys are split for reading them from a file or reading them from
a memory buffer. This split is causing many, otherwise identical code to
be duplicated and living their own lives. It also means getting updates
or fixes separately at times, and generally causing duplicate
maintenance and arguably code bloat. The duplication makes its way into
the internal crypto interface (`crypto.h`) and with it, into each
backend, causing further code duplication and subtly or completely
different behavior (and bugs) depending on sourcing the same key from
file or memory buffer.

These effects are undesired both for using and maintaining libssh2.

Loading files via a distinct code may make sense for large files and/or
on devices with constrained memory, but in practice key files are tiny,
expected to remain so, and many (most?) codepaths already preload the
whole file into a memory buffer, and process it as such anyway.

To avoid code duplication and different behavior, this patch aims to
merge these codepaths, in the hostkey and userauth end of the code.

Closes #2354
2026-07-19 17:16:39 +02:00
..