Hello gojimmypi, thank you for your reply!
I'm using wolfssl 5.7.2, picked from the Arduino IDE library manager (IDE that I'm using).
And thank you so much for those snippets! Even though I'm not focusing on key-share, it really helped me see that I'm on the right track.
To better contextualize what I'm doing: I'm mainly trying to use dilithium and falcon algorithms to generate keys, sign and verify a message. I'm trying to do all of those steps sequentially. It doesn't make much sense to do that, but it's more like a proof-of-concept to show that I can perform all of those expensive operations on a esp32. After showing that it is possible, I'd sign messages in the esp32, and then send this message to be verified in another device, possibly another esp32 or a mobile application, for example.
Having said that, I'm quite surprised to see that liboqs isn't needed for this, as I have tried and failed to make pq work without liboqs, and as the wolfSSL manual states:
Note: These experimental algorithms are not enabled and completely inaccessible if wolfSSL is not configured with the --with-liboqs flag.
(Found here: https://www.wolfssl.com/documentation/m … dix07.html)
So I've added these configs in my user_settings.h:
#define WOLFSSL_EXPERIMENTAL_SETTINGS
#define HAVE_LIBOQS
#define HAVE_DILITHIUM
#define WOLFSSL_WC_DILITHIUM
#define HAVE_FALCON
But if I define HAVE_LIBOQS, then I get a build error saying that it couldn't find "oqs.h", which I imagine would be the header files of liboqs. However, after reading your reply here, I tried commenting out that definition, and it seems it wasn't really needed? At least for dilithium, that is. For falcon, if HAVE_LIBOQS isn't defined, then a lot of specific falcon macros aren't found (as per falcon.h file) and the project doesn't compile, so I had to comment out the HAVE_FALCON definition too.
Dilithium didn't gave me any compilation problems however, and I was able to run a small test program that was using it. I couldn't get past the wc_dilithium_init() function, though. The function does work, but after that, when the program tries to execute the wc_dilithium_make_key() function (with valid arguments of course), I get a -192 error, whose description says "Bad ecc enc state operation". What exactly does that mean? Could you help me clarify some of those things?
This is my code; it's very simple, and the only one that is being run, so I don't see why would some state be invalid here:
WC_RNG* rng = (WC_RNG*)malloc(sizeof(WC_RNG));
int ret = wc_InitRng(rng);
check_return(ret, 0, "wc_InitRng"); // just a logging function
dilithium_key* key = (dilithium_key*)malloc(sizeof(dilithium_key));
ret = wc_dilithium_init(key);
check_return(ret, 0, "wc_dilithium_init");
ret = wc_dilithium_make_key(key, rng);
check_return(ret, 0, "wc_dilithium_make_key");
I know this is a lot, but I'd really appreciate some help with this, as I can't find anything similar to my problem on the internet, and AI isn't being of much help, either. So thank you very much for your patience and your time!