1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 20:45:17 -07:00
libsodium/test/default/sodium_core.c

44 lines
1.0 KiB
C
Raw Normal View History

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