#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <wolfssl/ssl.h>
#include <wolfssl/wolfcrypt/types.h>
#include <wolfssl/wolfcrypt/random.h>
#include <wolfssl/wolfcrypt/ecc.h>
#include <wolfssl/wolfcrypt/rsa.h>
int mian(int argc,char *arfv[]){
ecc_key key;
wc_ecc_init(&key);
WC_RNG rng;
wc_InitRng(&rng);
int ret =1;
ret = wc_ecc_make_key(&rng,32,&key);
printf("%d\n",ret);
}
enter image description here error: storage size of "key" is not known i have included ecc.h file,why is storage size of "key" not known?
Solution: Be sure to include the library configuration settings before any other wolfSSL header. wolfSSL can be configured with either:
<wolfssl/options.h>
(a file that is auto-generated when wolfSSL is built with the steps./configure && make
)<wolfssl/wolfcrypt/settings.h>
and users can defineWOLFSSL_USER_SETTINGS
globally to create their ownuser_settings.h
header to "tune" the build settings. Theuser_settings.h
header will get included by<wolfssl/wolfcrypt/settings.h>
anytimeWOLFSSL_USER_SETTINGS
is defined globally.Either way, the library configuration needs to be included before all other wolfSSL headers!
Similar Error reproduced (compiler versions may vary by message displayed, mine did not say the "storage size of 'key' is not known" but my output looks very similar to your screen-shot)
Fixed with this patch:
Now the app runs successfully! Cheers.