Are you able to use that function in your main method, CRYPTO_InitHardware()? What were the steps you took to create the new project and add the wolfssl library. I created the project through the new project wizard and added the library through that. I still had to add to add the preprocessor macro "WOLFSSL_USER_SETTINGS" to get it to build, but I am still unable to use that function.
Update 1: The project I was creating was in C++. I tried creating a project in C to to see what the differences might be and I still had to add the WOLFSSL_USER_SETTINGS preprocessor macro inside the project settings. However, I finally was able to use the Crypto_InitHardware function and was also able to hash some data! I am obviously doing something wrong with my C++ project to be able to use the library but I'm sure there is a correct way to use it.
Update 2: After creating a C file to contain all of my wolfssl libraries and functionality, I am still having issues using it. I have a header file that includes the following:
#include "nxp/ksdk_port.h"
#include "fsl_device_registers.h"
#include <wolfssl/wolfcrypt/settings.h>
#include <string.h>
#include <stdio.h>
#include <wolfssl/wolfcrypt/random.h>
#include <wolfssl/wolfcrypt/des3.h>
#include <wolfssl/wolfcrypt/arc4.h>
#include <wolfssl/wolfcrypt/hc128.h>
#include <wolfssl/wolfcrypt/rabbit.h>
#include <wolfssl/wolfcrypt/chacha.h>
#include <wolfssl/wolfcrypt/chacha20_poly1305.h>
#include <wolfssl/wolfcrypt/aes.h>
#include <wolfssl/wolfcrypt/poly1305.h>
#include <wolfssl/wolfcrypt/camellia.h>
#include <wolfssl/wolfcrypt/md5.h>
#include <wolfssl/wolfcrypt/sha.h>
#include <wolfssl/wolfcrypt/sha256.h>
#include <wolfssl/wolfcrypt/sha512.h>
#include <wolfssl/wolfcrypt/rsa.h>
#include <wolfssl/wolfcrypt/asn.h>
#include <wolfssl/wolfcrypt/ripemd.h>
#include <wolfssl/wolfcrypt/cmac.h>
#include <wolfssl/wolfcrypt/hmac.h>
#include <wolfssl/wolfcrypt/ecc.h>
#include <wolfssl/wolfcrypt/curve25519.h>
#include <wolfssl/wolfcrypt/ed25519.h>
#include <wolfssl/wolfcrypt/dh.h>
#include <wolfssl/wolfcrypt/random.h>
#include <wolfssl/certs_test.h>
#include "wolfssl/wolfcrypt/mem_track.h"
I am not sure I need all of them, but I am just grabbing them from the "wolfssl_benchmark.c" example file (that runs perfectly fine for me). I am then prototyping a few other functions to use the wolfssl functions.
For example, and in particular:
-----------
uint32_t generateHmac(uint8_t * plain, uint8_t length)
{
Hmac hmac;
uint32_t ret;
wc_HmacSetKey(&hmac, SHA256, m_key, sizeof(m_key));
wc_HmacUpdate(&hmac, plain, sizeof(plain));
wc_HmacFinal(&hmac, m_digest);
memcpy(&ret, m_digest, sizeof(m_digest));
return ret;
}
---------
wc_HmacSetKey() seems to work fine, and it is not until using the second function, wc_HmacUpdate(), that my debugger goes into hardfault. It is pretty deep inside this function that the failure occurs and I am not sure specifically where.
This leads me to believe that there is still something wrong with using the Crypto_InitHardware function. When I hover over the function and see where it is declared, it shows me the prototype but not the actual definition of the function. With other functions this is not the case- it shows me the actual definition.
I hope someone can help point me in the right direction with this information!