Make sure the applications know when we are running in FIPS mode. We

can't use the variable in libcrypto, since it's supposedly unknown.

Note: currently only supported in MONOLITH mode.
This commit is contained in:
Richard Levitte 2004-05-17 04:30:06 +00:00
parent 63d494b22c
commit f27a152f69
2 changed files with 12 additions and 5 deletions

View File

@ -148,9 +148,11 @@ int WIN32_rename(char *oldname,char *newname);
#ifndef NON_MAIN #ifndef NON_MAIN
CONF *config=NULL; CONF *config=NULL;
BIO *bio_err=NULL; BIO *bio_err=NULL;
int in_FIPS_mode=0;
#else #else
extern CONF *config; extern CONF *config;
extern BIO *bio_err; extern BIO *bio_err;
extern int in_FIPS_mode;
#endif #endif
#else #else
@ -159,6 +161,7 @@ extern BIO *bio_err;
extern CONF *config; extern CONF *config;
extern char *default_config_file; extern char *default_config_file;
extern BIO *bio_err; extern BIO *bio_err;
extern int in_FIPS_mode;
#endif #endif

View File

@ -148,6 +148,7 @@ char *default_config_file=NULL;
#ifdef MONOLITH #ifdef MONOLITH
CONF *config=NULL; CONF *config=NULL;
BIO *bio_err=NULL; BIO *bio_err=NULL;
int in_FIPS_mode=0;
#endif #endif
@ -228,10 +229,12 @@ int main(int Argc, char *Argv[])
char **argv,*p; char **argv,*p;
LHASH *prog=NULL; LHASH *prog=NULL;
long errline; long errline;
arg.data=NULL; arg.data=NULL;
arg.count=0; arg.count=0;
in_FIPS_mode = 0;
#ifdef OPENSSL_FIPS #ifdef OPENSSL_FIPS
if(getenv("OPENSSL_FIPS")) { if(getenv("OPENSSL_FIPS")) {
#if defined(_WIN32) #if defined(_WIN32)
@ -242,10 +245,11 @@ int main(int Argc, char *Argv[])
p = Argv[0]; p = Argv[0];
#endif #endif
if (!FIPS_mode_set(1,p)) { if (!FIPS_mode_set(1,p)) {
ERR_load_crypto_strings(); ERR_load_crypto_strings();
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE)); ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
exit(1); exit(1);
} }
in_FIPS_mode = 1;
if (getenv("OPENSSL_FIPS_MD5")) if (getenv("OPENSSL_FIPS_MD5"))
FIPS_allow_md5(1); FIPS_allow_md5(1);
} }