wrap optional headers with OPENSSL_NO_ macro

This commit is contained in:
Zhi Guan
2017-12-26 22:51:47 +08:00
parent 58751e510e
commit a9b31e17a5
37 changed files with 202 additions and 67 deletions

View File

@@ -23,8 +23,12 @@
# include <openssl/lhash.h>
# include <openssl/conf.h>
# include <openssl/txt_db.h>
# ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
# endif
# ifndef OPENSSL_NO_OCSP
# include <openssl/ocsp.h>
# endif
# include <signal.h>
# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE)

View File

@@ -8,11 +8,9 @@
*/
#include <openssl/opensslconf.h>
/* 依赖DES是由PKCS12的标准要求的还是遗留问题
*/
#if defined(OPENSSL_NO_DES)
NON_EMPTY_TRANSLATION_UNIT
#else
//#if defined(OPENSSL_NO_DES)
//NON_EMPTY_TRANSLATION_UNIT
//#else
# include <stdio.h>
# include <stdlib.h>
@@ -124,10 +122,14 @@ int pkcs12_main(int argc, char **argv)
char pass[2048] = "", macpass[2048] = "";
int export_cert = 0, options = 0, chain = 0, twopass = 0, keytype = 0;
int iter = PKCS12_DEFAULT_ITER, maciter = PKCS12_DEFAULT_ITER;
# ifndef OPENSSL_NO_RC2
# if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_RC2)
int cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
# else
# elif !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_DES)
int cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
# elif !defined(OPENSSL_NO_SM3) && !defined(OPENSSL_NO_SMS4)
int cert_pbe = NID_pbe_WithSM3AndSMS4_CBC;
# else
# error "no avaiable cipher"
# endif
int key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
int ret = 1, macver = 1, add_lmk = 0, private = 0;
@@ -141,7 +143,14 @@ int pkcs12_main(int argc, char **argv)
BIO *in = NULL, *out = NULL;
PKCS12 *p12 = NULL;
STACK_OF(OPENSSL_STRING) *canames = NULL;
#if !defined(OPENSSL_NO_DES)
const EVP_CIPHER *enc = EVP_des_ede3_cbc();
#elif !defined(OPENSSL_NO_SMS4)
const EVP_CIPHER *enc = EVP_sms4_cbc();
#else
# error "no avaible cipher"
#endif
OPTION_CHOICE o;
prog = opt_init(argc, argv, pkcs12_options);
@@ -934,4 +943,4 @@ static int set_pbe(int *ppbe, const char *str)
return 1;
}
#endif
//#endif

View File

@@ -183,10 +183,10 @@ static FUNCTION functions[] = {
#ifndef OPENSSL_NO_OTP
{ FT_general, "otp", otp_main, otp_options },
#endif
#if !defined(OPENSSL_NO_MD5) && !defined(OPENSSL_DES)
{ FT_general, "passwd", passwd_main, passwd_options },
#ifndef OPENSSL_NO_PKCS12
{ FT_general, "pkcs12", pkcs12_main, pkcs12_options },
#endif
{ FT_general, "pkcs12", pkcs12_main, pkcs12_options },
#ifndef OPENSSL_NO_PKCS7
{ FT_general, "pkcs7", pkcs7_main, pkcs7_options },
#endif

View File

@@ -11,7 +11,9 @@
#include "internal/cryptlib.h"
#include <openssl/asn1t.h>
#include <openssl/x509.h>
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#include "internal/asn1_int.h"
#include "internal/evp_int.h"

View File

@@ -12,7 +12,9 @@
#include <openssl/bn.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#include <openssl/x509.h>
#include <openssl/asn1.h>
#include "internal/asn1_int.h"

View File

@@ -13,7 +13,9 @@
#include <openssl/conf.h>
#include <openssl/x509.h>
#include <openssl/asn1.h>
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
/* Load all OpenSSL builtin modules */

View File

@@ -13,7 +13,9 @@
#include <internal/conf.h>
#include <openssl/x509.h>
#include <openssl/asn1.h>
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
/*
* This is the automatic configuration loader: it is called automatically by

View File

@@ -12,7 +12,9 @@
#include <openssl/x509.h>
#include <openssl/ec.h>
#include <openssl/bn.h>
#ifndef OPENSSL_NO_CMS
# include <openssl/cms.h>
#endif
#include <openssl/asn1t.h>
#include "internal/asn1_int.h"
#include "internal/evp_int.h"

View File

@@ -17,7 +17,9 @@
#include <string.h>
#include "ec_lcl.h"
#include <openssl/err.h>
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
EC_KEY *EC_KEY_new(void)
{

View File

@@ -9,7 +9,9 @@
#include <string.h>
#include <openssl/ec.h>
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#include <openssl/err.h>
#include "ec_lcl.h"
#ifndef OPENSSL_NO_SM2

View File

@@ -18,7 +18,9 @@
#endif
#include <openssl/buffer.h>
#include <openssl/bio.h>
#ifndef OPENSSL_NO_COMP
# include <openssl/comp.h>
#endif
#ifndef OPENSSL_NO_RSA
# include <openssl/rsa.h>
#endif
@@ -37,14 +39,22 @@
#include <openssl/pkcs12.h>
#include <openssl/rand.h>
#include "internal/dso.h"
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#ifndef OPENSSL_NO_UI
# include <openssl/ui.h>
#endif
#ifndef OPENSSL_NO_OCSP
# include <openssl/ocsp.h>
#endif
#include <openssl/err.h>
#ifdef OPENSSL_FIPS
# include <openssl/fips.h>
#endif
#ifndef OPENSSL_NO_TS
# include <openssl/ts.h>
#endif
#ifndef OPENSSL_NO_CMS
# include <openssl/cms.h>
#endif

View File

@@ -11,7 +11,9 @@
#include "internal/cryptlib.h"
#include <openssl/objects.h>
#include <openssl/evp.h>
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#include "internal/evp_int.h"
#include "evp_locl.h"
#ifndef OPENSSL_NO_SM2

View File

@@ -13,7 +13,9 @@
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#include "internal/evp_int.h"
#include "evp_locl.h"

View File

@@ -16,7 +16,9 @@
# include <openssl/objects.h>
# include <openssl/x509.h>
# include <openssl/md5.h>
# ifndef OPENSSL_NO_RSA
# include <openssl/rsa.h>
# endif
# include "internal/evp_int.h"
static int init(EVP_MD_CTX *ctx)

View File

@@ -26,7 +26,9 @@
#ifndef OPENSSL_NO_PAILLIER
# include <openssl/paillier.h>
#endif
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#include "internal/asn1_int.h"
#include "internal/evp_int.h"

View File

@@ -10,7 +10,9 @@
#include <stdio.h>
#include <stdlib.h>
#include "internal/cryptlib.h"
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#include <openssl/evp.h>
#include <openssl/x509v3.h>
#include "internal/asn1_int.h"

View File

@@ -7,7 +7,11 @@
* https://www.openssl.org/source/license.html
*/
//FIXME:
#ifndef OPENSSL_NO_ASYNC
#include <openssl/async.h>
#endif
int async_init(void);
void async_deinit(void);

View File

@@ -7,7 +7,9 @@
* https://www.openssl.org/source/license.html
*/
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif
void engine_load_openssl_int(void);
void engine_load_cryptodev_int(void);

View File

@@ -52,10 +52,14 @@
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <openssl/x509.h>
#ifndef OPENSSL_NO_PKCS7
# include <openssl/pkcs7.h>
#endif
#include <openssl/pem.h>
#include <openssl/pem3.h>
#ifndef OPENSSL_NO_PAILLIER
# include <openssl/paillier.h>
#endif
/*
extern PAILLIER *EVP_PKEY_get1_PAILLIER(EVP_PKEY *key);

View File

@@ -22,7 +22,9 @@
#ifndef OPENSSL_NO_DES
# include <openssl/des.h>
#endif
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#define MIN_LENGTH 4

View File

@@ -15,7 +15,9 @@
#include <openssl/x509.h>
#include <openssl/pkcs12.h>
#include <openssl/pem.h>
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#ifndef OPENSSL_NO_DH
# include <openssl/dh.h>
#endif

View File

@@ -22,7 +22,9 @@
#include <openssl/opensslconf.h>
#include <openssl/crypto.h>
#include <openssl/rand.h>
#ifndef OPENSSL_NO_ASYNC
# include <openssl/async.h>
#endif
#include "rand_lcl.h"
#include <openssl/err.h>

View File

@@ -13,7 +13,9 @@
#include <openssl/opensslconf.h>
#include "internal/rand.h"
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#ifdef OPENSSL_FIPS
# include <openssl/fips.h>

View File

@@ -19,14 +19,22 @@
#include <string.h>
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#ifndef OPENSSL_NO_DH
# include <openssl/dh.h>
#endif
#include <openssl/ec.h>
#include <openssl/ocsp.h>
#include <openssl/pkcs12.h>
#ifndef OPENSSL_NO_RSA
# include <openssl/rsa.h>
#endif
#ifndef OPENSSL_NO_TS
# include <openssl/ts.h>
#endif
#include <openssl/x509v3.h>
#ifndef OPENSSL_NO_CMS
# include <openssl/cms.h>
#endif
#include "fuzzer.h"
static ASN1_ITEM_EXP *item_type[] = {
@@ -153,10 +161,12 @@ static ASN1_ITEM_EXP *item_type[] = {
ASN1_ITEM_ref(POLICYQUALINFO),
ASN1_ITEM_ref(PROXY_CERT_INFO_EXTENSION),
ASN1_ITEM_ref(PROXY_POLICY),
#ifndef OPENSSL_NO_RSA
ASN1_ITEM_ref(RSA_OAEP_PARAMS),
ASN1_ITEM_ref(RSAPrivateKey),
ASN1_ITEM_ref(RSA_PSS_PARAMS),
ASN1_ITEM_ref(RSAPublicKey),
#endif
ASN1_ITEM_ref(SXNET),
ASN1_ITEM_ref(SXNETID),
/*ASN1_ITEM_ref(TS_RESP), want to do this, but type is hidden, however d2i exists... */

View File

@@ -7,6 +7,8 @@
* https://www.openssl.org/source/license.html
*/
#ifndef OPENSSL_NO_COMP
# include <openssl/comp.h>
#endif
void comp_zlib_cleanup_int(void);

View File

@@ -41,9 +41,9 @@ extern "C" {
*/
# define OPENSSL_VERSION_NUMBER 0x1010004fL
# ifdef OPENSSL_FIPS
# define OPENSSL_VERSION_TEXT "GmSSL 2.0 - OpenSSL 1.1.0d-fips 08 Dec 2017"
# define OPENSSL_VERSION_TEXT "GmSSL 2.0.0 - OpenSSL 1.1.0d-fips 08 Dec 2017"
# else
# define OPENSSL_VERSION_TEXT "GmSSL 2.0 - OpenSSL 1.1.0d 08 Dec 2017"
# define OPENSSL_VERSION_TEXT "GmSSL 2.0.0 - OpenSSL 1.1.0d 08 Dec 2017"
# endif
/*-

View File

@@ -50,11 +50,21 @@
#ifndef HEADER_PEM3_H
#define HEADER_PEM3_H
#ifndef OPENSSL_NO_CPK
# include <openssl/cpk.h>
#endif
#ifndef OPENSSL_NO_SM9
# include <openssl/sm9.h>
#endif
#ifndef OPENSSL_NO_BFIBE
# include <openssl/bfibe.h>
#endif
#ifndef OPENSSL_NO_BB1IBE
# include <openssl/bb1ibe.h>
#endif
#ifndef OPENSSL_NO_PAILLIER
# include <openssl/paillier.h>
#endif
#ifdef __cplusplus

View File

@@ -92,7 +92,9 @@
# include <openssl/e_os2.h>
# include <openssl/opensslconf.h>
# ifndef OPENSSL_NO_COMP
# include <openssl/comp.h>
# endif
# include <openssl/bio.h>
# if OPENSSL_API_COMPAT < 0x10100000L
# include <openssl/x509.h>
@@ -102,11 +104,15 @@
# endif
# include <openssl/pem.h>
# include <openssl/hmac.h>
# ifndef OPENSSL_NO_ASYNC
# include <openssl/async.h>
# endif
# include <openssl/safestack.h>
# include <openssl/symhacks.h>
# ifndef OPENSSL_NO_CT
# include <openssl/ct.h>
# endif
#ifdef __cplusplus
extern "C" {
@@ -1707,7 +1713,7 @@ __owur const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */
__owur const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */
__owur const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */
#ifndef OPENSSL_NO_GMTLS_METHOD
#ifndef OPENSSL_NO_GMTLS
__owur const SSL_METHOD *GMTLS_method(void); /* GMTLSv1.1 */
__owur const SSL_METHOD *GMTLS_server_method(void); /* GMTLSv1.1 */
__owur const SSL_METHOD *GMTLS_client_method(void); /* GMTLSv1.1 */

View File

@@ -16,7 +16,9 @@
#ifndef HEADER_SSL3_H
# define HEADER_SSL3_H
# ifndef OPENSSL_NO_COMP
# include <openssl/comp.h>
# endif
# include <openssl/buffer.h>
# include <openssl/evp.h>
# include <openssl/ssl.h>

View File

@@ -73,7 +73,9 @@
#include <openssl/bio.h>
#include <openssl/pem.h>
#include <openssl/x509v3.h>
#ifndef OPENSSL_NO_DH
# include <openssl/dh.h>
#endif
#include <openssl/bn.h>
#include <openssl/crypto.h>
#include "ssl_locl.h"

View File

@@ -42,8 +42,12 @@
#include <stdio.h>
#include <ctype.h>
#include <openssl/objects.h>
#ifndef OPENSSL_NO_COMP
# include <openssl/comp.h>
#endif
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#include <openssl/crypto.h>
#include "ssl_locl.h"
#include "internal/thread_once.h"

View File

@@ -94,10 +94,18 @@
#include <openssl/lhash.h>
#include <openssl/x509v3.h>
#include <openssl/rand.h>
#ifndef OPENSSL_NO_OCSP
# include <openssl/ocsp.h>
#endif
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#ifndef OPENSSL_NO_ASYNC
# include <openssl/async.h>
#endif
#ifndef OPENSSL_NO_CT
#include <openssl/ct.h>
#endif
const char SSL_version_str[] = OPENSSL_VERSION_TEXT;
@@ -706,7 +714,9 @@ SSL *SSL_new(SSL_CTX *ctx)
s->psk_server_callback = ctx->psk_server_callback;
#endif
#ifndef OPENSSL_NO_ASYNC
s->job = NULL;
#endif
#ifndef OPENSSL_NO_CT
if (!SSL_set_ct_validation_callback(s, ctx->ct_validation_callback,

View File

@@ -100,7 +100,9 @@
# endif
# include <openssl/buffer.h>
# ifndef OPENSSL_NO_COMP
# include <openssl/comp.h>
# endif
# include <openssl/bio.h>
# include <openssl/stack.h>
# ifndef OPENSSL_NO_RSA
@@ -114,9 +116,14 @@
# endif
# include <openssl/err.h>
# include <openssl/ssl.h>
# include <openssl/gmtls.h>
# ifndef OPENSSL_NO_ASYNC
# include <openssl/async.h>
# endif
# include <openssl/symhacks.h>
# ifndef OPENSSL_NO_CT
# include <openssl/ct.h>
# endif
# include "record/record.h"
# include "statem/statem.h"
# include "packet_locl.h"
@@ -557,12 +564,14 @@ struct ssl_method_st {
long (*ssl_ctx_callback_ctrl) (SSL_CTX *s, int cb_id, void (*fp) (void));
};
#ifndef OPENSSL_NO_SM9
typedef struct cert_sm9_st {
SM9PublicParameters *params;
SM9PrivateKey *privatekey;
SM9PublicKey *publickey;
char *id;
} CERT_SM9;
#endif
/*-
* Lets make this into an ASN.1 type structure as follows
@@ -1234,8 +1243,10 @@ struct ssl_st {
/* Default password callback user data. */
void *default_passwd_callback_userdata;
/* Async Job info */
# ifndef OPENSSL_NO_ASYNC
ASYNC_JOB *job;
ASYNC_WAIT_CTX *waitctx;
# endif
CRYPTO_RWLOCK *lock;
};

View File

@@ -85,7 +85,9 @@
#include <stdio.h>
#include <openssl/lhash.h>
#include <openssl/rand.h>
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
#include "ssl_locl.h"
static void SSL_SESSION_list_remove(SSL_CTX *ctx, SSL_SESSION *s);

View File

@@ -84,7 +84,9 @@
#include <stdio.h>
#include "ssl_locl.h"
#ifndef OPENSSL_NO_COMP
# include <openssl/comp.h>
#endif
#include <openssl/evp.h>
#include <openssl/kdf.h>
#include <openssl/rand.h>

View File

@@ -9,7 +9,12 @@
/* Custom extension utility functions */
#include <stdio.h>
#include <openssl/opensslconf.h>
#ifndef OPENSSL_NO_CT
# include <openssl/ct.h>
#endif
#include "ssl_locl.h"
/* Find a custom extension from the list. */

View File

@@ -57,16 +57,20 @@
#include <stdio.h>
#include <stdlib.h>
#include <openssl/opensslconf.h>
#include <openssl/objects.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#ifndef OPENSSL_NO_OCSP
# include <openssl/ocsp.h>
#endif
#include <openssl/conf.h>
#include <openssl/x509v3.h>
#include <openssl/bn.h>
#include "ssl_locl.h"
#ifndef OPENSSL_NO_CT
# include <openssl/ct.h>
#endif
#define CHECKLEN(curr, val, limit) \
(((curr) >= (limit)) || (size_t)((limit) - (curr)) < (size_t)(val))