2013-04-26 01:37:15 -04:00
|
|
|
|
|
|
|
#define TEST_NAME "sodium_core"
|
|
|
|
#include "cmptest.h"
|
|
|
|
|
2017-07-16 19:00:00 -04:00
|
|
|
static void
|
2017-07-18 18:57:19 -04:00
|
|
|
misuse_handler(void)
|
2017-07-16 19:00:00 -04:00
|
|
|
{
|
2017-07-18 18:57:19 -04:00
|
|
|
printf("misuse_handler()\n");
|
2017-07-16 19:00:00 -04:00
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
2017-02-23 05:24:48 -05:00
|
|
|
int
|
|
|
|
main(void)
|
2013-04-26 01:37:15 -04:00
|
|
|
{
|
2017-07-16 19:00:00 -04:00
|
|
|
sodium_set_misuse_handler(NULL);
|
|
|
|
sodium_set_misuse_handler(misuse_handler);
|
|
|
|
sodium_set_misuse_handler(NULL);
|
|
|
|
|
2017-07-18 18:57:19 -04:00
|
|
|
assert(sodium_init() == 1);
|
2013-04-26 01:37:15 -04:00
|
|
|
|
2017-02-23 05:24:48 -05:00
|
|
|
(void) sodium_runtime_has_neon();
|
|
|
|
(void) sodium_runtime_has_sse2();
|
|
|
|
(void) sodium_runtime_has_sse3();
|
|
|
|
(void) sodium_runtime_has_ssse3();
|
|
|
|
(void) sodium_runtime_has_sse41();
|
2017-09-13 18:05:37 -04:00
|
|
|
(void) sodium_runtime_has_avx();
|
|
|
|
(void) sodium_runtime_has_avx2();
|
|
|
|
(void) sodium_runtime_has_avx512f();
|
2017-02-23 05:24:48 -05:00
|
|
|
(void) sodium_runtime_has_pclmul();
|
|
|
|
(void) sodium_runtime_has_aesni();
|
2017-11-25 11:53:33 -05:00
|
|
|
(void) sodium_runtime_has_rdrand();
|
2014-09-13 17:47:29 -04:00
|
|
|
|
2017-07-16 19:00:00 -04:00
|
|
|
sodium_set_misuse_handler(misuse_handler);
|
2017-07-30 12:22:53 -04:00
|
|
|
#ifndef __EMSCRIPTEN__
|
2017-07-18 18:57:19 -04:00
|
|
|
sodium_misuse();
|
2017-07-16 19:00:00 -04:00
|
|
|
printf("Misuse handler returned\n");
|
2017-07-30 12:22:53 -04:00
|
|
|
#else
|
|
|
|
printf("misuse_handler()\n");
|
2017-07-30 12:10:00 -04:00
|
|
|
#endif
|
2017-07-16 19:00:00 -04:00
|
|
|
|
2014-09-13 17:47:29 -04:00
|
|
|
return 0;
|
2013-04-26 01:37:15 -04:00
|
|
|
}
|