I have been using the frdmkl82z_wolfssl_benchmark example project to see how to utilize the Wolfssl Library and hardware accelerators for the KL82. I have been trying to use the same library in my own project by creating a project through the new project wizard and then copying and pasting the "wolfssl" folder into the project directory. After doing this, making sure the folder was not being excluded from the build (right clicking the folder -> properties -> C/C++ Build and unchecking "Exclude resource from build"), and then building, I get errors (25 total) all along the lines of "fatal error: wolfssl/wolfcrypt/settings.h: No such file or directory". The file structure is very similar to the example projects, so I think there is something else I am missing.
Has anyone had success using the wolfssl library for their project?
Did you add the include paths to your new project? You can do this in Properties > C/C++ Build > MCU C Compiler > Includes.
Also, you need to add the folders to Source Location, please check Properties > C/C++ General > Paths and Symbols > Source Location and then click Add Folder.
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored.
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
That seems to have worked, but I am still having an issue with using an important function. It seems I am unable to use the CRYPTO_InitHardware() function. The console says there is an undefined reference to it. When I right-click on the function and open the declaration, it takes me to the ksdk_port.h file where it is declared but not the ksdk_port.c file where it is defined.
Please double check that the Includes, Preprocessor symbols, files and optimization settings are the same as in the SDK example. I just tried to do it and it compiles correctly on my side.
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:
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)
wc_HmacSetKey(&hmac, SHA256, m_key, sizeof(m_key));
wc_HmacUpdate(&hmac, plain, sizeof(plain));
memcpy(&ret, m_digest, sizeof(m_digest));
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!
Could you please clarify what are the issues you are seeing? What errors are displayed in MCUXpresso? As I have mentioned before I copied the wolfssl folder from the example to a new project and then adapt Includes, Preprocessor symbols, files and optimization settings according to the example. The project compiles correctly and there is no error using Crypto_InitHardware function.