diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2011-03-25 16:36:46 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2011-03-25 16:36:46 +0000 |
commit | cd22dfbf0109ae42f650c0d0b1d0e956fe9a1574 (patch) | |
tree | a3f3ca931c8dfd6b86d5e5666a6c35575817ca1e /fips/fips_utl.h | |
parent | d4178c8fb1736354d16a6e1b82c5e02433973374 (diff) |
Have all algorithm test programs call fips_algtest_init() at startup:
this will perform all standalone operations such as setting error
callbacks, entering FIPS mode etc.
Diffstat (limited to 'fips/fips_utl.h')
-rw-r--r-- | fips/fips_utl.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fips/fips_utl.h b/fips/fips_utl.h index 71147a2a31..3deb406cf4 100644 --- a/fips/fips_utl.h +++ b/fips/fips_utl.h @@ -63,6 +63,7 @@ int bint2bin(const char *in, int len, unsigned char *out); int bin2bint(const unsigned char *in,int len,char *out); void PrintValue(char *tag, unsigned char *val, int len); void OutputValue(char *tag, unsigned char *val, int len, FILE *rfp,int bitmode); +void fips_algtest_init(void); static int no_err; @@ -97,6 +98,16 @@ static void fips_set_error_print(void) FIPS_set_error_callbacks(put_err_cb, add_err_cb); } +void fips_algtest_init(void) + { + fips_set_error_print(); + if (!FIPS_mode_set(1)) + { + fprintf(stderr, "Error entering FIPS mode\n"); + exit(1); + } + } + int hex2bin(const char *in, unsigned char *out) { int n1, n2, isodd = 0; |