Commit Graph

1793 Commits

Author SHA1 Message Date
Patrick Monnerat
002db176b7 os400: fix an ILE/RPG prototype 2016-01-18 13:35:28 +01:00
Patrick Monnerat
7a37c33264 os400: implement character encoding conversion support 2016-01-18 13:35:28 +01:00
Patrick Monnerat
914157804f os400: do not miss some external prototypes
Build procedure extproto() did not strip braces from header files, thus
possibly prepended them to true prototypes. This prevented the prototype to
be recognized as such.
The solution implemented here is to map braces to semicolons, effectively
considering them as potential prototype delimiters.
2016-01-18 13:35:28 +01:00
Patrick Monnerat
4c4d6a8da4 os400: Really add specific README 2016-01-18 13:35:28 +01:00
Patrick Monnerat
c367e61294 os400: Add specific README and include new files in dist tarball 2016-01-18 13:35:28 +01:00
Patrick Monnerat
d900984b0a os400: add compilation scripts 2016-01-18 13:35:28 +01:00
Patrick Monnerat
4bd6d7ebf6 os400: include files for ILE/RPG
In addition, file os400/macros.h declares all procedures originally
defined as macros. It must not be used for real inclusion and is only
intended to be used as a `database' for macro wrapping procedures generation.
2016-01-18 13:35:28 +01:00
Patrick Monnerat
dac4b3bac3 os400: add supplementary header files/wrappers. Define configuration. 2016-01-18 13:35:28 +01:00
Patrick Monnerat
7dcf5ed6fb Protect callback function calls from macro substitution
Some structure fields holding callback addresses have the same name as the
underlying system function (connect, send, recv). Set parentheses around
their reference to suppress a possible macro substitution.

Use a macro for connect() on OS/400 to resolve a const/nonconst parameter
problem.
2016-01-18 13:35:28 +01:00
Patrick Monnerat
8ba6bf2aef Add interface for OS/400 crypto library QC3 2016-01-18 13:35:28 +01:00
Patrick Monnerat
0fba5cfda6 misc: include stdarg.h for debug code 2016-01-18 13:35:28 +01:00
Patrick Monnerat
72bedfe761 Document crypto library interface 2016-01-18 13:35:28 +01:00
Patrick Monnerat
f915a31a4d Feature an optional crypto-specific macro to rsa sign a data fragment vector
OS/400 crypto library is unable to sign a precomputed SHA1 hash: however
it does support a procedure that hashes data fragments and rsa signs.
If defined, the new macro _libssh2_rsa_sha1_signv() implements this function
and disables use of _libssh2_rsa_sha1_sign().

The function described above requires that the struct iovec unused slacks are
cleared: for this reason, macro libssh2_prepare_iovec() has been introduced.
It should be defined as empty for crypto backends that are not sensitive
to struct iovec unused slack values.
2016-01-18 13:35:28 +01:00
Patrick Monnerat
0fbf8f3c7e Fold long lines in include files 2016-01-18 13:35:28 +01:00
Viktor Szakats
e64260a117 kex.c: fix indentation
Closes #71
2016-01-17 17:11:58 +01:00
Viktor Szakats
ed2c3c8d28 add OpenSSL-1.1.0-pre2 compatibility
Closes #70
2016-01-17 17:10:45 +01:00
Viktor Szakats
73930e6577 add OpenSSL 1.1.0-pre1 compatibility
* close https://github.com/libssh2/libssh2/issues/69
* sync a declaration with the rest of similar ones
* handle EVP_MD_CTX_new() returning NULL with OpenSSL 1.1.0
* fix potential memory leak with OpenSSL 1.1.0 in
  _libssh2_*_init() functions, when EVP_MD_CTX_new() succeeds,
  but EVP_DigestInit() fails.
2016-01-17 17:10:32 +01:00
Marc Hoersken
cf544d0f4c wincng.c: fixed _libssh2_wincng_hash_final return value
_libssh2_wincng_hash_final was returning the internal BCRYPT
status code instead of a valid libssh2 return value (0 or -1).

This also means that _libssh2_wincng_hash never returned 0.
2015-12-22 13:38:10 +01:00
Marc Hoersken
d0ffeba72e wincng.c: fixed possible memory leak in _libssh2_wincng_hash
If _libssh2_wincng_hash_update failed _libssh2_wincng_hash_final
would never have been called before.

Reported by Zenju.
2015-12-22 13:36:56 +01:00
Paul Howarth
9bf32da607 libssh2.pc.in: fix the output of pkg-config --libs
... such that it does not include LDFLAGS used to build libssh2 itself.
There was a similar fix in the curl project long time ago:

https://github.com/bagder/curl/commit/curl-7_19_7-56-g4c8adc8

Bug: https://bugzilla.redhat.com/1279966
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
2015-12-15 10:57:50 +01:00
Marc Hoersken
95dc2a6a52 hostkey.c: align code path of ssh_rsa_init to ssh_dss_init 2015-12-06 21:35:09 +01:00
Marc Hoersken
036196b0b0 hostkey.c: fix invalid memory access if libssh2_dsa_new fails
Reported by dimmaq, fixes #66
2015-12-06 21:34:54 +01:00
Will Cosgrove
51dcded3eb gcrypt: define libssh2_sha256_ctx
Looks like it didn't make it into the latest commit for whatever reason.

Closes #58
2015-11-03 07:43:32 +01:00
Salvador Fandino
b83c3e056e libssh2_session_set_last_error: Add function
Net::SSH2, the Perl wrapping module for libssh2 implements several features*
on top of libssh2 that can fail and so need some mechanism to report the error
condition to the user.

Until now, besides the error state maintained internally by libssh2, another
error state was maintained at the Perl level for every session object and then
additional logic was used to merge both error states. That is a maintenance
nighmare, and actually there is no way to do it correctly and consistently.

In order to allow the high level language to add new features to the library
but still rely in its error reporting features the new function
libssh2_session_set_last_error (that just exposses _libssh2_error_flags) is
introduced.

*) For instance, connecting to a remote SSH service giving the hostname and
port.

Signed-off-by: Salvador Fandino <sfandino@yahoo.com>
Signed-off-by: Salvador Fandiño <sfandino@yahoo.com>
2015-11-02 14:50:15 +01:00
Salvador Fandino
ad23faaae6 _libssh2_error: Support allocating the error message
Before this patch "_libssh2_error" required the error message to be a
static string.

This patch adds a new function "_libssh2_error_flags" accepting an
additional "flags" argument and specifically the flag
"LIBSSH2_ERR_FLAG_DUP" indicating that the passed string must be
duplicated into the heap.

Then, the method "_libssh2_error" has been rewritten to use that new
function under the hood.

Signed-off-by: Salvador Fandino <sfandino@yahoo.com>
Signed-off-by: Salvador Fandiño <sfandino@yahoo.com>
2015-11-02 14:49:54 +01:00
Will Cosgrove
d441da3086 added engine.h include to fix warning 2015-10-05 10:52:52 +02:00
sune
ad26fd92cf kex.c: removed dupe entry from libssh2_kex_methods[]
Closes #51
2015-10-05 10:50:34 +02:00
Salvador Fandiño
4d97ed92b2 userauth: Fix off by one error when reading public key file
After reading the public key from file the size was incorrectly
decremented by one.

This was usually a harmless error as the last character on the public
key file is an unimportant EOL. But if due to some error the public key
file is empty, the public key size becomes (uint)(0 - 1), resulting in
an unrecoverable out of memory error later.

Signed-off-by: Salvador Fandi??o <sfandino-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>
2015-09-29 09:48:48 +02:00
Salvador Fandino
fb432f3f78 channel: Detect bad usage of libssh2_channel_process_startup
A common novice programmer error (at least among those using the
wrapping Perl module Net::SSH2), is to try to reuse channels.

This patchs detects that incorrect usage and fails with a
LIBSSH2_ERROR_BAD_USE error instead of hanging.

Signed-off-by: Salvador Fandino <sfandino-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>
2015-09-29 09:48:36 +02:00
Will Cosgrove
fc4a969a05 kex: Added diffie-hellman-group-exchange-sha256 support
... and fixed HMAC_Init depricated usage

Closes #48
2015-09-29 09:43:30 +02:00
Alexander Lamaison
92fff06e27 Prefixed new #defines to prevent collisions.
Other libraries might have their own USE_WIN32_*FILES.
2015-09-21 18:44:48 +01:00
keith-daigle
a49f479b4c Update examples/scp.c to fix bug where large files on win32 would cause got to wrap and go negative 2015-09-21 18:01:24 +01:00
David Byron
6c84a426be add libssh2_scp_recv2 to support large (> 2GB) files on windows 2015-09-21 18:01:23 +01:00
sune
4961014033 WinCNG: support for SHA256/512 HMAC
Closes #47
2015-09-17 15:27:30 +02:00
brian m. carlson
a53cebba34 Add support for HMAC-SHA-256 and HMAC-SHA-512.
Implement support for these algorithms and wire them up to the libgcrypt
and OpenSSL backends.  Increase the maximum MAC buffer size to 64 bytes
to prevent buffer overflows.  Prefer HMAC-SHA-256 over HMAC-SHA-512, and
that over HMAC-SHA-1, as OpenSSH does.

Closes #40
2015-09-16 09:32:19 +02:00
Zenju
3768f8aeef kex: free server host key before allocating it (again)
Fixes a memory leak when Synology server requests key exchange

Closes #43
2015-09-12 12:30:13 +02:00
Viktor Szakats
3acca4ad15 GNUmakefile: up OpenSSL version
closes #23
2015-09-04 08:17:57 +02:00
Viktor Szakats
026ec0e881 GNUmakefile: add -m64 CFLAGS when targeting mingw64, add -m32/-m64 to LDFLAGS
libssh2 equivalent of curl patch d21b66835f

This allows to build for the non-default target when using a multi-target mingw distro.
Also bump default OpenSSL dependency path to 1.0.2c.
2015-09-04 08:17:51 +02:00
Viktor Szakats
a4d995af0d GNUmakefile: add support for LIBSSH2_LDFLAG_EXTRAS
It is similar to existing LIBSSH2_CFLAG_EXTRAS, but for
extra linker options.

Also delete some line/file ending whitespace.

closes #27
2015-08-07 00:38:40 +02:00
nasacj
9af7eb48dc hostkey.c: Fix compiling error when OPENSSL_NO_MD5 is defined
Closes #32
2015-08-07 00:36:23 +02:00
Mizunashi Mana
f4b5947d6d openssl.h: adjust the rsa/dsa includes
... to work when built without DSA support.

Closes #36
2015-08-07 00:34:36 +02:00
Alexander Lamaison
36f6d23572 Let CMake build work as a subproject.
Patch contributed by JasonHaslam.
2015-07-26 10:50:41 +01:00
Alexander Lamaison
af14462d53 Fix builds with Visual Studio 2015.
VS2015 moved stdio functions to the header files as inline function.  That means check_function_exists can't detect them because it doesn't use header files - just does a link check.  Instead we need to use check_symbol_exists with the correct headers.
2015-07-25 22:19:46 +01:00
Kamil Dudka
d48d7c3a87 cmake: include CMake files in the release tarballs
Despite we announced the CMake support in libssh2-1.6.0 release notes,
the files required by the CMake build system were not included in the
release tarballs.  Hence, the only way to use CMake for build was the
upstream git repository.

This commit makes CMake actually supported in the release tarballs.
2015-07-02 13:09:49 +02:00
Kamil Dudka
13f8addd1b tests/mansyntax.sh: fix 'make distcheck' with recent autotools
Do not create symbolic links off the build directory.  Recent autotools
verify that out-of-source build works even if the source directory tree
is not writable.
2015-07-02 12:42:55 +02:00
Kamil Dudka
418be878ad openssl: fix memleak in _libssh2_dsa_sha1_verify() 2015-06-12 12:05:27 +02:00
Daniel Stenberg
e9536edede openssl: make libssh2_sha1 return error code
- use the internal prefix _libssh2_ for non-exported functions

- removed libssh2_md5() since it wasn't used

Reported-by: Kamil Dudka
2015-06-12 10:53:18 +02:00
LarsNordin-LNdata
d754fee2f2 SFTP: Increase speed and datasize in SFTP read
The function sftp_read never return more then 2000 bytes (as it should
when I asked Daniel). I increased the MAX_SFTP_READ_SIZE to 30000 but
didn't get the same speed as a sftp read in SecureSSH. I analyzed the
code and found that a return always was dona when a chunk has been read.
I changed it to a sliding buffer and worked on all available chunks. I
got an increase in speed and non of the test I have done has failed
(both local net and over Internet). Please review and test. I think
30000 is still not the optimal MAX_SFTP_READ_SIZE, my next goal is to
make an API to enable changing this value (The SecureSSH sftp_read has
more complete filled packages when comparing the network traffic)
2015-06-12 09:15:47 +02:00
Daniel Stenberg
6c14cc003a bump: start working on 1.6.1 2015-06-12 09:15:47 +02:00
Daniel Stenberg
cbd5f72339 RELEASE-NOTES: synced with 858930cae5 2015-06-05 17:05:58 +02:00