Skip to content

Commit fdee21e

Browse files
author
Pan
committed
Updated changelog. Updated manylinux wheel embedded libssh2 version.
1 parent 76dc460 commit fdee21e

File tree

15 files changed

+93
-48
lines changed

15 files changed

+93
-48
lines changed

Changelog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Changes
1010
* Session object de-allocation no longer calls session disconnect.
1111
* Channel object de-allocation no longer calls channel close.
1212
* Rebuilt sources with Cython ``0.29.6``.
13+
* Updated Linux and Windows binary wheels to OpenSSL 1.1.
14+
* Updated embedded ``libssh2`` to latest master.
15+
* Added ``Ed25519`` publickey support via ``libssh2`` and OpenSSL upgrades.
1316

1417
Packaging
1518
----------

ci/docker/manylinux/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RUN cd ${OPENSSL}.tar.gz/${OPENSSL} && \
2626

2727
# Libssh2
2828
RUN mkdir -p build_libssh2 && cd build_libssh2 && \
29-
cmake ../libssh2.tar.gz -DBUILD_SHARED_LIBS=ON -DENABLE_ZLIB_COMPRESSION=ON \
29+
cmake ../libssh2.tar.gz/libssh2-master -DBUILD_SHARED_LIBS=ON -DENABLE_ZLIB_COMPRESSION=ON \
3030
-DENABLE_CRYPT_NONE=ON -DENABLE_MAC_NONE=ON -DCMAKE_INSTALL_PREFIX=/usr && \
3131
cmake --build . --config Release --target install
3232

ci/docker/manylinux/libssh2.tar.gz

-453 KB
Binary file not shown.

examples/publickey_fromfile.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,13 @@ def main():
3030
if not os.path.isfile(args.privatekey):
3131
print("No such private key %s" % (args.privatekey,))
3232
sys.exit(1)
33-
publickey = "%s.pub" % (args.privatekey,)
34-
if not os.path.isfile(publickey):
35-
print("Expected public key at %s, found none" % (publickey,))
36-
sys.exit(1)
3733

3834
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
3935
sock.connect((args.host, args.port))
4036
s = Session()
4137
s.handshake(sock)
4238
s.userauth_publickey_fromfile(
43-
args.user, publickey, args.privatekey, args.passphrase)
39+
args.user, args.privatekey, passphrase=args.passphrase)
4440
chan = s.open_session()
4541
chan.execute(args.cmd)
4642
size, data = chan.read()

libssh2/docs/libssh2_hostkey_hash.3

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ libssh2_hostkey_hash(LIBSSH2_SESSION *session, int hash_type);
1111
\fIsession\fP - Session instance as returned by
1212
.BR libssh2_session_init_ex(3)
1313

14-
\fIhash_type\fP - One of: \fBLIBSSH2_HOSTKEY_HASH_MD5\fP or
15-
\fBLIBSSH2_HOSTKEY_HASH_SHA1\fP.
14+
\fIhash_type\fP - One of: \fBLIBSSH2_HOSTKEY_HASH_MD5\fP,
15+
\fBLIBSSH2_HOSTKEY_HASH_SHA1\fP or \fBLIBSSH2_HOSTKEY_HASH_SHA256\fP.
1616

1717
Returns the computed digest of the remote system's hostkey. The length of
1818
the returned string is hash_type specific (e.g. 16 bytes for MD5,
19-
20 bytes for SHA1).
19+
20 bytes for SHA1, 32 bytes for SHA256).
2020
.SH RETURN VALUE
2121
Computed hostkey hash value, or NULL if the information is not available
2222
(either the session has not yet been started up, or the requested hash

libssh2/example/ssh2_agent.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,11 @@ int main(int argc, char *argv[])
223223

224224
shutdown:
225225

226-
libssh2_agent_disconnect(agent);
227-
libssh2_agent_free(agent);
228-
226+
if (agent) {
227+
libssh2_agent_disconnect(agent);
228+
libssh2_agent_free(agent);
229+
}
230+
229231
if(session) {
230232
libssh2_session_disconnect(session,
231233
"Normal Shutdown, Thank you for playing");

libssh2/include/libssh2_sftp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ typedef struct _LIBSSH2_SFTP_STATVFS LIBSSH2_SFTP_STATVFS;
7979
#define LIBSSH2_SFTP_READLINK 1
8080
#define LIBSSH2_SFTP_REALPATH 2
8181

82+
/* Flags for sftp_mkdir() */
83+
#define LIBSSH2_SFTP_DEFAULT_MODE -1
84+
8285
/* SFTP attribute flag bits */
8386
#define LIBSSH2_SFTP_ATTR_SIZE 0x00000001
8487
#define LIBSSH2_SFTP_ATTR_UIDGID 0x00000002

libssh2/src/crypto.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ _libssh2_ecdsa_verify(libssh2_ecdsa_ctx * ctx,
143143
const unsigned char *m, size_t m_len);
144144

145145
int
146-
_libssh2_ecdsa_create_key(_libssh2_ec_key **out_private_key,
146+
_libssh2_ecdsa_create_key(LIBSSH2_SESSION *session, _libssh2_ec_key **out_private_key,
147147
unsigned char **out_public_key_octal,
148148
size_t *out_public_key_octal_len, libssh2_curve_type curve_type);
149149

@@ -172,8 +172,8 @@ _libssh2_ecdsa_curve_type_from_name(const char *name, libssh2_curve_type *out_ty
172172
#if LIBSSH2_ED25519
173173

174174
int
175-
_libssh2_curve25519_new(libssh2_ed25519_ctx **ctx, uint8_t **out_public_key,
176-
uint8_t **out_private_key);
175+
_libssh2_curve25519_new(LIBSSH2_SESSION *session, libssh2_ed25519_ctx **ctx,
176+
uint8_t **out_public_key, uint8_t **out_private_key);
177177

178178
int
179179
_libssh2_curve25519_gen_k(_libssh2_bn **k, uint8_t private_key[LIBSSH2_ED25519_KEY_LEN],
@@ -184,9 +184,15 @@ _libssh2_ed25519_verify(libssh2_ed25519_ctx *ctx, const uint8_t *s,
184184
size_t s_len, const uint8_t *m, size_t m_len);
185185

186186
int
187-
_libssh2_ed25519_new_private(libssh2_ed25519_ctx **ec_ctx,
187+
_libssh2_ed25519_new_private(libssh2_ed25519_ctx **ed_ctx,
188188
LIBSSH2_SESSION *session,
189189
const char *filename, const uint8_t *passphrase);
190+
191+
int
192+
_libssh2_ed25519_new_public(libssh2_ed25519_ctx **ed_ctx,
193+
LIBSSH2_SESSION *session,
194+
const char *raw_pub_key, const uint8_t key_len);
195+
190196
int
191197
_libssh2_ed25519_sign(libssh2_ed25519_ctx *ctx, LIBSSH2_SESSION *session,
192198
uint8_t **out_sig, size_t *out_sig_len,

libssh2/src/hostkey.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -795,9 +795,8 @@ hostkey_method_ssh_ed25519_init(LIBSSH2_SESSION * session,
795795
size_t hostkey_data_len,
796796
void **abstract)
797797
{
798-
const unsigned char *s;
798+
const char *s;
799799
unsigned long len, key_len;
800-
EVP_PKEY *public_key = NULL;
801800
libssh2_ed25519_ctx *ctx = NULL;
802801

803802
if(*abstract) {
@@ -823,17 +822,10 @@ hostkey_method_ssh_ed25519_init(LIBSSH2_SESSION * session,
823822
key_len = _libssh2_ntohu32(s);
824823
s += 4;
825824

826-
public_key = EVP_PKEY_new_raw_public_key(EVP_PKEY_ED25519, NULL, (const unsigned char*)s, key_len);
827-
if(public_key == NULL) {
828-
return _libssh2_error(session, LIBSSH2_ERROR_PROTO, "could not create ED25519 public key");
829-
}
830-
831-
ctx = LIBSSH2_CALLOC(session, sizeof(libssh2_ed25519_ctx));
832-
if(ctx == NULL) {
833-
return _libssh2_error(session, LIBSSH2_ERROR_ALLOC, "could not alloc public/private key");
825+
if(_libssh2_ed25519_new_public(&ctx, session, s, key_len) != 0) {
826+
return -1;
834827
}
835828

836-
ctx->public_key = public_key;
837829
*abstract = ctx;
838830

839831
return 0;

libssh2/src/kex.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,8 +2421,8 @@ kex_method_ecdh_key_exchange
24212421
goto ecdh_clean_exit;
24222422
}
24232423

2424-
rc = _libssh2_ecdsa_create_key(&key_state->private_key, &key_state->public_key_oct,
2425-
&key_state->public_key_oct_len, type);
2424+
rc = _libssh2_ecdsa_create_key(session, &key_state->private_key,
2425+
&key_state->public_key_oct, &key_state->public_key_oct_len, type);
24262426

24272427
if(rc != 0) {
24282428
ret = _libssh2_error(session, rc,
@@ -2489,7 +2489,7 @@ kex_method_ecdh_key_exchange
24892489
ecdh_clean_exit:
24902490

24912491
if(key_state->public_key_oct) {
2492-
free(key_state->public_key_oct);
2492+
LIBSSH2_FREE(session, key_state->public_key_oct);
24932493
key_state->public_key_oct = NULL;
24942494
}
24952495

@@ -2988,7 +2988,7 @@ kex_method_curve25519_key_exchange
29882988
goto clean_exit;
29892989
}
29902990

2991-
rc = _libssh2_curve25519_new(NULL, &key_state->curve25519_public_key,
2991+
rc = _libssh2_curve25519_new(session, NULL, &key_state->curve25519_public_key,
29922992
&key_state->curve25519_private_key);
29932993

29942994
if( rc != 0 )

0 commit comments

Comments
 (0)