diff --git a/ctaocrypt/test/test.c b/ctaocrypt/test/test.c index 941c0050b..089dcd594 100644 --- a/ctaocrypt/test/test.c +++ b/ctaocrypt/test/test.c @@ -70,6 +70,9 @@ #ifdef HAVE_PKCS7 #include #endif +#ifdef HAVE_FIPS + #include +#endif #ifdef _MSC_VER /* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */ @@ -207,6 +210,16 @@ typedef struct func_args { } func_args; +#ifdef HAVE_FIPS + +static void myFipsCb(int ok, int err, const char* hash) +{ + printf("in my Fips callback, ok = %d, err = %d\n", ok, err); + printf("hash = %s\n", hash); +} + +#endif /* HAVE_FIPS */ + int ctaocrypt_test(void* args) { @@ -214,6 +227,10 @@ int ctaocrypt_test(void* args) ((func_args*)args)->return_code = -1; /* error state */ +#ifdef HAVE_FIPS + wolfCrypt_SetCb_fips(myFipsCb); +#endif + #if !defined(NO_BIG_INT) if (CheckCtcSettings() != 1) return err_sys("Build vs runtime math mismatch\n", -1234); diff --git a/cyassl/ctaocrypt/fips_test.h b/cyassl/ctaocrypt/fips_test.h index 2015927cd..e40a19964 100644 --- a/cyassl/ctaocrypt/fips_test.h +++ b/cyassl/ctaocrypt/fips_test.h @@ -32,7 +32,14 @@ /* Known Answer Test string inputs are hex */ -CYASSL_LOCAL int DoKnownAnswerTests(void); +CYASSL_LOCAL int DoKnownAnswerTests(char*); + + +/* Power on self test failure callback */ +typedef void(*wolfCrypt_fips_cb)(int ok, int err, const char* hash); + +/* Public set function */ +CYASSL_API int wolfCrypt_SetCb_fips(wolfCrypt_fips_cb cbf); #ifdef __cplusplus