I'm not sure entirely sure why arc4random_buf needs to be forward
declared, but these changes are needed for macos builds to work.
Fixed build errors:
include/random.h:4:1: error: unknown type name 'ssize_t'; did you mean 'size_t'?
ssize_t get_random_bytes(unsigned char *buf, size_t nbytes);
^~~~~~~
src/random-arc4.c:7:2: error: implicit declaration of function 'arc4random_buf'
is invalid in C99 [-Werror,-Wimplicit-function-declaration]
arc4random_buf(buf, nbytes);
Signed-off-by: William Casarin <jb55@jb55.com>
I couldn't get my own, independent mkproof implementation to match
outputs. After some debugging, I discovered this is because mkproof
implicitly uses 0 for its Argon2 version number. As a result, mkproof's
actual KDF is something unique, slightly different from Argon2id.
Of course, challenges generated before this patch will be incompatible
with proofs created after this patch, so perhaps it's too late to
correct? On the other hand, most Argon2 libraries hardcode the version
number, so leaving it creates serious challenges for alternative
implementations.
I was mistaken about the issues with generating tokens in advance. The
main advantage is then just that argon2id is much better than sha1 for
this use-case.
mingw-w64 is able to work with old enough Microsoft C runtimes which
don't support %llx. However, all versions of mingw-w64 do have
inttypes.h, so use it (PRIx64 is shimmed for other platforms, since
inttypes.h is a C99 header).
In order to determine how to set up the ARGON2_PUBLIC and ARGON2_LOCAL
macros, we check for various different environments via preprocessor
defines. For Microsoft Visual Studio, we check that the macro _MSC_VER
evaluates to non-zero via `#elif _MSC_VER`. This may raise a compile
error when compiling with "-Werror=undef" if the variable isn't defined.
Fix the issue by using `#elif defined(_MSC_VER)` instead.
Some Linux distributions (e.g. NixOS, where this issue was spotted) don't provide an unprefixed ar when cross-compiling. This PR aims to fix this.
See[NixOS/nixpkgs#67490](https://github.com/NixOS/nixpkgs/pull/67490) for information on where did it start.
I've published an Android binding for Argon2 that makes it simple for Android developers to use Argon2. It emerged from a personal mobile app project. I've found that the existing Java bindings don't work too well with Android - especially with the now mandatory 64-bit support.
I hope adding to the listing will help other mobile developers.
make sure that lib or libdata are selected based on Kernel
and sed the template file to have correct paths
If kernel is Linux then default path for Ubuntu
For others add LIBRARY_REL=lib64 (or similar to make command)
Signed-off-by: Christopher Hall <hsw@bitmark.com>
On memory-constrained systems (like cgroups limited processes)
thread creation often fails.
The code needs to wait for already running threads on error path;
otherwise these threads can access deallocated memory
(and cause a segfault or another crash).
glibc 2.25+ has explicit_bzero(), so we can use it to securely wipe memory
instead of hacking our own memset-based replacement, just like we already
do on OpenBSD.