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>
# include <openssl/engine.h>
# include <openssl/ocsp.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