skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

commit 8ed4778c0eb0515d2b45a5add017bb96106ee543
parent c4e81d83b248aa356849fc6a31920c177b5df999
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Wed,  8 Jun 2022 17:33:25 +0000

 Export random_devurandom, fix APIs

Signed-off-by: Laurent Bercot <ska@appnovation.com>

Diffstat:
Mpackage/deps.mak | 4++--
Msrc/include/skalibs/blake2s.h | 6+++---
Msrc/include/skalibs/random.h | 2++
Dsrc/librandom/random-internal.h | 10----------
Msrc/librandom/random_buf.c | 2+-
Msrc/librandom/random_buf_early.c | 2+-
6 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/package/deps.mak b/package/deps.mak @@ -169,8 +169,8 @@ src/libposixplz/strnlen.o src/libposixplz/strnlen.lo: src/libposixplz/strnlen.c src/libposixplz/touch.o src/libposixplz/touch.lo: src/libposixplz/touch.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/posixplz.h src/include/skalibs/sysdeps.h src/libposixplz/unlink_void.o src/libposixplz/unlink_void.lo: src/libposixplz/unlink_void.c src/include/skalibs/posixplz.h src/librandom/autosurf.o src/librandom/autosurf.lo: src/librandom/autosurf.c src/include/skalibs/random.h src/include/skalibs/sha1.h src/include/skalibs/surf.h src/include/skalibs/tai.h src/include/skalibs/uint32.h -src/librandom/random_buf.o src/librandom/random_buf.lo: src/librandom/random_buf.c src/include/skalibs/nonposix.h src/librandom/random-internal.h src/include/skalibs/random.h src/include/skalibs/surf.h src/include/skalibs/sysdeps.h -src/librandom/random_buf_early.o src/librandom/random_buf_early.lo: src/librandom/random_buf_early.c src/include/skalibs/nonposix.h src/librandom/random-internal.h src/include/skalibs/random.h src/include/skalibs/surf.h src/include/skalibs/sysdeps.h +src/librandom/random_buf.o src/librandom/random_buf.lo: src/librandom/random_buf.c src/include/skalibs/nonposix.h src/include/skalibs/random.h src/include/skalibs/surf.h src/include/skalibs/sysdeps.h +src/librandom/random_buf_early.o src/librandom/random_buf_early.lo: src/librandom/random_buf_early.c src/include/skalibs/nonposix.h src/include/skalibs/random.h src/include/skalibs/surf.h src/include/skalibs/sysdeps.h src/librandom/random_devurandom.o src/librandom/random_devurandom.lo: src/librandom/random_devurandom.c src/include/skalibs/allreadwrite.h src/include/skalibs/djbunix.h src/include/skalibs/random.h src/include/skalibs/strerr2.h src/librandom/random_name_from.o src/librandom/random_name_from.lo: src/librandom/random_name_from.c src/include/skalibs/functypes.h src/include/skalibs/random.h src/librandom/random_sauniquename_from.o src/librandom/random_sauniquename_from.lo: src/librandom/random_sauniquename_from.c src/include/skalibs/random.h src/include/skalibs/skamisc.h src/include/skalibs/stralloc.h diff --git a/src/include/skalibs/blake2s.h b/src/include/skalibs/blake2s.h @@ -17,10 +17,10 @@ struct blake2s_ctx_s char buf[64] ; } ; -#define BLAKE2S_INIT(outlen) { \ +#define BLAKE2S_INIT(len) { \ .buflen = 0, \ - .outlen = outlen, \ - .h = { 0x6A09E667UL ^ (0x01010000 | outlen), 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL, 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL }, \ + .outlen = len, \ + .h = { 0x6A09E667UL ^ (0x01010000 | len), 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL, 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL }, \ .t = { 0, 0 }, \ .f = { 0, 0 }, \ .buf = { 0 } } diff --git a/src/include/skalibs/random.h b/src/include/skalibs/random.h @@ -9,6 +9,8 @@ #include <skalibs/functypes.h> #include <skalibs/stralloc.h> +extern void random_devurandom (char *, size_t) ; + extern void random_buf (char *, size_t) ; extern void random_buf_early (char *, size_t) ; diff --git a/src/librandom/random-internal.h b/src/librandom/random-internal.h @@ -1,10 +0,0 @@ -/* ISC license. */ - -#ifndef SKALIBS_RANDOM_INTERNAL_H -#define SKALIBS_RANDOM_INTERNAL_H - -#include <stddef.h> - -extern void random_devurandom (char *, size_t) ; - -#endif diff --git a/src/librandom/random_buf.c b/src/librandom/random_buf.c @@ -35,7 +35,7 @@ void random_buf (char *s, size_t n) #elif defined(SKALIBS_HASDEVURANDOM) -#include "random-internal.h" +#include <skalibs/random.h> void random_buf (char *s, size_t n) { diff --git a/src/librandom/random_buf_early.c b/src/librandom/random_buf_early.c @@ -34,7 +34,7 @@ void random_buf_early (char *s, size_t n) #elif defined(SKALIBS_HASDEVURANDOM) -#include "random-internal.h" +#include <skalibs/random.h> void random_buf_early (char *s, size_t n) {