mirror of
https://github.com/curl/curl.git
synced 2026-08-24 22:23:58 +03:00
parent
8b7cbe9dec
commit
7c8bae0d9c
74 changed files with 117 additions and 3159 deletions
|
|
@ -50,7 +50,6 @@ LIB_VTLS_CFILES = \
|
|||
vtls/keylog.c \
|
||||
vtls/mbedtls.c \
|
||||
vtls/mbedtls_threadlock.c \
|
||||
vtls/nss.c \
|
||||
vtls/openssl.c \
|
||||
vtls/rustls.c \
|
||||
vtls/schannel.c \
|
||||
|
|
@ -68,7 +67,6 @@ LIB_VTLS_HFILES = \
|
|||
vtls/keylog.h \
|
||||
vtls/mbedtls.h \
|
||||
vtls/mbedtls_threadlock.h \
|
||||
vtls/nssg.h \
|
||||
vtls/openssl.h \
|
||||
vtls/rustls.h \
|
||||
vtls/schannel.h \
|
||||
|
|
|
|||
|
|
@ -688,9 +688,6 @@ ${SIZEOF_TIME_T_CODE}
|
|||
/* If you want to build curl with the built-in manual */
|
||||
#cmakedefine USE_MANUAL 1
|
||||
|
||||
/* if NSS is enabled */
|
||||
#cmakedefine USE_NSS 1
|
||||
|
||||
/* if you have the PK11_CreateManagedGenericObject function */
|
||||
#cmakedefine HAVE_PK11_CREATEMANAGEDGENERICOBJECT 1
|
||||
|
||||
|
|
|
|||
|
|
@ -24,12 +24,11 @@
|
|||
|
||||
#include "curl_setup.h"
|
||||
|
||||
#if defined(USE_CURL_NTLM_CORE) && !defined(USE_WOLFSSL) && \
|
||||
(defined(USE_GNUTLS) || \
|
||||
defined(USE_NSS) || \
|
||||
defined(USE_SECTRANSP) || \
|
||||
defined(USE_OS400CRYPTO) || \
|
||||
defined(USE_WIN32_CRYPTO))
|
||||
#if defined(USE_CURL_NTLM_CORE) && !defined(USE_WOLFSSL) && \
|
||||
(defined(USE_GNUTLS) || \
|
||||
defined(USE_SECTRANSP) || \
|
||||
defined(USE_OS400CRYPTO) || \
|
||||
defined(USE_WIN32_CRYPTO))
|
||||
|
||||
#include "curl_des.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -26,12 +26,11 @@
|
|||
|
||||
#include "curl_setup.h"
|
||||
|
||||
#if defined(USE_CURL_NTLM_CORE) && !defined(USE_WOLFSSL) && \
|
||||
(defined(USE_GNUTLS) || \
|
||||
defined(USE_NSS) || \
|
||||
defined(USE_SECTRANSP) || \
|
||||
defined(USE_OS400CRYPTO) || \
|
||||
defined(USE_WIN32_CRYPTO))
|
||||
#if defined(USE_CURL_NTLM_CORE) && !defined(USE_WOLFSSL) && \
|
||||
(defined(USE_GNUTLS) || \
|
||||
defined(USE_SECTRANSP) || \
|
||||
defined(USE_OS400CRYPTO) || \
|
||||
defined(USE_WIN32_CRYPTO))
|
||||
|
||||
/* Applies odd parity to the given byte array */
|
||||
void Curl_des_set_odd_parity(unsigned char *bytes, size_t length);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
1. USE_OPENSSL
|
||||
2. USE_WOLFSSL
|
||||
3. USE_GNUTLS
|
||||
4. USE_NSS
|
||||
4. -
|
||||
5. USE_MBEDTLS
|
||||
6. USE_SECTRANSP
|
||||
7. USE_OS400CRYPTO
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
This ensures that:
|
||||
- the same SSL branch gets activated throughout this source
|
||||
file even if multiple backends are enabled at the same time.
|
||||
- OpenSSL and NSS have higher priority than Windows Crypt, due
|
||||
- OpenSSL has higher priority than Windows Crypt, due
|
||||
to issues with the latter supporting NTLM2Session responses
|
||||
in NTLM type-3 messages.
|
||||
*/
|
||||
|
|
@ -96,12 +96,6 @@
|
|||
|
||||
# include <nettle/des.h>
|
||||
|
||||
#elif defined(USE_NSS)
|
||||
|
||||
# include <nss.h>
|
||||
# include <pk11pub.h>
|
||||
# include <hasht.h>
|
||||
|
||||
#elif defined(USE_MBEDTLS)
|
||||
|
||||
# include <mbedtls/des.h>
|
||||
|
|
@ -188,70 +182,6 @@ static void setup_des_key(const unsigned char *key_56,
|
|||
des_set_key(des, (const uint8_t *) key);
|
||||
}
|
||||
|
||||
#elif defined(USE_NSS)
|
||||
|
||||
/*
|
||||
* encrypt_des() expands a 56 bit key KEY_56 to 64 bit and encrypts 64 bit of
|
||||
* data, using the expanded key. IN should point to 64 bits of source data,
|
||||
* OUT to a 64 bit output buffer.
|
||||
*/
|
||||
static bool encrypt_des(const unsigned char *in, unsigned char *out,
|
||||
const unsigned char *key_56)
|
||||
{
|
||||
const CK_MECHANISM_TYPE mech = CKM_DES_ECB; /* DES cipher in ECB mode */
|
||||
char key[8]; /* expanded 64 bit key */
|
||||
SECItem key_item;
|
||||
PK11SymKey *symkey = NULL;
|
||||
SECItem *param = NULL;
|
||||
PK11Context *ctx = NULL;
|
||||
int out_len; /* not used, required by NSS */
|
||||
bool rv = FALSE;
|
||||
|
||||
/* use internal slot for DES encryption (requires NSS to be initialized) */
|
||||
PK11SlotInfo *slot = PK11_GetInternalKeySlot();
|
||||
if(!slot)
|
||||
return FALSE;
|
||||
|
||||
/* Expand the 56-bit key to 64-bits */
|
||||
extend_key_56_to_64(key_56, key);
|
||||
|
||||
/* Set the key parity to odd */
|
||||
Curl_des_set_odd_parity((unsigned char *) key, sizeof(key));
|
||||
|
||||
/* Import the key */
|
||||
key_item.data = (unsigned char *)key;
|
||||
key_item.len = sizeof(key);
|
||||
symkey = PK11_ImportSymKey(slot, mech, PK11_OriginUnwrap, CKA_ENCRYPT,
|
||||
&key_item, NULL);
|
||||
if(!symkey)
|
||||
goto fail;
|
||||
|
||||
/* Create the DES encryption context */
|
||||
param = PK11_ParamFromIV(mech, /* no IV in ECB mode */ NULL);
|
||||
if(!param)
|
||||
goto fail;
|
||||
ctx = PK11_CreateContextBySymKey(mech, CKA_ENCRYPT, symkey, param);
|
||||
if(!ctx)
|
||||
goto fail;
|
||||
|
||||
/* Perform the encryption */
|
||||
if(SECSuccess == PK11_CipherOp(ctx, out, &out_len, /* outbuflen */ 8,
|
||||
(unsigned char *)in, /* inbuflen */ 8)
|
||||
&& SECSuccess == PK11_Finalize(ctx))
|
||||
rv = /* all OK */ TRUE;
|
||||
|
||||
fail:
|
||||
/* cleanup */
|
||||
if(ctx)
|
||||
PK11_DestroyContext(ctx, PR_TRUE);
|
||||
if(symkey)
|
||||
PK11_FreeSymKey(symkey);
|
||||
if(param)
|
||||
SECITEM_FreeItem(param, PR_TRUE);
|
||||
PK11_FreeSlot(slot);
|
||||
return rv;
|
||||
}
|
||||
|
||||
#elif defined(USE_MBEDTLS)
|
||||
|
||||
static bool encrypt_des(const unsigned char *in, unsigned char *out,
|
||||
|
|
@ -402,7 +332,7 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
|
|||
des_encrypt(&des, 8, results + 8, plaintext);
|
||||
setup_des_key(keys + 14, &des);
|
||||
des_encrypt(&des, 8, results + 16, plaintext);
|
||||
#elif defined(USE_NSS) || defined(USE_MBEDTLS) || defined(USE_SECTRANSP) \
|
||||
#elif defined(USE_MBEDTLS) || defined(USE_SECTRANSP) \
|
||||
|| defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO)
|
||||
encrypt_des(plaintext, results, keys);
|
||||
encrypt_des(plaintext, results + 8, keys + 7);
|
||||
|
|
@ -444,7 +374,7 @@ CURLcode Curl_ntlm_core_mk_lm_hash(const char *password,
|
|||
des_encrypt(&des, 8, lmbuffer, magic);
|
||||
setup_des_key(pw + 7, &des);
|
||||
des_encrypt(&des, 8, lmbuffer + 8, magic);
|
||||
#elif defined(USE_NSS) || defined(USE_MBEDTLS) || defined(USE_SECTRANSP) \
|
||||
#elif defined(USE_MBEDTLS) || defined(USE_SECTRANSP) \
|
||||
|| defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO)
|
||||
encrypt_des(magic, lmbuffer, pw);
|
||||
encrypt_des(magic, lmbuffer + 8, pw + 7);
|
||||
|
|
|
|||
|
|
@ -28,15 +28,6 @@
|
|||
|
||||
#if defined(USE_CURL_NTLM_CORE)
|
||||
|
||||
/* If NSS is the first available SSL backend (see order in curl_ntlm_core.c)
|
||||
then it must be initialized to be used by NTLM. */
|
||||
#if !defined(USE_OPENSSL) && \
|
||||
!defined(USE_WOLFSSL) && \
|
||||
!defined(USE_GNUTLS) && \
|
||||
defined(USE_NSS)
|
||||
#define NTLM_NEEDS_NSS_INIT
|
||||
#endif
|
||||
|
||||
#if defined(USE_OPENSSL)
|
||||
# include <openssl/ssl.h>
|
||||
#elif defined(USE_WOLFSSL)
|
||||
|
|
|
|||
|
|
@ -645,11 +645,9 @@
|
|||
|
||||
#define LIBIDN_REQUIRED_VERSION "0.4.1"
|
||||
|
||||
#if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_NSS) || \
|
||||
defined(USE_MBEDTLS) || \
|
||||
defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || \
|
||||
defined(USE_SECTRANSP) || defined(USE_GSKIT) || \
|
||||
defined(USE_BEARSSL) || defined(USE_RUSTLS)
|
||||
#if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
|
||||
defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \
|
||||
defined(USE_GSKIT) || defined(USE_BEARSSL) || defined(USE_RUSTLS)
|
||||
#define USE_SSL /* SSL support has been enabled */
|
||||
#endif
|
||||
|
||||
|
|
@ -667,10 +665,10 @@
|
|||
|
||||
/* Single point where USE_NTLM definition might be defined */
|
||||
#if !defined(CURL_DISABLE_CRYPTO_AUTH) && !defined(CURL_DISABLE_NTLM)
|
||||
# if defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
|
||||
defined(USE_GNUTLS) || defined(USE_NSS) || defined(USE_SECTRANSP) || \
|
||||
defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
|
||||
(defined(USE_WOLFSSL) && defined(HAVE_WOLFSSL_DES_ECB_ENCRYPT))
|
||||
# if defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
|
||||
defined(USE_GNUTLS) || defined(USE_SECTRANSP) || \
|
||||
defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
|
||||
(defined(USE_WOLFSSL) && defined(HAVE_WOLFSSL_DES_ECB_ENCRYPT))
|
||||
# define USE_CURL_NTLM_CORE
|
||||
# endif
|
||||
# if defined(USE_CURL_NTLM_CORE) || defined(USE_WINDOWS_SSPI)
|
||||
|
|
|
|||
|
|
@ -1116,10 +1116,8 @@ struct PureInfo {
|
|||
int conn_local_port;
|
||||
const char *conn_scheme;
|
||||
unsigned int conn_protocol;
|
||||
struct curl_certinfo certs; /* info about the certs, only populated in
|
||||
OpenSSL, GnuTLS, Schannel, NSS and GSKit
|
||||
builds. Asked for with CURLOPT_CERTINFO
|
||||
/ CURLINFO_CERTINFO */
|
||||
struct curl_certinfo certs; /* info about the certs. Asked for with
|
||||
CURLOPT_CERTINFO / CURLINFO_CERTINFO */
|
||||
CURLproxycode pxcode;
|
||||
BIT(timecond); /* set to TRUE if the time condition didn't match, which
|
||||
thus made the document NOT get fetched */
|
||||
|
|
|
|||
|
|
@ -45,12 +45,6 @@
|
|||
#include "rand.h"
|
||||
#include "vtls/vtls.h"
|
||||
|
||||
/* SSL backend-specific #if branches in this file must be kept in the order
|
||||
documented in curl_ntlm_core. */
|
||||
#if defined(NTLM_NEEDS_NSS_INIT)
|
||||
#include "vtls/nssg.h" /* for Curl_nss_force_init() */
|
||||
#endif
|
||||
|
||||
#define BUILDING_CURL_NTLM_MSGS_C
|
||||
#include "vauth/vauth.h"
|
||||
#include "vauth/ntlm.h"
|
||||
|
|
@ -274,12 +268,7 @@ CURLcode Curl_auth_decode_ntlm_type2_message(struct Curl_easy *data,
|
|||
const unsigned char *type2 = Curl_bufref_ptr(type2ref);
|
||||
size_t type2len = Curl_bufref_len(type2ref);
|
||||
|
||||
#if defined(NTLM_NEEDS_NSS_INIT)
|
||||
/* Make sure the crypto backend is initialized */
|
||||
result = Curl_nss_force_init(data);
|
||||
if(result)
|
||||
return result;
|
||||
#elif defined(CURL_DISABLE_VERBOSE_STRINGS)
|
||||
#if defined(CURL_DISABLE_VERBOSE_STRINGS)
|
||||
(void)data;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
2551
lib/vtls/nss.c
2551
lib/vtls/nss.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,41 +0,0 @@
|
|||
#ifndef HEADER_CURL_NSSG_H
|
||||
#define HEADER_CURL_NSSG_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "curl_setup.h"
|
||||
|
||||
#ifdef USE_NSS
|
||||
/*
|
||||
* This header should only be needed to get included by vtls.c and nss.c
|
||||
*/
|
||||
|
||||
#include "urldata.h"
|
||||
|
||||
/* initialize NSS library if not already */
|
||||
CURLcode Curl_nss_force_init(struct Curl_easy *data);
|
||||
|
||||
extern const struct Curl_ssl Curl_ssl_nss;
|
||||
|
||||
#endif /* USE_NSS */
|
||||
#endif /* HEADER_CURL_NSSG_H */
|
||||
|
|
@ -1293,7 +1293,7 @@ static OSStatus CopyIdentityFromPKCS12File(const char *cPath,
|
|||
|
||||
/* This code was borrowed from nss.c, with some modifications:
|
||||
* Determine whether the nickname passed in is a filename that needs to
|
||||
* be loaded as a PEM or a regular NSS nickname.
|
||||
* be loaded as a PEM or a nickname.
|
||||
*
|
||||
* returns 1 for a file
|
||||
* returns 0 for not a file
|
||||
|
|
|
|||
|
|
@ -1244,8 +1244,6 @@ const struct Curl_ssl *Curl_ssl =
|
|||
&Curl_ssl_gskit;
|
||||
#elif defined(USE_MBEDTLS)
|
||||
&Curl_ssl_mbedtls;
|
||||
#elif defined(USE_NSS)
|
||||
&Curl_ssl_nss;
|
||||
#elif defined(USE_RUSTLS)
|
||||
&Curl_ssl_rustls;
|
||||
#elif defined(USE_OPENSSL)
|
||||
|
|
@ -1274,9 +1272,6 @@ static const struct Curl_ssl *available_backends[] = {
|
|||
#if defined(USE_MBEDTLS)
|
||||
&Curl_ssl_mbedtls,
|
||||
#endif
|
||||
#if defined(USE_NSS)
|
||||
&Curl_ssl_nss,
|
||||
#endif
|
||||
#if defined(USE_OPENSSL)
|
||||
&Curl_ssl_openssl,
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -217,7 +217,6 @@ CURLcode Curl_ssl_addsessionid(struct Curl_cfilter *cf,
|
|||
|
||||
#include "openssl.h" /* OpenSSL versions */
|
||||
#include "gtls.h" /* GnuTLS versions */
|
||||
#include "nssg.h" /* NSS versions */
|
||||
#include "gskit.h" /* Global Secure ToolKit versions */
|
||||
#include "wolfssl.h" /* wolfSSL versions */
|
||||
#include "schannel.h" /* Schannel SSPI version */
|
||||
|
|
|
|||
|
|
@ -24,15 +24,15 @@
|
|||
|
||||
#include "curl_setup.h"
|
||||
|
||||
#if defined(USE_GSKIT) || defined(USE_NSS) || defined(USE_GNUTLS) || \
|
||||
defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP)
|
||||
#if defined(USE_GSKIT) || defined(USE_GNUTLS) || defined(USE_WOLFSSL) || \
|
||||
defined(USE_SCHANNEL) || defined(USE_SECTRANSP)
|
||||
|
||||
#if defined(USE_GSKIT) || defined(USE_WOLFSSL) || defined(USE_SCHANNEL)
|
||||
#define WANT_PARSEX509 /* uses Curl_parseX509() */
|
||||
#endif
|
||||
|
||||
#if defined(USE_GSKIT) || defined(USE_NSS) || defined(USE_GNUTLS) || \
|
||||
defined(USE_SCHANNEL) || defined(USE_SECTRANSP)
|
||||
#if defined(USE_GSKIT) || defined(USE_GNUTLS) || defined(USE_SCHANNEL) || \
|
||||
defined(USE_SECTRANSP)
|
||||
#define WANT_EXTRACT_CERTINFO /* uses Curl_extract_certinfo() */
|
||||
#define WANT_PARSEX509 /* ... uses Curl_parseX509() */
|
||||
#endif
|
||||
|
|
@ -1261,8 +1261,8 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
|
|||
|
||||
#endif /* WANT_EXTRACT_CERTINFO */
|
||||
|
||||
#endif /* USE_GSKIT or USE_NSS or USE_GNUTLS or USE_WOLFSSL or USE_SCHANNEL
|
||||
* or USE_SECTRANSP */
|
||||
#endif /* USE_GSKIT or USE_GNUTLS or USE_WOLFSSL or USE_SCHANNEL * or
|
||||
USE_SECTRANSP */
|
||||
|
||||
#ifdef WANT_VERIFYHOST
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
#include "curl_setup.h"
|
||||
|
||||
#if defined(USE_GSKIT) || defined(USE_NSS) || defined(USE_GNUTLS) || \
|
||||
defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP)
|
||||
#if defined(USE_GSKIT) || defined(USE_GNUTLS) || defined(USE_WOLFSSL) || \
|
||||
defined(USE_SCHANNEL) || defined(USE_SECTRANSP)
|
||||
|
||||
#include "cfilters.h"
|
||||
#include "urldata.h"
|
||||
|
|
@ -76,6 +76,6 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data, int certnum,
|
|||
const char *beg, const char *end);
|
||||
CURLcode Curl_verifyhost(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
const char *beg, const char *end);
|
||||
#endif /* USE_GSKIT or USE_NSS or USE_GNUTLS or USE_WOLFSSL or USE_SCHANNEL
|
||||
#endif /* USE_GSKIT or USE_GNUTLS or USE_WOLFSSL or USE_SCHANNEL
|
||||
* or USE_SECTRANSP */
|
||||
#endif /* HEADER_CURL_X509ASN1_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue