add fips pos cb for fail codes, generated hash

This commit is contained in:
toddouska 2014-10-28 14:03:58 -07:00
parent c982dd2281
commit 247bef6be3
2 changed files with 25 additions and 1 deletions

View File

@ -70,6 +70,9 @@
#ifdef HAVE_PKCS7
#include <cyassl/ctaocrypt/pkcs7.h>
#endif
#ifdef HAVE_FIPS
#include <cyassl/ctaocrypt/fips_test.h>
#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);

View File

@ -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