nfc-tools / mfoc-hardnested

A fork of mfoc integrating hardnested code from the proxmark
GNU General Public License v2.0
191 stars 31 forks source link

Makes it compile on NetBSD (no memalign there) #14

Closed 0xDRRB closed 1 year ago

0xDRRB commented 2 years ago

This makes compiling possible on NetBSD and potentially also on FreeBSD, OpenBSD, AIX, etc.

LudovicRousseau commented 2 years ago

Maybe it would be simpler to use something like:

#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif

With a test for malloc.h in configure.ac

And something like

#if defined (_WIN32)
#define malloc_bitslice(x) __builtin_assume_aligned(_aligned_malloc((x), MAX_BITSLICES/8), MAX_BITSLICES/8)
#define free_bitslice(x) _aligned_free(x)
#elif ! defined (HAVE_MEMALIGN)
[...]

With a test for memalign() in configure.ac.

vk496 commented 1 year ago

Hello and thank you!

I would like to have a github workflow for building this automatically. If not, it could fail in the future and nobody would notice it. If you could please add it, I will merge it directly