mirror of
https://github.com/proxytunnel/proxytunnel.git
synced 2026-01-22 18:27:02 +00:00
Fixed loading of default and legacy provider
- Verify that the default and legacy provider was loaded successfully. If not bail out. - On Windows, try to load the legacy.dll from multiple locations before bailing out. - Added legacy.dll to the proxytunnel.zip archive.
This commit is contained in:
parent
8b2661ecd7
commit
8ff6d58f1b
3 changed files with 64 additions and 7 deletions
7
Makefile
7
Makefile
|
|
@ -20,6 +20,13 @@ OPTFLAGS += -DSETPROCTITLE -DSPT_TYPE=2
|
|||
# System dependant blocks... if your system is listed below, uncomment
|
||||
# the relevant lines
|
||||
|
||||
# MSYS
|
||||
# The current version of gcc from MSYS defines __MSYS__ and __CYGWIN__.
|
||||
# To avoid to change the code, simply define CYGWIN additionally.
|
||||
ifneq ($(filter $(MSYSTEM),MSYS MINGW32 MINGW64 UCRT64),)
|
||||
CFLAGS += -DCYGWIN
|
||||
endif
|
||||
|
||||
# OpenBSD
|
||||
#OPTFLAGS += -DHAVE_SYS_PSTAT_H
|
||||
|
||||
|
|
|
|||
10
buildwin.sh
10
buildwin.sh
|
|
@ -4,13 +4,13 @@ echo "Build docs..."
|
|||
make -C docs
|
||||
|
||||
echo "Build proxytunnel..."
|
||||
make -f Makefile.ssl11
|
||||
|
||||
echo "Copy msys/openssl dll to build dir..."
|
||||
cp /usr/bin/msys-2.0.dll /usr/bin/msys-crypto-1.1.dll /usr/bin/msys-ssl-1.1.dll /usr/bin/msys-z.dll .
|
||||
make -f Makefile
|
||||
strip -s proxytunnel.exe
|
||||
|
||||
echo "Generate proxytunnel.zip with docs, exe and msys/openssl dll..."
|
||||
zip proxytunnel.zip proxytunnel.exe *.dll docs/proxytunnel.1 docs/proxytunnel.1.html docs/proxytunnel-paper.html
|
||||
zip proxytunnel.zip proxytunnel.exe docs/proxytunnel.1 docs/proxytunnel.1.html docs/proxytunnel-paper.html
|
||||
DLLS="$(ldd proxytunnel.exe | grep msys.*\.dll | awk '{print $3}' | xargs) /usr/lib/ossl-modules/legacy.dll"
|
||||
zip proxytunnel.zip -j $DLLS
|
||||
|
||||
if [ ! -z "${TRAVIS_TAG}" ]; then
|
||||
echo "Deploy proxytunnel.zip to github release tag:${TRAVIS_TAG}..."
|
||||
|
|
|
|||
54
ntlm.c
54
ntlm.c
|
|
@ -29,6 +29,9 @@
|
|||
#include <ctype.h>
|
||||
#include <sys/time.h>
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
#ifdef CYGWIN
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <openssl/provider.h>
|
||||
#include <openssl/evp.h>
|
||||
#else
|
||||
|
|
@ -71,8 +74,55 @@ unsigned char lm2digest[LM2_DIGEST_LEN];
|
|||
|
||||
void init_ntlm() {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
OSSL_PROVIDER_load(NULL, "default");
|
||||
OSSL_PROVIDER_load(NULL, "legacy");
|
||||
OSSL_PROVIDER *provider;
|
||||
provider = OSSL_PROVIDER_load(NULL, "default");
|
||||
if (!provider) {
|
||||
my_perror("Loading default provider failed");
|
||||
exit(1);
|
||||
}
|
||||
provider = OSSL_PROVIDER_load(NULL, "legacy");
|
||||
#ifdef CYGWIN
|
||||
if (!provider) {
|
||||
// available at msys and git for windows
|
||||
// the msys version has an additional dependency on libcrypto-3-x64.dll
|
||||
provider = OSSL_PROVIDER_load(NULL, "/mingw64/lib/ossl-modules/legacy.dll");
|
||||
}
|
||||
if (!provider) {
|
||||
// available at msys (without dependency on libcrypto-3-x64.dll)
|
||||
provider = OSSL_PROVIDER_load(NULL, "/usr/lib/ossl-modules/legacy.dll");
|
||||
}
|
||||
if (!provider) {
|
||||
// default installation path for additional tools
|
||||
provider = OSSL_PROVIDER_load(NULL, "/usr/local/bin/legacy.dll");
|
||||
}
|
||||
if (!provider) {
|
||||
// directory of proxytunnel itself
|
||||
const char *p = strrchr(program_name, '/');
|
||||
if (p) {
|
||||
const int len = p - program_name;
|
||||
char *tmp = (char*)alloca(len + sizeof("/legacy.dll"));
|
||||
memcpy(tmp, program_name, len);
|
||||
strcpy(tmp + len, "/legacy.dll");
|
||||
provider = OSSL_PROVIDER_load(NULL, tmp);
|
||||
}
|
||||
}
|
||||
if (!provider) {
|
||||
// current working directory
|
||||
char *cwd = getcwd(NULL, 0);
|
||||
if (cwd) {
|
||||
const int len = strlen(cwd);
|
||||
char *tmp = (char*)alloca(len + sizeof("/legacy.dll"));
|
||||
memcpy(tmp, cwd, len);
|
||||
free(cwd);
|
||||
strcpy(tmp + len, "/legacy.dll");
|
||||
provider = OSSL_PROVIDER_load(NULL, tmp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!provider) {
|
||||
my_perror("Loading legacy provider failed");
|
||||
exit(1);
|
||||
}
|
||||
md4alg = EVP_md4();
|
||||
md5alg = EVP_md5();
|
||||
mdctx = EVP_MD_CTX_new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue