From acef0daea1db4f6afd5ce243e2a9c7a18cbffe4c Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Tue, 28 Apr 2026 20:56:04 +0200 Subject: [PATCH] Apply patch: ncpfs-hg-commit-440.patch --- .../ncpfs-2.2.6-r6/ncpfs-hg-commit-440.patch | 66 +++++++++++++++++++ lib/ndslib.c | 14 ++-- lib/ndslib_i.h | 2 +- 3 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 .patches/ncpfs-2.2.6-r6/ncpfs-hg-commit-440.patch diff --git a/.patches/ncpfs-2.2.6-r6/ncpfs-hg-commit-440.patch b/.patches/ncpfs-2.2.6-r6/ncpfs-hg-commit-440.patch new file mode 100644 index 0000000..6a0c94a --- /dev/null +++ b/.patches/ncpfs-2.2.6-r6/ncpfs-hg-commit-440.patch @@ -0,0 +1,66 @@ +changeset: 440:7f46ab032bd8 +user: Petr Vandrovec +date: Mon Jul 04 00:01:49 2005 +0100 +files: lib/ndslib.c lib/ndslib_i.h +description: +Rename exp argument to n_exp in ndslib. + +Rename exp to n_exp (and exp_len to n_exp_len) to get rid +of warning that exp argument shadows exp() mathematic +function. Although we do not use exp() function anywhere, +it is gcc builtin internal, and exists in the namespace +since compilation start. + + +diff -r 0ba24cdb345c -r 7f46ab032bd8 lib/ndslib.c +--- a/lib/ndslib.c Sun Jul 03 23:57:27 2005 +0100 ++++ b/lib/ndslib.c Mon Jul 04 00:01:49 2005 +0100 +@@ -1825,8 +1825,8 @@ static int ComputeKey(struct keyparam *k + + NWDSCCODE __NWGenerateKeyPair( + size_t key_len, +- const void* exp, +- size_t exp_len, ++ const void* n_exp, ++ size_t n_exp_len, + void* pubkey, + size_t* pubkey_len, + void* privkey, +@@ -1839,19 +1839,19 @@ NWDSCCODE __NWGenerateKeyPair( + size_t words; /* netware native units */ + + if (!pubkey || !pubkey_len || !privkey || !privkey_len) return -2; +- if (!key_len || !exp || !exp_len) { +- exp = def_exp; +- exp_len = sizeof(def_exp); ++ if (!key_len || !n_exp || !n_exp_len) { ++ n_exp = def_exp; ++ n_exp_len = sizeof(def_exp); + key_len = 420; /* well, at least 620 does work too */ + } else { +- if ((key_len > 760) || (key_len < 256) || (key_len & 1) || (exp_len > 16)) { ++ if ((key_len > 760) || (key_len < 256) || (key_len & 1) || (n_exp_len > 16)) { + return NWE_PARAM_INVALID; + } + } + memset(&kp, 0, sizeof(kp)); + kp.BA = 48; + kp.BL = key_len; +- memcpy(kp.n_exp, exp, exp_len); ++ memcpy(kp.n_exp, n_exp, n_exp_len); + ncpt_mutex_lock(&mpilock); + set_precision(bits2units(kp.BL) + SLOP_BITS); + if ((countbits(kp.n_exp) > kp.BL) || !(kp.n_exp[0] & 1)) { +diff -r 0ba24cdb345c -r 7f46ab032bd8 lib/ndslib_i.h +--- a/lib/ndslib_i.h Sun Jul 03 23:57:27 2005 +0100 ++++ b/lib/ndslib_i.h Mon Jul 04 00:01:49 2005 +0100 +@@ -38,7 +38,7 @@ NWDSCCODE NWDSGetKeys(NWDSContextHandle + /* ctx must be in wchar_t mode */ + NWDSCCODE __NWDSGetPublicKeyFromConnection(NWDSContextHandle ctx, + NWCONN_HANDLE conn, nuint8 **skey); +-NWDSCCODE __NWGenerateKeyPair(size_t key_len, const void* exp, size_t exp_len, ++NWDSCCODE __NWGenerateKeyPair(size_t key_len, const void* n_exp, size_t n_exp_len, + void* pubkey, size_t* pubkey_len, + void* privkey, size_t* privkey_len); + NWDSCCODE __NWEncryptWithSK(const void* hashsrc, size_t hashsrclen, + diff --git a/lib/ndslib.c b/lib/ndslib.c index fdc3bed..1e094b9 100644 --- a/lib/ndslib.c +++ b/lib/ndslib.c @@ -1825,8 +1825,8 @@ static int ComputeKey(struct keyparam *kp) { NWDSCCODE __NWGenerateKeyPair( size_t key_len, - const void* exp, - size_t exp_len, + const void* n_exp, + size_t n_exp_len, void* pubkey, size_t* pubkey_len, void* privkey, @@ -1839,19 +1839,19 @@ NWDSCCODE __NWGenerateKeyPair( size_t words; /* netware native units */ if (!pubkey || !pubkey_len || !privkey || !privkey_len) return -2; - if (!key_len || !exp || !exp_len) { - exp = def_exp; - exp_len = sizeof(def_exp); + if (!key_len || !n_exp || !n_exp_len) { + n_exp = def_exp; + n_exp_len = sizeof(def_exp); key_len = 420; /* well, at least 620 does work too */ } else { - if ((key_len > 760) || (key_len < 256) || (key_len & 1) || (exp_len > 16)) { + if ((key_len > 760) || (key_len < 256) || (key_len & 1) || (n_exp_len > 16)) { return NWE_PARAM_INVALID; } } memset(&kp, 0, sizeof(kp)); kp.BA = 48; kp.BL = key_len; - memcpy(kp.n_exp, exp, exp_len); + memcpy(kp.n_exp, n_exp, n_exp_len); ncpt_mutex_lock(&mpilock); set_precision(bits2units(kp.BL) + SLOP_BITS); if ((countbits(kp.n_exp) > kp.BL) || !(kp.n_exp[0] & 1)) { diff --git a/lib/ndslib_i.h b/lib/ndslib_i.h index f17bbe5..ed970a4 100644 --- a/lib/ndslib_i.h +++ b/lib/ndslib_i.h @@ -38,7 +38,7 @@ NWDSCCODE NWDSGetKeys(NWDSContextHandle ctx, union __NWDSAuthInfo** pndai, /* ctx must be in wchar_t mode */ NWDSCCODE __NWDSGetPublicKeyFromConnection(NWDSContextHandle ctx, NWCONN_HANDLE conn, nuint8 **skey); -NWDSCCODE __NWGenerateKeyPair(size_t key_len, const void* exp, size_t exp_len, +NWDSCCODE __NWGenerateKeyPair(size_t key_len, const void* n_exp, size_t n_exp_len, void* pubkey, size_t* pubkey_len, void* privkey, size_t* privkey_len); NWDSCCODE __NWEncryptWithSK(const void* hashsrc, size_t hashsrclen,