Some patches that let the build get further along, before I gave up. Er, stopped working on this. :) -- Rich Salz, OpenSSL dev team; [email protected]
commit cba3ae0f8e42b536c2be706fdbb650d7a41d7c06 Author: Rich Salz <[email protected]> Date: Thu Aug 14 01:01:48 2014 -0400 RT2779: Can't build with no-stdio configured First pass of making this work (why do we bother?) Put #ifndef OPENSSL_NO_FP_API wrappers around API declarations that were missing them. Make cryptlib.c compile by #ifdef'ing out some functions, and in OPENSLS_cpuid avoiding the sscanf call. (Why is that there in the first place? Does it do more than stroul?) --- crypto/conf/conf.h | 4 ++++ crypto/cryptlib.c | 12 +++++++++++- crypto/pem/pem.h | 5 +++++ crypto/pem/pem_pk8.c | 2 ++ crypto/ts/ts.h | 8 ++++++++ crypto/x509v3/x509v3.h | 2 ++ 6 files changed, 32 insertions(+), 1 deletions(-) diff --git a/crypto/conf/conf.h b/crypto/conf/conf.h index c219997..4936345 100644 --- a/crypto/conf/conf.h +++ b/crypto/conf/conf.h @@ -134,7 +134,9 @@ char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group, long CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group, const char *name); void CONF_free(LHASH_OF(CONF_VALUE) *conf); +#ifndef OPENSSL_NO_FP_API int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); +#endif int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); void OPENSSL_config(const char *config_name); @@ -168,7 +170,9 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section); char *NCONF_get_string(const CONF *conf,const char *group,const char *name); int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, long *result); +#ifndef OPENSSL_NO_FP_API int NCONF_dump_fp(const CONF *conf, FILE *out); +#endif int NCONF_dump_bio(const CONF *conf, BIO *out); #if 0 /* The following function has no error checking, diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index 897b5b5..b4c90db 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -129,6 +129,7 @@ extern unsigned int OPENSSL_ia32cap_P[4]; unsigned int *OPENSSL_ia32cap_loc(void) { return OPENSSL_ia32cap_P; } #if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY) + #define OPENSSL_CPUID_SETUP #if defined(_WIN32) typedef unsigned __int64 IA32CAP; @@ -146,11 +147,15 @@ void OPENSSL_cpuid_setup(void) trigger=1; if ((env=getenv("OPENSSL_ia32cap"))) { int off = (env[0]=='~')?1:0; +#ifdef OPENSSL_NO_STDIO + vec = strtoul(env+off,NULL,0); +#else #if defined(_WIN32) if (!sscanf(env+off,"%I64i",&vec)) vec = strtoul(env+off,NULL,0); #else if (!sscanf(env+off,"%lli",(long long *)&vec)) vec = strtoul(env+off,NULL,0); #endif +#endif if (off) vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P)&~vec; else if (env[0]==':') vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P); @@ -296,6 +301,7 @@ int OPENSSL_isservice(void) int OPENSSL_isservice(void) { return 0; } #endif +#ifndef OPENSSL_NO_STDIO void OPENSSL_showfatal (const char *fmta,...) { va_list ap; TCHAR buf[256]; @@ -367,7 +373,10 @@ void OPENSSL_showfatal (const char *fmta,...) #endif MessageBox (NULL,buf,_T("OpenSSL: FATAL"),MB_OK|MB_ICONSTOP); } +#endif + #else +#ifndef OPENSSL_NO_STDIO void OPENSSL_showfatal (const char *fmta,...) { va_list ap; @@ -375,6 +384,7 @@ void OPENSSL_showfatal (const char *fmta,...) vfprintf (stderr,fmta,ap); va_end (ap); } +#endif int OPENSSL_isservice (void) { return 0; } #endif @@ -394,7 +404,7 @@ void OpenSSLDie(const char *file,int line,const char *assertion) #endif } -#ifndef OPENSSL_FIPSCANISTER +#if !defined( OPENSSL_FIPSCANISTER) && !defined(OPENSSL_NO_STDIO) void *OPENSSL_stderr(void) { return stderr; } #endif diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h index 5fb903e..f61c5b9 100644 --- a/crypto/pem/pem.h +++ b/crypto/pem/pem.h @@ -326,6 +326,7 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ #define DECLARE_PEM_read_fp(name, type) /**/ #define DECLARE_PEM_write_fp(name, type) /**/ +#define DECLARE_PEM_write_fp_const(name, type) /**/ #define DECLARE_PEM_write_cb_fp(name, type) /**/ #else @@ -426,6 +427,7 @@ int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cd, void *u); #endif +#ifndef OPENSSL_NO_FP_API int PEM_read(FILE *fp, char **name, char **header, unsigned char **data,long *len); int PEM_write(FILE *fp, const char *name, const char *hdr, @@ -437,6 +439,7 @@ int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp, int klen,pem_password_cb *callback, void *u); STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); +#endif int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, unsigned char **ek, int *ekl, @@ -526,6 +529,7 @@ int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, pem_password_cb *cb, void *u); EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u); +#ifndef OPENSSL_NO_FP_API int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u); @@ -540,6 +544,7 @@ EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, vo int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc, char *kstr,int klen, pem_password_cb *cd, void *u); +#endif EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c index 6deab8c..6e62bfb 100644 --- a/crypto/pem/pem_pk8.c +++ b/crypto/pem/pem_pk8.c @@ -70,10 +70,12 @@ static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, int nid, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u); +#ifndef OPENSSL_NO_FP_API static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder, int nid, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u); +#endif /* These functions write a private key in PKCS#8 format: it is a "drop in" * replacement for PEM_write_bio_PrivateKey() and friends. As usual if 'enc' diff --git a/crypto/ts/ts.h b/crypto/ts/ts.h index c2448e3..3aa030e 100644 --- a/crypto/ts/ts.h +++ b/crypto/ts/ts.h @@ -288,8 +288,10 @@ TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length); TS_REQ *TS_REQ_dup(TS_REQ *a); +#ifndef OPENSSL_NO_FP_API TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a); int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a); +#endif TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a); int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a); @@ -301,8 +303,10 @@ TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); +#ifndef OPENSSL_NO_FP_API TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a); int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a); +#endif TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT **a); int i2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a); @@ -313,8 +317,10 @@ TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length); TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); TS_RESP *TS_RESP_dup(TS_RESP *a); +#ifndef OPENSSL_NO_FP_API TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a); int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a); +#endif TS_RESP *d2i_TS_RESP_bio(BIO *fp, TS_RESP **a); int i2d_TS_RESP_bio(BIO *fp, TS_RESP *a); @@ -332,8 +338,10 @@ TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, long length); TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); +#ifndef OPENSSL_NO_FP_API TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a); +#endif TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO **a); int i2d_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO *a); diff --git a/crypto/x509v3/x509v3.h b/crypto/x509v3/x509v3.h index 3da2243..06deca0 100644 --- a/crypto/x509v3/x509v3.h +++ b/crypto/x509v3/x509v3.h @@ -684,7 +684,9 @@ int name_cmp(const char *name, const char *cmp); void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml); int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent); +#ifndef OPENSSL_NO_FP_API int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); +#endif int X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent);
