Skip to content

Commit a1a03fe

Browse files
ararslannalimilan
authored andcommitted
Update libssh2 patches (#50959)
We're now using libssh2 v1.11.0 which includes the two patches we were carrying. The patches need to be dropped in order to build with `USE_BINARYBUILDER=0`. (This was my bad, I should have made this change as part of #50826, which updated libssh2 to v1.11.0.) (cherry picked from commit 315ff53)
1 parent 09b87e7 commit a1a03fe

File tree

4 files changed

+109
-68
lines changed

4 files changed

+109
-68
lines changed

deps/libssh2.mk

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,13 @@ endif
3030

3131
LIBSSH2_SRC_PATH := $(SRCCACHE)/$(LIBSSH2_SRC_DIR)
3232

33-
# Apply patch to fix v1.10.0 CVE (https://github.com/libssh2/libssh2/issues/649), drop with v1.11
34-
$(LIBSSH2_SRC_PATH)/libssh2-userauth-check.patch-applied: $(LIBSSH2_SRC_PATH)/source-extracted
33+
$(LIBSSH2_SRC_PATH)/libssh2-mbedtls-size_t.patch-applied: $(LIBSSH2_SRC_PATH)/source-extracted
3534
cd $(LIBSSH2_SRC_PATH) && \
36-
patch -p1 -f < $(SRCDIR)/patches/libssh2-userauth-check.patch
37-
echo 1 > $@
38-
39-
# issue: https://github.com/JuliaLang/julia/issues/45645#issuecomment-1153214379
40-
# fix pr: https://github.com/libssh2/libssh2/pull/711
41-
$(LIBSSH2_SRC_PATH)/libssh2-fix-import-lib-name.patch-applied: $(LIBSSH2_SRC_PATH)/libssh2-userauth-check.patch-applied
42-
cd $(LIBSSH2_SRC_PATH) && \
43-
patch -p1 -f < $(SRCDIR)/patches/libssh2-fix-import-lib-name.patch
35+
patch -p1 -f < $(SRCDIR)/patches/libssh2-mbedtls-size_t.patch
4436
echo 1 > $@
4537

4638
$(BUILDDIR)/$(LIBSSH2_SRC_DIR)/build-configured: \
47-
$(LIBSSH2_SRC_PATH)/libssh2-fix-import-lib-name.patch-applied
39+
$(LIBSSH2_SRC_PATH)/libssh2-mbedtls-size_t.patch-applied
4840

4941
$(BUILDDIR)/$(LIBSSH2_SRC_DIR)/build-configured: $(LIBSSH2_SRC_PATH)/source-extracted
5042
mkdir -p $(dir $@)
@@ -53,7 +45,7 @@ $(BUILDDIR)/$(LIBSSH2_SRC_DIR)/build-configured: $(LIBSSH2_SRC_PATH)/source-extr
5345
echo 1 > $@
5446

5547
$(BUILDDIR)/$(LIBSSH2_SRC_DIR)/build-compiled: $(BUILDDIR)/$(LIBSSH2_SRC_DIR)/build-configured
56-
$(MAKE) -C $(dir $<) libssh2
48+
$(MAKE) -C $(dir $<)
5749
echo 1 > $@
5850

5951
$(BUILDDIR)/$(LIBSSH2_SRC_DIR)/build-checked: $(BUILDDIR)/$(LIBSSH2_SRC_DIR)/build-compiled

deps/patches/libssh2-fix-import-lib-name.patch

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
From 6cad964056848d3d78ccc74600fbff6298baddcb Mon Sep 17 00:00:00 2001
2+
From: Viktor Szakats <[email protected]>
3+
Date: Tue, 30 May 2023 17:28:03 +0000
4+
Subject: [PATCH 1/1] mbedtls: use more size_t to sync up with crypto.h
5+
6+
Ref: 5a96f494ee0b00282afb2db2e091246fc5e1774a #846 #879
7+
8+
Fixes #1053
9+
Closes #1054
10+
---
11+
src/mbedtls.c | 14 ++++++++------
12+
src/mbedtls.h | 13 ++++++-------
13+
2 files changed, 14 insertions(+), 13 deletions(-)
14+
15+
diff --git a/src/mbedtls.c b/src/mbedtls.c
16+
index e387cdb..cd14a4b 100644
17+
--- a/src/mbedtls.c
18+
+++ b/src/mbedtls.c
19+
@@ -186,7 +186,7 @@ _libssh2_mbedtls_cipher_dtor(_libssh2_cipher_ctx *ctx)
20+
int
21+
_libssh2_mbedtls_hash_init(mbedtls_md_context_t *ctx,
22+
mbedtls_md_type_t mdtype,
23+
- const unsigned char *key, unsigned long keylen)
24+
+ const unsigned char *key, size_t keylen)
25+
{
26+
const mbedtls_md_info_t *md_info;
27+
int ret, hmac;
28+
@@ -221,7 +221,7 @@ _libssh2_mbedtls_hash_final(mbedtls_md_context_t *ctx, unsigned char *hash)
29+
}
30+
31+
int
32+
-_libssh2_mbedtls_hash(const unsigned char *data, unsigned long datalen,
33+
+_libssh2_mbedtls_hash(const unsigned char *data, size_t datalen,
34+
mbedtls_md_type_t mdtype, unsigned char *hash)
35+
{
36+
const mbedtls_md_info_t *md_info;
37+
@@ -497,8 +497,9 @@ int
38+
_libssh2_mbedtls_rsa_sha2_verify(libssh2_rsa_ctx * rsactx,
39+
size_t hash_len,
40+
const unsigned char *sig,
41+
- unsigned long sig_len,
42+
- const unsigned char *m, unsigned long m_len)
43+
+ size_t sig_len,
44+
+ const unsigned char *m,
45+
+ size_t m_len)
46+
{
47+
int ret;
48+
int md_type;
49+
@@ -548,8 +549,9 @@ _libssh2_mbedtls_rsa_sha2_verify(libssh2_rsa_ctx * rsactx,
50+
int
51+
_libssh2_mbedtls_rsa_sha1_verify(libssh2_rsa_ctx * rsactx,
52+
const unsigned char *sig,
53+
- unsigned long sig_len,
54+
- const unsigned char *m, unsigned long m_len)
55+
+ size_t sig_len,
56+
+ const unsigned char *m,
57+
+ size_t m_len)
58+
{
59+
return _libssh2_mbedtls_rsa_sha2_verify(rsactx, SHA_DIGEST_LENGTH,
60+
sig, sig_len, m, m_len);
61+
diff --git a/src/mbedtls.h b/src/mbedtls.h
62+
index d9592f7..03484da 100644
63+
--- a/src/mbedtls.h
64+
+++ b/src/mbedtls.h
65+
@@ -478,12 +478,12 @@ _libssh2_mbedtls_cipher_dtor(_libssh2_cipher_ctx *ctx);
66+
int
67+
_libssh2_mbedtls_hash_init(mbedtls_md_context_t *ctx,
68+
mbedtls_md_type_t mdtype,
69+
- const unsigned char *key, unsigned long keylen);
70+
+ const unsigned char *key, size_t keylen);
71+
72+
int
73+
_libssh2_mbedtls_hash_final(mbedtls_md_context_t *ctx, unsigned char *hash);
74+
int
75+
-_libssh2_mbedtls_hash(const unsigned char *data, unsigned long datalen,
76+
+_libssh2_mbedtls_hash(const unsigned char *data, size_t datalen,
77+
mbedtls_md_type_t mdtype, unsigned char *hash);
78+
79+
_libssh2_bn *
80+
@@ -526,9 +526,8 @@ _libssh2_mbedtls_rsa_new_private_frommemory(libssh2_rsa_ctx **rsa,
81+
int
82+
_libssh2_mbedtls_rsa_sha1_verify(libssh2_rsa_ctx *rsa,
83+
const unsigned char *sig,
84+
- unsigned long sig_len,
85+
- const unsigned char *m,
86+
- unsigned long m_len);
87+
+ size_t sig_len,
88+
+ const unsigned char *m, size_t m_len);
89+
int
90+
_libssh2_mbedtls_rsa_sha1_sign(LIBSSH2_SESSION *session,
91+
libssh2_rsa_ctx *rsa,
92+
@@ -540,8 +539,8 @@ int
93+
_libssh2_mbedtls_rsa_sha2_verify(libssh2_rsa_ctx * rsactx,
94+
size_t hash_len,
95+
const unsigned char *sig,
96+
- unsigned long sig_len,
97+
- const unsigned char *m, unsigned long m_len);
98+
+ size_t sig_len,
99+
+ const unsigned char *m, size_t m_len);
100+
int
101+
_libssh2_mbedtls_rsa_sha2_sign(LIBSSH2_SESSION *session,
102+
libssh2_rsa_ctx *rsa,
103+
--
104+
2.31.0
105+

deps/patches/libssh2-userauth-check.patch

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)