1
1

2105 Коммитов

Автор SHA1 Сообщение Дата
Will Cosgrove
ca9bb08908
transport.c: socket is disconnected, return error (#500)
File: transport.c

Notes:
This is to fix #102, instead of continuing to attempt to read a disconnected socket, it will now error out. 

Credit:
TDi-jonesds
2020-07-10 10:45:47 -07:00
Will Cosgrove
6b5fdf796b
stale.yml
Increasing stale values.
2020-07-08 13:48:59 -07:00
Marc Hoersken
3baa367136
wincng: try newer DH API first, fallback to legacy RSA API
Avoid the use of RtlGetVersion or similar Win32 functions,
since these depend on version information from manifests.

This commit makes the WinCNG backend first try to use the
new DH algorithm API with the raw secret derivation feature.
In case this feature is not available the WinCNG backend
will fallback to the classic approach of using RSA-encrypt
to perform the required modular exponentiation of BigNums.

The feature availability test is done during the first handshake
and the result is stored in the crypto backends global state.

Follow up to #397
Closes #484
2020-07-06 20:46:48 +02:00
Marc Hoersken
8e6ae2855b
wincng: fix indentation of function arguments and comments
Follow up to #397
2020-07-06 20:46:48 +02:00
Wez Furlong
7a26697ede
wincng: use newer DH API for Windows 8.1+
Since Windows 1903 the approach used to perform DH kex with the CNG
API has been failing.

This commit switches to using the `DH` algorithm provider to perform
generation of the key pair and derivation of the shared secret.

It uses a feature of CNG that is not yet documented.  The sources of
information that I've found on this are:

* https://stackoverflow.com/a/56378698/149111
* 5d39011e63/mini/crypto/cng/dh.inl (L355)

With this change I am able to successfully connect from Windows 10 to my
ubuntu system.

Refs: https://github.com/alexcrichton/ssh2-rs/issues/122
Fixes: https://github.com/libssh2/libssh2/issues/388
Closes: https://github.com/libssh2/libssh2/pull/397
2020-07-06 20:46:48 +02:00
Zenju
0222603df5
comp.c: Fix name clash with ZLIB macro "compress" (#418)
File: comp.c

Notes:
* Fix name clash with ZLIB macro "compress". 

Credit:
Zenju
2020-07-01 11:55:29 -07:00
yann-morin-1998
fc5d77881e
buildsystem: drop custom buildconf script, rely on autoreconf (#224)
Notes:
The buildconf script is currently required, because we need to copy a
header around, because it is used both from the library and the examples
sources.

However, having a custom 'buildconf'-like script is not needed if we can
ensure that the header exists by the time it is needed. For that, we can
just append the src/ directory to the headers search path for the
examples.

And then it means we no longer need to generate the same header twice,
so we remove the second one from configure.ac.

Now, we can just call "autoreconf -fi" to generate the autotools files,
instead of relying on the canned sequence in "buildconf", since
autoreconf has now long known what to do at the correct moment (future
versions of autotools, automake, autopoint, autoheader etc... may
require an other ordering, or other intermediate steps, etc...).

Eventually, get rid of buildconf now it is no longer needed. In fact, we
really keep it for legacy, but have it just call autoreconf (and print a
nice user-friendly warning). Don't include it in the release tarballs,
though.

Update doc, gitignore, and travis-CI jobs accordingly.

Credit:
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Sam Voss <sam.voss@rockwellcollins.com>
2020-07-01 11:44:08 -07:00
Will Cosgrove
1c3a03ebc3
libssh2.h: Update Diffie Hellman group values (#493)
File: libssh2.h

Notes:
Update the min, preferred and max DH group values based on RFC 8270.

Credit:
Will Cosgrove, noted from email list by Mitchell Holland
2020-07-01 11:37:20 -07:00
Marc Hoersken
92d756045a
travis: use existing Makefile target to run checksrc 2020-06-22 21:24:44 +02:00
Marc Hoersken
87c5883a42
Makefile: also run checksrc on test source files 2020-06-22 21:24:05 +02:00
Marc Hoersken
984d008106
tests: avoid use of deprecated function _sleep (#490) 2020-06-22 21:08:57 +02:00
Marc Hoersken
ac13b70a89
tests: avoid use of banned function strncat (#489) 2020-06-22 21:08:11 +02:00
Marc Hoersken
36d87a17a8
tests: satisfy checksrc regarding max line length of 79 chars
Follow up to 2764bc8e06d51876b6796d6080c6ac51e20f3332
2020-06-20 21:48:30 +02:00
Marc Hoersken
2764bc8e06
tests: satisfy checksrc with whitespace only fixes
checksrc.pl -i4 -m79 -ASIZEOFNOPAREN -ASNPRINTF
            -ACOPYRIGHT -AFOPENMODE tests/*.[ch]
2020-06-20 20:47:56 +02:00
Marc Hoersken
ec53d55cc0
tests: add support for ports published via Docker for Windows 2020-06-20 18:47:49 +02:00
Marc Hoersken
b78e57a2d7
tests: restore retry behaviour for docker-machine ip command 2020-06-20 18:44:30 +02:00
Marc Hoersken
0f6d3b68db
tests: fix mix of declarations and code failing C89 compliance 2020-06-20 18:42:24 +02:00
Marc Hoersken
6c99a18577
wincng: add and improve checks in bit counting function 2020-06-14 19:36:32 +02:00
Marc Hoersken
e7d5439119
wincng: align bits to bytes calculation in all functions 2020-06-14 19:35:21 +02:00
Marc Hoersken
cc00ece962
wincng: do not disable key validation that can be enabled
The modular exponentiation also works with key validation enabled.
2020-06-14 19:34:18 +02:00
Marc Hoersken
93206a7acd
wincng: fix return value in _libssh2_dh_secret
Do not ignore return value of modular exponentiation.
2020-06-14 19:32:49 +02:00
Marc Hoersken
9b5407f91b
appveyor: build and run tests for WinCNG crypto backend 2020-06-08 21:14:47 +02:00
suryakalpo
07fc1532b6
INSTALL_CMAKE.md: Update formatting (#481)
File: INSTALL_CMAKE.md

Notes:
Although the original text would be immediately clear to seasoned users of CMAKE and/or Unix shell, the lack of newlines may cause some confusion for newcomers. Hence, wrapping the texts in a md code-block such that the newlines appear as intended.

credit:
suryakalpo
2020-06-01 16:26:09 -07:00
Marc Hoersken
ffab6960b5
src: add new and align include guards in header files (#480)
Make sure all include guards exist and follow the same format.
2020-05-31 23:08:15 +02:00
Marc Hoersken
ba149e804e
wincng: fix multiple definition of `_libssh2_wincng' (#479)
Add missing include guard and move global state
from header to source file by using extern.
2020-05-31 23:07:39 +02:00
Will Cosgrove
0b44e558f3
transport.c: moving total_num check from #476 (#478)
file: transport.c

notes:
moving total_num zero length check from #476 up to the prior bounds check which already includes a total_num check. Makes it slightly more readable.

credit:
Will Cosgrove
2020-05-28 14:20:08 -07:00
lutianxiong
642eec48ff
transport.c: fix use-of-uninitialized-value (#476)
file:transport.c

notes:
return error if malloc(0)

credit:
lutianxiong
2020-05-28 10:25:40 -07:00
Dr. Koutheir Attouchi
1105af5651
libssh2_sftp.h: Changed type of LIBSSH2_FX_* constants to unsigned long, fixes #474
File:
libssh2_sftp.h 

Notes:
Error constants `LIBSSH2_FX_*` are only returned by `libssh2_sftp_last_error()` which returns `unsigned long`.
Therefore these constants should be defined as unsigned long literals, instead of int literals.

Credit:
Dr. Koutheir Attouchi
2020-05-26 10:28:12 -07:00
monnerat
4e75a59e29
os400qc3.c: constify libssh2_os400qc3_hash_update() data parameter. (#469)
Files: os400qc3.c, os400qc3.h

Notes:
Fixes building on OS400. #426

Credit:
Reported-by: hjindra on github, dev by Monnerat
2020-05-15 10:26:52 -07:00
monnerat
6e0f17f672
HACKING.CRYPTO: keep up to date with new crypto definitions from code. (#466)
File: HACKING.CRYPTO

Notes:
This commit updates the HACKING.CRYPTO documentation file in an attempt to make it in sync with current code.
New documented features are:

SHA384
SHA512
ECDSA
ED25519

Credit:
monnerat
2020-05-06 16:54:11 -07:00
Harry Sintonen
1a082247a7
kex.c: Add diffie-hellman-group14-sha256 Key Exchange Method (#464)
File: kex.c

Notes: Added diffie-hellman-group14-sha256 kex

Credit: Harry Sintonen <sintonen@iki.fi>
2020-05-01 10:26:20 -07:00
Will Cosgrove
e238df7353
os400qc3.h: define sha512 macros (#465)
file: os400qc3.h
notes: fixes for building libssh2 1.9.x
2020-04-30 11:27:41 -07:00
Will Cosgrove
1e57d61b01
os400qc3.h: define EC types to fix building #426 (#462)
File: os400qc3.h
Notes: define missing EC types which prevents building
Credit: hjindra
2020-04-17 15:28:20 -07:00
Brendan Shanks
bfcac7ccda
hostkey.c: Fix 'unsigned int'/'uint32_t' mismatch (#461)
File: hostkey.c

Notes: 
These types are the same size so most compilers are fine with it, but CodeWarrior (on classic MacOS) throws an ‘illegal implicit conversion’ error

Credit: Brendan Shanks
2020-04-06 10:13:54 -07:00
Thomas Klausner
159d4c8138
Makefile.am: Fix unportable test(1) operator. (#459)
file: Makefile.am

Notes:
The POSIX comparison operator for test(1) is =; bash supports == but not even test from GNU coreutils does.

Credit:
Thomas Klausner
2020-03-20 11:37:16 -07:00
Tseng Jun
ee3abe0408
openssl.c: minor changes of coding style (#454)
File: openssl.c

Notes:
minor changes of coding style and align preprocessor conditional for #439

Credit:
Tseng Jun
2020-03-03 11:57:21 -08:00
Hans Meier
b3b45813d6
openssl.c: Fix for use of uninitialized aes_ctr_cipher.key_len (#453)
File: 
Openssl.c

Notes:
* Fix for use of uninitialized aes_ctr_cipher.key_len when using HAVE_OPAQUE_STRUCTS, regression from #439 

Credit:
Hans Meirer, Tseng Jun
2020-02-27 09:35:35 -08:00
Zenju
0effd5d415
agent.c: Fix Unicode builds on Windows (#417)
File: agent.c

Notes:
Fixes unicode builds for Windows in Visual Studio 16.3.2.

Credit:
Zenju
2020-02-26 11:35:33 -08:00
Hans Meier
508203da9b
openssl.c: Fix use-after-free crash in openssl backend without memory leak (#439)
Files: openssl.c

Notes:
Fixes memory leaks and use after free AES EVP_CIPHER contexts when using OpenSSL 1.0.x.

Credit:
Hans Meier
2020-02-26 11:06:12 -08:00
Romain Geissler @ Amadeus
ff9f228389
Session.c: Fix undefined warning when mixing with LTO-enabled libcurl. (#449)
File: Session.c

Notes:
With gcc 9, libssh2, libcurl and LTO enabled for all binaries I see this
warning (error with -Werror):

vssh/libssh2.c: In function ‘ssh_statemach_act’:
/data/mwrep/rgeissler/ospack/ssh2/BUILD/libssh2-libssh2-03c7c4a/src/session.c:579:9: error: ‘seconds_to_next’ is used uninitialized in this function [-Werror=uninitialized]
  579 |     int seconds_to_next;
      |         ^
lto1: all warnings being treated as errors

Gcc normally issues -Wuninitialized when it is sure there is a problem,
and -Wmaybe-uninitialized when it's not sure, but it's possible. Here
the compiler seems to have find a real case where this could happen. I
looked in your code and overall it seems you always check if the return
code is non null, not often that it's below zero. I think we should do
the same here. With this patch, gcc is fine.

Credit:
Romain-Geissler-1A
2020-02-18 11:59:00 -08:00
Zenju
03c7c4a351
transport.c: Fix crash with delayed compression (#443)
Files: transport.c

Notes:
Fixes crash with delayed compression option using Bitvise server.

Contributor:
Zenju
2020-02-05 15:02:56 -08:00
Will Cosgrove
14a7db0eaa
Update INSTALL_MAKE path to INSTALL_MAKE.md (#446)
Included for #429
2020-02-03 15:02:40 -08:00
Will Cosgrove
92e5e01505
Update INSTALL_CMAKE filename to INSTALL_CMAKE.md (#445)
Fixing for #429
2020-02-03 14:30:26 -08:00
Wallace Souza
35da19fe25
Rename INSTALL_CMAKE to INTALL_CMAKE.md (#429)
Adding Markdown file extension in order to Github render the instructions properly
2020-02-03 12:06:02 -08:00
Daniel Stenberg
f1b6fca89b include/libssh2.h: fix comment: the known host key uses 4 bits (#438) 2019-12-17 15:01:08 -08:00
Zenju
24fd419bde ssh-ed25519: Support PKIX + calc pubkey from private (#416)
Files: openssl.c/h
Author: Zenju
Notes:
Adds support for PKIX key reading by fixing:

_libssh2_pub_priv_keyfile() is missing the code to extract the ed25519 public key from a given private key

_libssh2_ed25519_new_private_frommemory is only parsing the openssh key format but does not understand PKIX (as retrieved via PEM_read_bio_PrivateKey)
2019-12-13 13:35:00 -08:00
Will Cosgrove
96bbefb2de
.travis.yml: Fix Chrome and 32 bit builds (#423)
File: .travis.yml

Notes:
* Fix Chrome installing by using Travis build in directive
* Update to use libgcrypt20-dev package to fix 32 bit builds based on comments found here:
https://launchpad.net/ubuntu/xenial/i386/libgcrypt11-dev
2019-10-15 17:00:04 -07:00
Will Cosgrove
336bd86d2c
packet.c: improved parsing in packet_x11_open (#410)
Use new API to parse data in packet_x11_open() for better bounds checking.
2019-09-13 09:45:34 -07:00
Michael Buckley
e5dbd6f20c knownhost.c: Double the static buffer size when reading and writing known hosts (#409)
Notes:
We had a user who was being repeatedly prompted to accept a server key repeatedly. It turns out the base64-encoded key was larger than the static buffers allocated to read and write known hosts. I doubled the size of these buffers.

Credit:
Michael Buckley
2019-09-12 14:51:45 -07:00
Will Cosgrove
80d3ea5b41
packet.c: improved packet parsing in packet_queue_listener (#404)
* improved bounds checking in packet_queue_listener

file: packet.c

notes:
improved parsing packet in packet_queue_listener
2019-09-04 12:16:52 -07:00