Hello,
I was indeed not including the options.h and just set the flags I need myself. I deleted all of them and included the wolfssl/options.h instead but it did not make a difference.
I am working on Debian Linux:
$ uname -a
Linux dev 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07) x86_64 GNU/Linux
and I configured with the following flags:
./configure --enable-aesgcm --enable-aesccm --enable-mcapi --enable-fastmath --enable-sha512 --enable-ecc --with-libz
with generated the options.h attached to this post. It should be noted that I also wrote code for running AES with different modes of operation using fastmath without problems. In the future, this code is supposed to run on a board and I did cross compile the AES-tests with fastmath for it without problems, too.
After configuration I run make clean, make, sudo make install..
When I encountered this error in my code I tried to run a more simple example code taken but adjusted from the test.c.
#include <wolfssl/wolfcrypt/aes.h>
#include <wolfssl/wolfcrypt/dh.h>
#include <wolfssl/options.h>
void
simple_test()
{
size_t testVal = 23;
WC_RNG rng;
int ret;
ret = wc_InitRng(&rng);
DhKey smallKey;
byte p[2] = { 0, 5 };
byte g[2] = { 0, 2 };
byte priv[2];
word32 privSz = sizeof(priv);
byte pub[2];
word32 pubSz = sizeof(pub);
printf("testval is %zi\n", testVal);
wc_InitDhKey(&smallKey);
printf("testval is %zi\n", testVal);
ret = wc_DhSetKey(&smallKey, p, sizeof(p), g, sizeof(g));
if (ret != 0)
printf("Error");
ret = wc_DhGenerateKeyPair(&smallKey, &rng, priv, &privSz, pub, &pubSz);
wc_FreeDhKey(&smallKey);
if (ret != 0)
printf("Error");
wc_FreeRng(&rng);
wc_FreeDhKey(&smallKey);
}
int main(int argc, char** argv)
{
simple_test();
return 0;
}
I am using netbeans with its default generated Makefile. The compilation process looks like this
g++ -lwolfssl -c -g -std=c++11 -MMD -MP -MF "build/Debug/GNU-Linux/main.o.d" -o build/Debug/GNU-Linux/main.o main.cpp
g++ -lwolfssl -o dist/Debug/GNU-Linux/wolfssl_test build/Debug/GNU-Linux/main.o
And the output like this:
testval is 23
testval is 0
RUN FINISHED; Segmentation fault; real time: 10ms; user: 0ms; system: 0ms
I might have found something: Netbeans showed that there are 'unresolved includes' in wolfssl/wolfcrypt/dh.h leading to integer.h and to mpi_class.h, but I don't know what to do about it.
Hope that helps,
telina
Post's attachmentsoptions.h 1.89 kb, file has never been downloaded.
You don't have the permssions to download the attachments of this post.