From 2746b131aa482ac17c94bc6b82e58dbcc1b752cf Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 21 Jan 2017 15:46:20 +0000 Subject: Types fix: librandom, libstdcrypto --- package/deps.mak | 70 +++++++++---------- src/include/skalibs/md5.h | 11 +-- src/include/skalibs/random.h | 13 ++-- src/include/skalibs/rc4.h | 4 +- src/include/skalibs/sha1.h | 13 ++-- src/include/skalibs/sha256.h | 13 ++-- src/include/skalibs/sha512.h | 3 +- src/include/skalibs/surf.h | 9 +-- src/librandom/random_makeseed.c | 3 +- src/librandom/random_name.c | 2 +- src/librandom/random_sauniquename.c | 5 +- src/librandom/random_string.c | 10 +-- src/librandom/random_uint32.c | 9 +-- src/librandom/random_unsort.c | 6 +- src/librandom/surf.c | 14 ++-- src/libstdcrypto/md5-internal.h | 4 +- src/libstdcrypto/md5_final.c | 5 +- src/libstdcrypto/md5_init.c | 8 +-- src/libstdcrypto/md5_transform.c | 134 ++++++++++++++++++------------------ src/libstdcrypto/md5_update.c | 8 ++- src/libstdcrypto/rc4.c | 5 +- src/libstdcrypto/rc4_init.c | 5 +- src/libstdcrypto/sha1-internal.h | 4 +- src/libstdcrypto/sha1_feed.c | 4 +- src/libstdcrypto/sha1_init.c | 10 +-- src/libstdcrypto/sha1_transform.c | 18 ++--- src/libstdcrypto/sha1_update.c | 5 +- src/libstdcrypto/sha256-internal.h | 4 +- src/libstdcrypto/sha256_feed.c | 4 +- src/libstdcrypto/sha256_final.c | 4 +- src/libstdcrypto/sha256_transform.c | 46 ++++++------- src/libstdcrypto/sha256_update.c | 5 +- src/libstdcrypto/sha512_transform.c | 2 +- src/libstdcrypto/sha512_update.c | 5 +- 34 files changed, 240 insertions(+), 225 deletions(-) diff --git a/package/deps.mak b/package/deps.mak index d128122..b6dd4c4 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -8,7 +8,7 @@ src/include/skalibs/allreadwrite.h: src/include/skalibs/functypes.h src/include/ src/include/skalibs/avlnode.h: src/include/skalibs/functypes.h src/include/skalibs/gccattributes.h src/include/skalibs/avltree.h: src/include/skalibs/avlnode.h src/include/skalibs/functypes.h src/include/skalibs/gensetdyn.h src/include/skalibs/avltreen.h: src/include/skalibs/avlnode.h src/include/skalibs/functypes.h src/include/skalibs/genset.h -src/include/skalibs/biguint.h: src/include/skalibs/gccattributes.h src/include/skalibs/uint32.h +src/include/skalibs/biguint.h: src/include/skalibs/gccattributes.h src/include/skalibs/bitarray.h: src/include/skalibs/gccattributes.h src/include/skalibs/bufalloc.h: src/include/skalibs/gccattributes.h src/include/skalibs/stralloc.h src/include/skalibs/buffer.h: src/include/skalibs/allreadwrite.h src/include/skalibs/bytestr.h src/include/skalibs/cbuffer.h src/include/skalibs/functypes.h src/include/skalibs/gccattributes.h src/include/skalibs/siovec.h @@ -31,12 +31,9 @@ src/include/skalibs/iobuffer.h: src/include/skalibs/buffer.h src/include/skalibs src/include/skalibs/iopause.h: src/include/skalibs/tai.h src/include/skalibs/kolbak.h: src/include/skalibs/unixmessage.h src/include/skalibs/lolstdio.h: src/include/skalibs/bufalloc.h src/include/skalibs/buffer.h src/include/skalibs/strerr2.h -src/include/skalibs/md5.h: src/include/skalibs/uint32.h src/include/skalibs/mininetstring.h: src/include/skalibs/stralloc.h src/include/skalibs/uint16.h src/include/skalibs/uint32.h src/include/skalibs/netstring.h: src/include/skalibs/buffer.h src/include/skalibs/siovec.h src/include/skalibs/stralloc.h -src/include/skalibs/random.h: src/include/skalibs/stralloc.h src/include/skalibs/uint32.h -src/include/skalibs/sha1.h: src/include/skalibs/uint32.h -src/include/skalibs/sha256.h: src/include/skalibs/uint32.h +src/include/skalibs/random.h: src/include/skalibs/stralloc.h src/include/skalibs/sha512.h: src/include/skalibs/uint64.h src/include/skalibs/sig.h: src/include/skalibs/gccattributes.h src/include/skalibs/siovec.h: src/include/skalibs/gccattributes.h @@ -49,7 +46,6 @@ src/include/skalibs/stddjb.h: src/include/skalibs/alarm.h src/include/skalibs/al src/include/skalibs/stralloc.h: src/include/skalibs/bytestr.h src/include/skalibs/siovec.h src/include/skalibs/strerr.h: src/include/skalibs/gccattributes.h src/include/skalibs/strerr2.h: src/include/skalibs/strerr.h -src/include/skalibs/surf.h: src/include/skalibs/uint32.h src/include/skalibs/tai.h: src/include/skalibs/gccattributes.h src/include/skalibs/uint32.h src/include/skalibs/uint64.h src/include/skalibs/unix-timed.h: src/include/skalibs/bufalloc.h src/include/skalibs/buffer.h src/include/skalibs/functypes.h src/include/skalibs/stralloc.h src/include/skalibs/tai.h src/include/skalibs/unix-transactional.h: src/include/skalibs/siovec.h src/include/skalibs/stralloc.h src/include/skalibs/uint64.h @@ -59,43 +55,43 @@ src/include/skalibs/unixonacid.h: src/include/skalibs/kolbak.h src/include/skali src/include/skalibs/webipc.h: src/include/skalibs/djbunix.h src/include/skalibs/tai.h src/libdatastruct/avlnode-internal.h: src/include/skalibs/avlnode.h src/librandom/random-internal.h: src/include/skalibs/surf.h -src/libstdcrypto/md5-internal.h: src/include/skalibs/md5.h src/include/skalibs/uint32.h -src/libstdcrypto/sha1-internal.h: src/include/skalibs/sha1.h src/include/skalibs/uint32.h -src/libstdcrypto/sha256-internal.h: src/include/skalibs/sha256.h src/include/skalibs/uint32.h +src/libstdcrypto/md5-internal.h: src/include/skalibs/md5.h +src/libstdcrypto/sha1-internal.h: src/include/skalibs/sha1.h +src/libstdcrypto/sha256-internal.h: src/include/skalibs/sha256.h src/libstdcrypto/sha512-internal.h: src/include/skalibs/sha512.h src/libstddjb/alloc-internal.h: src/include/skalibs/alloc.h src/include/skalibs/sysdeps.h src/libstddjb/djbtime-internal.h: src/include/skalibs/uint64.h src/libstddjb/fmtscan-internal.h: src/include/skalibs/bytestr.h src/include/skalibs/fmtscan.h src/libstddjb/selfpipe-internal.h: src/include/skalibs/sig.h src/include/skalibs/sysdeps.h src/libunixonacid/skaclient-internal.h: src/include/skalibs/kolbak.h src/include/skalibs/skaclient.h src/include/skalibs/unixmessage.h -src/libbiguint/bu_addc.o src/libbiguint/bu_addc.lo: src/libbiguint/bu_addc.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_addmod.o src/libbiguint/bu_addmod.lo: src/libbiguint/bu_addmod.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_cmp.o src/libbiguint/bu_cmp.lo: src/libbiguint/bu_cmp.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_copy.o src/libbiguint/bu_copy.lo: src/libbiguint/bu_copy.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_copy_internal.o src/libbiguint/bu_copy_internal.lo: src/libbiguint/bu_copy_internal.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_div.o src/libbiguint/bu_div.lo: src/libbiguint/bu_div.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_div_internal.o src/libbiguint/bu_div_internal.lo: src/libbiguint/bu_div_internal.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_divmod.o src/libbiguint/bu_divmod.lo: src/libbiguint/bu_divmod.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_divmod_internal.o src/libbiguint/bu_divmod_internal.lo: src/libbiguint/bu_divmod_internal.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h +src/libbiguint/bu_addc.o src/libbiguint/bu_addc.lo: src/libbiguint/bu_addc.c src/include/skalibs/biguint.h +src/libbiguint/bu_addmod.o src/libbiguint/bu_addmod.lo: src/libbiguint/bu_addmod.c src/include/skalibs/biguint.h +src/libbiguint/bu_cmp.o src/libbiguint/bu_cmp.lo: src/libbiguint/bu_cmp.c src/include/skalibs/biguint.h +src/libbiguint/bu_copy.o src/libbiguint/bu_copy.lo: src/libbiguint/bu_copy.c src/include/skalibs/biguint.h +src/libbiguint/bu_copy_internal.o src/libbiguint/bu_copy_internal.lo: src/libbiguint/bu_copy_internal.c src/include/skalibs/biguint.h +src/libbiguint/bu_div.o src/libbiguint/bu_div.lo: src/libbiguint/bu_div.c src/include/skalibs/biguint.h +src/libbiguint/bu_div_internal.o src/libbiguint/bu_div_internal.lo: src/libbiguint/bu_div_internal.c src/include/skalibs/biguint.h +src/libbiguint/bu_divmod.o src/libbiguint/bu_divmod.lo: src/libbiguint/bu_divmod.c src/include/skalibs/biguint.h +src/libbiguint/bu_divmod_internal.o src/libbiguint/bu_divmod_internal.lo: src/libbiguint/bu_divmod_internal.c src/include/skalibs/biguint.h src/libbiguint/bu_fmt.o src/libbiguint/bu_fmt.lo: src/libbiguint/bu_fmt.c src/include/skalibs/biguint.h src/include/skalibs/bytestr.h src/include/skalibs/uint32.h -src/libbiguint/bu_gcd.o src/libbiguint/bu_gcd.lo: src/libbiguint/bu_gcd.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_invmod.o src/libbiguint/bu_invmod.lo: src/libbiguint/bu_invmod.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_len.o src/libbiguint/bu_len.lo: src/libbiguint/bu_len.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_mod.o src/libbiguint/bu_mod.lo: src/libbiguint/bu_mod.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_mul.o src/libbiguint/bu_mul.lo: src/libbiguint/bu_mul.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h src/include/skalibs/uint64.h -src/libbiguint/bu_mulmod.o src/libbiguint/bu_mulmod.lo: src/libbiguint/bu_mulmod.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h +src/libbiguint/bu_gcd.o src/libbiguint/bu_gcd.lo: src/libbiguint/bu_gcd.c src/include/skalibs/biguint.h +src/libbiguint/bu_invmod.o src/libbiguint/bu_invmod.lo: src/libbiguint/bu_invmod.c src/include/skalibs/biguint.h +src/libbiguint/bu_len.o src/libbiguint/bu_len.lo: src/libbiguint/bu_len.c src/include/skalibs/biguint.h +src/libbiguint/bu_mod.o src/libbiguint/bu_mod.lo: src/libbiguint/bu_mod.c src/include/skalibs/biguint.h +src/libbiguint/bu_mul.o src/libbiguint/bu_mul.lo: src/libbiguint/bu_mul.c src/include/skalibs/biguint.h src/include/skalibs/uint64.h +src/libbiguint/bu_mulmod.o src/libbiguint/bu_mulmod.lo: src/libbiguint/bu_mulmod.c src/include/skalibs/biguint.h src/libbiguint/bu_pack.o src/libbiguint/bu_pack.lo: src/libbiguint/bu_pack.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h src/libbiguint/bu_pack_big.o src/libbiguint/bu_pack_big.lo: src/libbiguint/bu_pack_big.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_scan.o src/libbiguint/bu_scan.lo: src/libbiguint/bu_scan.c src/include/skalibs/biguint.h src/include/skalibs/bitarray.h src/include/skalibs/uint32.h +src/libbiguint/bu_scan.o src/libbiguint/bu_scan.lo: src/libbiguint/bu_scan.c src/include/skalibs/biguint.h src/include/skalibs/bitarray.h src/libbiguint/bu_scan_internal.o src/libbiguint/bu_scan_internal.lo: src/libbiguint/bu_scan_internal.c src/include/skalibs/biguint.h src/include/skalibs/bytestr.h src/include/skalibs/uint32.h src/libbiguint/bu_scanlen.o src/libbiguint/bu_scanlen.lo: src/libbiguint/bu_scanlen.c src/include/skalibs/biguint.h src/include/skalibs/fmtscan.h -src/libbiguint/bu_slbc.o src/libbiguint/bu_slbc.lo: src/libbiguint/bu_slbc.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_srbc.o src/libbiguint/bu_srbc.lo: src/libbiguint/bu_srbc.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_subc.o src/libbiguint/bu_subc.lo: src/libbiguint/bu_subc.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_submod.o src/libbiguint/bu_submod.lo: src/libbiguint/bu_submod.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h +src/libbiguint/bu_slbc.o src/libbiguint/bu_slbc.lo: src/libbiguint/bu_slbc.c src/include/skalibs/biguint.h +src/libbiguint/bu_srbc.o src/libbiguint/bu_srbc.lo: src/libbiguint/bu_srbc.c src/include/skalibs/biguint.h +src/libbiguint/bu_subc.o src/libbiguint/bu_subc.lo: src/libbiguint/bu_subc.c src/include/skalibs/biguint.h +src/libbiguint/bu_submod.o src/libbiguint/bu_submod.lo: src/libbiguint/bu_submod.c src/include/skalibs/biguint.h src/libbiguint/bu_unpack.o src/libbiguint/bu_unpack.lo: src/libbiguint/bu_unpack.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h src/libbiguint/bu_unpack_big.o src/libbiguint/bu_unpack_big.lo: src/libbiguint/bu_unpack_big.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h -src/libbiguint/bu_zero.o src/libbiguint/bu_zero.lo: src/libbiguint/bu_zero.c src/include/skalibs/biguint.h src/include/skalibs/uint32.h +src/libbiguint/bu_zero.o src/libbiguint/bu_zero.lo: src/libbiguint/bu_zero.c src/include/skalibs/biguint.h src/libdatastruct/avlnode_delete.o src/libdatastruct/avlnode_delete.lo: src/libdatastruct/avlnode_delete.c src/libdatastruct/avlnode-internal.h src/include/skalibs/avlnode.h src/include/skalibs/functypes.h src/libdatastruct/avlnode_doublerotate.o src/libdatastruct/avlnode_doublerotate.lo: src/libdatastruct/avlnode_doublerotate.c src/libdatastruct/avlnode-internal.h src/include/skalibs/avlnode.h src/libdatastruct/avlnode_extreme.o src/libdatastruct/avlnode_extreme.lo: src/libdatastruct/avlnode_extreme.c src/include/skalibs/avlnode.h @@ -137,24 +133,24 @@ src/librandom/random_name.o src/librandom/random_name.lo: src/librandom/random_n src/librandom/random_sauniquename.o src/librandom/random_sauniquename.lo: src/librandom/random_sauniquename.c src/include/skalibs/random.h src/include/skalibs/skamisc.h src/include/skalibs/stralloc.h src/librandom/random_string.o src/librandom/random_string.lo: src/librandom/random_string.c src/include/skalibs/allreadwrite.h src/include/skalibs/nonposix.h src/librandom/random-internal.h src/include/skalibs/random.h src/include/skalibs/sysdeps.h src/librandom/random_uint32.o src/librandom/random_uint32.lo: src/librandom/random_uint32.c src/include/skalibs/nonposix.h src/include/skalibs/random.h src/include/skalibs/sysdeps.h src/include/skalibs/uint32.h -src/librandom/random_unsort.o src/librandom/random_unsort.lo: src/librandom/random_unsort.c src/include/skalibs/bytestr.h src/include/skalibs/random.h src/include/skalibs/uint32.h +src/librandom/random_unsort.o src/librandom/random_unsort.lo: src/librandom/random_unsort.c src/include/skalibs/bytestr.h src/include/skalibs/random.h src/librandom/surf.o src/librandom/surf.lo: src/librandom/surf.c src/include/skalibs/bytestr.h src/include/skalibs/surf.h src/include/skalibs/uint32.h src/librandom/surf_init.o src/librandom/surf_init.lo: src/librandom/surf_init.c src/include/skalibs/surf.h src/include/skalibs/uint32.h src/libstdcrypto/md5_final.o src/libstdcrypto/md5_final.lo: src/libstdcrypto/md5_final.c src/include/skalibs/bytestr.h src/libstdcrypto/md5-internal.h src/include/skalibs/md5.h src/include/skalibs/uint32.h src/libstdcrypto/md5_init.o src/libstdcrypto/md5_init.lo: src/libstdcrypto/md5_init.c src/include/skalibs/md5.h -src/libstdcrypto/md5_transform.o src/libstdcrypto/md5_transform.lo: src/libstdcrypto/md5_transform.c src/libstdcrypto/md5-internal.h src/include/skalibs/uint32.h +src/libstdcrypto/md5_transform.o src/libstdcrypto/md5_transform.lo: src/libstdcrypto/md5_transform.c src/libstdcrypto/md5-internal.h src/libstdcrypto/md5_update.o src/libstdcrypto/md5_update.lo: src/libstdcrypto/md5_update.c src/include/skalibs/bytestr.h src/libstdcrypto/md5-internal.h src/include/skalibs/md5.h src/include/skalibs/uint32.h src/libstdcrypto/rc4.o src/libstdcrypto/rc4.lo: src/libstdcrypto/rc4.c src/include/skalibs/bytestr.h src/include/skalibs/rc4.h src/libstdcrypto/rc4_init.o src/libstdcrypto/rc4_init.lo: src/libstdcrypto/rc4_init.c src/include/skalibs/bytestr.h src/include/skalibs/rc4.h -src/libstdcrypto/sha1_feed.o src/libstdcrypto/sha1_feed.lo: src/libstdcrypto/sha1_feed.c src/include/skalibs/bytestr.h src/libstdcrypto/sha1-internal.h src/include/skalibs/sha1.h src/include/skalibs/uint32.h +src/libstdcrypto/sha1_feed.o src/libstdcrypto/sha1_feed.lo: src/libstdcrypto/sha1_feed.c src/include/skalibs/bytestr.h src/libstdcrypto/sha1-internal.h src/include/skalibs/sha1.h src/libstdcrypto/sha1_final.o src/libstdcrypto/sha1_final.lo: src/libstdcrypto/sha1_final.c src/libstdcrypto/sha1-internal.h src/include/skalibs/sha1.h src/include/skalibs/uint32.h src/libstdcrypto/sha1_init.o src/libstdcrypto/sha1_init.lo: src/libstdcrypto/sha1_init.c src/include/skalibs/sha1.h -src/libstdcrypto/sha1_transform.o src/libstdcrypto/sha1_transform.lo: src/libstdcrypto/sha1_transform.c src/libstdcrypto/sha1-internal.h src/include/skalibs/uint32.h +src/libstdcrypto/sha1_transform.o src/libstdcrypto/sha1_transform.lo: src/libstdcrypto/sha1_transform.c src/libstdcrypto/sha1-internal.h src/libstdcrypto/sha1_update.o src/libstdcrypto/sha1_update.lo: src/libstdcrypto/sha1_update.c src/libstdcrypto/sha1-internal.h src/include/skalibs/sha1.h -src/libstdcrypto/sha256_feed.o src/libstdcrypto/sha256_feed.lo: src/libstdcrypto/sha256_feed.c src/include/skalibs/bytestr.h src/libstdcrypto/sha256-internal.h src/include/skalibs/sha256.h src/include/skalibs/uint32.h -src/libstdcrypto/sha256_final.o src/libstdcrypto/sha256_final.lo: src/libstdcrypto/sha256_final.c src/include/skalibs/bytestr.h src/libstdcrypto/sha256-internal.h src/include/skalibs/sha256.h src/include/skalibs/uint32.h +src/libstdcrypto/sha256_feed.o src/libstdcrypto/sha256_feed.lo: src/libstdcrypto/sha256_feed.c src/include/skalibs/bytestr.h src/libstdcrypto/sha256-internal.h src/include/skalibs/sha256.h +src/libstdcrypto/sha256_final.o src/libstdcrypto/sha256_final.lo: src/libstdcrypto/sha256_final.c src/include/skalibs/bytestr.h src/libstdcrypto/sha256-internal.h src/include/skalibs/sha256.h src/libstdcrypto/sha256_init.o src/libstdcrypto/sha256_init.lo: src/libstdcrypto/sha256_init.c src/include/skalibs/sha256.h -src/libstdcrypto/sha256_transform.o src/libstdcrypto/sha256_transform.lo: src/libstdcrypto/sha256_transform.c src/libstdcrypto/sha256-internal.h src/include/skalibs/uint32.h +src/libstdcrypto/sha256_transform.o src/libstdcrypto/sha256_transform.lo: src/libstdcrypto/sha256_transform.c src/libstdcrypto/sha256-internal.h src/libstdcrypto/sha256_update.o src/libstdcrypto/sha256_update.lo: src/libstdcrypto/sha256_update.c src/libstdcrypto/sha256-internal.h src/include/skalibs/sha256.h src/libstdcrypto/sha512_final.o src/libstdcrypto/sha512_final.lo: src/libstdcrypto/sha512_final.c src/include/skalibs/bytestr.h src/libstdcrypto/sha512-internal.h src/include/skalibs/sha512.h src/include/skalibs/uint64.h src/libstdcrypto/sha512_init.o src/libstdcrypto/sha512_init.lo: src/libstdcrypto/sha512_init.c src/include/skalibs/sha512.h diff --git a/src/include/skalibs/md5.h b/src/include/skalibs/md5.h index c5d61a8..5e31b1f 100644 --- a/src/include/skalibs/md5.h +++ b/src/include/skalibs/md5.h @@ -3,19 +3,20 @@ #ifndef MD5_H #define MD5_H -#include +#include +#include typedef struct MD5Schedule MD5Schedule, *MD5Schedule_ref ; struct MD5Schedule { - uint32 buf[4] ; - uint32 bits[2] ; + uint32_t buf[4] ; + uint32_t bits[2] ; unsigned char in[64] ; } ; -#define MD5_INIT() { .buf = { 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL }, .bits = { 0, 0 }, .in = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" } +#define MD5_INIT() { .buf = { 0x67452301U, 0xefcdab89U, 0x98badcfeU, 0x10325476U }, .bits = { 0, 0 }, .in = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" } extern void md5_init (MD5Schedule *) ; -extern void md5_update (MD5Schedule *, char const *, unsigned int) ; +extern void md5_update (MD5Schedule *, char const *, size_t) ; extern void md5_final (MD5Schedule *, char * /* 16 chars */) ; #endif diff --git a/src/include/skalibs/random.h b/src/include/skalibs/random.h index 893b50f..254a1c0 100644 --- a/src/include/skalibs/random.h +++ b/src/include/skalibs/random.h @@ -3,7 +3,8 @@ #ifndef RANDOM_H #define RANDOM_H -#include +#include +#include #include extern void random_makeseed (char *) ; /* fills 160 bytes */ @@ -12,10 +13,10 @@ extern int random_init (void) ; extern void random_finish (void) ; extern unsigned char random_char (void) ; -extern void random_string (char *, unsigned int) ; -extern uint32 random_uint32 (uint32) ; -extern void random_name (char *, unsigned int) ; -extern void random_unsort (char *, unsigned int, unsigned int) ; -extern int random_sauniquename (stralloc *, unsigned int) ; +extern void random_string (char *, size_t) ; +extern uint32_t random_uint32 (uint32_t) ; +extern void random_name (char *, size_t) ; +extern void random_unsort (char *, size_t, size_t) ; +extern int random_sauniquename (stralloc *, size_t) ; #endif diff --git a/src/include/skalibs/rc4.h b/src/include/skalibs/rc4.h index 6bb8062..44ce20b 100644 --- a/src/include/skalibs/rc4.h +++ b/src/include/skalibs/rc4.h @@ -13,7 +13,7 @@ struct RC4Schedule unsigned char x, y ; } ; -extern void rc4_init (RC4Schedule *, char const *, unsigned int) ; -extern void rc4 (RC4Schedule *, char const *, char *, unsigned int) ; +extern void rc4_init (RC4Schedule *, char const *, size_t) ; +extern void rc4 (RC4Schedule *, char const *, char *, size_t) ; #endif diff --git a/src/include/skalibs/sha1.h b/src/include/skalibs/sha1.h index be252ba..2d41275 100644 --- a/src/include/skalibs/sha1.h +++ b/src/include/skalibs/sha1.h @@ -3,20 +3,21 @@ #ifndef SHA1_H #define SHA1_H -#include +#include +#include typedef struct SHA1Schedule SHA1Schedule, *SHA1Schedule_ref ; struct SHA1Schedule { - uint32 buf[5] ; - uint32 bits[2] ; - uint32 in[16] ; + uint32_t buf[5] ; + uint32_t bits[2] ; + uint32_t in[16] ; unsigned int b ; } ; -#define SHA1_INIT() { .buf = { 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL, 0xc3d2e1f0UL }, .bits = { 0, 0 }, .in = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, .b = 0 } +#define SHA1_INIT() { .buf = { 0x67452301U, 0xefcdab89U, 0x98badcfeU, 0x10325476U, 0xc3d2e1f0U }, .bits = { 0, 0 }, .in = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, .b = 0 } extern void sha1_init (SHA1Schedule *) ; -extern void sha1_update (SHA1Schedule *, char const *, unsigned int) ; +extern void sha1_update (SHA1Schedule *, char const *, size_t) ; extern void sha1_final (SHA1Schedule *, char * /* 20 chars */) ; #endif diff --git a/src/include/skalibs/sha256.h b/src/include/skalibs/sha256.h index 3675211..8ef7d0b 100644 --- a/src/include/skalibs/sha256.h +++ b/src/include/skalibs/sha256.h @@ -10,20 +10,21 @@ #ifndef SHA256_H #define SHA256_H -#include +#include +#include typedef struct SHA256Schedule_s SHA256Schedule, *SHA256Schedule_ref ; struct SHA256Schedule_s { - uint32 buf[8] ; /* The eight chaining variables */ - uint32 bits[2] ; /* Count number of message bits */ - uint32 in[16] ; /* Data being fed in */ + uint32_t buf[8] ; /* The eight chaining variables */ + uint32_t bits[2] ; /* Count number of message bits */ + uint32_t in[16] ; /* Data being fed in */ unsigned int b ; /* Our position within the 512 bits (always between 0 and 63) */ } ; -#define SHA256_INIT() { .buf = { 0x6a09e667UL, 0xbb67ae85UL, 0x3c6ef372UL, 0xa54ff53aUL, 0x510e527fUL, 0x9b05688cUL, 0x1f83d9abUL, 0x5be0cd19UL }, .bits = { 0, 0 }, .in = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, .b = 0 } +#define SHA256_INIT() { .buf = { 0x6a09e667U, 0xbb67ae85U, 0x3c6ef372U, 0xa54ff53aU, 0x510e527fU, 0x9b05688cU, 0x1f83d9abU, 0x5be0cd19U }, .bits = { 0, 0 }, .in = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, .b = 0 } extern void sha256_init (SHA256Schedule *) ; -extern void sha256_update (SHA256Schedule *, char const *, unsigned int) ; +extern void sha256_update (SHA256Schedule *, char const *, size_t) ; extern void sha256_final (SHA256Schedule *, char *digest) ; #endif diff --git a/src/include/skalibs/sha512.h b/src/include/skalibs/sha512.h index eddb4ed..9d098be 100644 --- a/src/include/skalibs/sha512.h +++ b/src/include/skalibs/sha512.h @@ -3,6 +3,7 @@ #ifndef SHA512_H #define SHA512_H +#include #include typedef struct SHA512Schedule_s SHA512Schedule, *SHA512Schedule_ref ; @@ -15,7 +16,7 @@ struct SHA512Schedule_s #define SHA512_INIT() { .len = 0, .h = { 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL } } extern void sha512_init (SHA512Schedule *) ; -extern void sha512_update (SHA512Schedule *, char const *, unsigned int) ; +extern void sha512_update (SHA512Schedule *, char const *, size_t) ; extern void sha512_final (SHA512Schedule *, char *digest) ; #endif diff --git a/src/include/skalibs/surf.h b/src/include/skalibs/surf.h index aae21e8..99408ca 100644 --- a/src/include/skalibs/surf.h +++ b/src/include/skalibs/surf.h @@ -3,13 +3,14 @@ #ifndef SKALIBS_SURF_H #define SKALIBS_SURF_H -#include +#include +#include typedef struct SURFSchedule SURFSchedule, *SURFSchedule_ref, **SURFSchedule_ref_ref ; struct SURFSchedule { - uint32 seed[32] ; - uint32 in[12] ; + uint32_t seed[32] ; + uint32_t in[12] ; char out[32] ; unsigned int pos ; } ; @@ -17,6 +18,6 @@ struct SURFSchedule #define SURFSCHEDULE_ZERO { .seed = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, .in = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, .out = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", .pos = 32 } extern void surf_init (SURFSchedule *, char const *) ; /* 160 chars */ -extern void surf (SURFSchedule *, char *, unsigned int) ; +extern void surf (SURFSchedule *, char *, size_t) ; #endif diff --git a/src/librandom/random_makeseed.c b/src/librandom/random_makeseed.c index 909e896..00def5b 100644 --- a/src/librandom/random_makeseed.c +++ b/src/librandom/random_makeseed.c @@ -1,6 +1,7 @@ /* ISC license. */ #include +#include #include #include #include @@ -19,7 +20,7 @@ void random_makeseed (char *s) { tain_t now ; char tmp[256] ; - uint32 x = getpid() ; + uint32_t x = getpid() ; uint32_pack(tmp, x) ; x = getppid() ; uint32_pack(tmp + 4, x) ; diff --git a/src/librandom/random_name.c b/src/librandom/random_name.c index 83b1626..f972e93 100644 --- a/src/librandom/random_name.c +++ b/src/librandom/random_name.c @@ -4,7 +4,7 @@ #include -void random_name (char *s, unsigned int n) +void random_name (char *s, size_t n) { static char const oklist[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZghijklmnopqrstuvwxyz-_0123456789abcdef" ; random_string(s, n) ; diff --git a/src/librandom/random_sauniquename.c b/src/librandom/random_sauniquename.c index 6d200aa..e63e46c 100644 --- a/src/librandom/random_sauniquename.c +++ b/src/librandom/random_sauniquename.c @@ -2,13 +2,14 @@ /* MT-unsafe */ +#include #include #include #include -int random_sauniquename (stralloc *sa, unsigned int n) +int random_sauniquename (stralloc *sa, size_t n) { - unsigned int base = sa->len ; + size_t base = sa->len ; int wasnull = !sa->s ; if (!sauniquename(sa)) return 0 ; if (!stralloc_readyplus(sa, n+1)) goto err ; diff --git a/src/librandom/random_string.c b/src/librandom/random_string.c index 6ccd865..5053824 100644 --- a/src/librandom/random_string.c +++ b/src/librandom/random_string.c @@ -8,7 +8,7 @@ #include #include -void random_string (char *s, unsigned int n) +void random_string (char *s, size_t n) { arc4random_buf(s, n) ; } @@ -27,7 +27,7 @@ static int getrandom (void *buf, size_t buflen, unsigned int flags) return syscall(SYS_getrandom, buf, buflen, flags) ; } -void random_string (char *s, unsigned int n) +void random_string (char *s, size_t n) { while (n) { @@ -47,9 +47,9 @@ void random_string (char *s, unsigned int n) #include #include "random-internal.h" -void random_string (char *s, unsigned int n) +void random_string (char *s, size_t n) { - unsigned int r = allread(random_fd, s, n) ; + size_t r = allread(random_fd, s, n) ; if (r < n) surf(&surf_here, s+r, n-r) ; } @@ -58,7 +58,7 @@ void random_string (char *s, unsigned int n) #include #include "random-internal.h" -void random_string (char *s, unsigned int n) +void random_string (char *s, size_t n) { surf(&surf_here, s, n) ; } diff --git a/src/librandom/random_uint32.c b/src/librandom/random_uint32.c index 9009a59..a2144f1 100644 --- a/src/librandom/random_uint32.c +++ b/src/librandom/random_uint32.c @@ -5,23 +5,24 @@ #ifdef SKALIBS_HASARC4RANDOM #include +#include #include -#include #include -uint32 random_uint32 (uint32 n) +uint32_t random_uint32 (uint32_t n) { return arc4random_uniform(n) ; } #else +#include #include #include -uint32 random_uint32 (uint32 n) +uint32_t random_uint32 (uint32_t n) { - uint32 min, x ; + uint32_t min, x ; if (n < 2) return 0 ; min = -n % n ; for (;;) diff --git a/src/librandom/random_unsort.c b/src/librandom/random_unsort.c index 22c4e08..98a4b09 100644 --- a/src/librandom/random_unsort.c +++ b/src/librandom/random_unsort.c @@ -1,15 +1,15 @@ /* ISC license. */ -#include +#include #include #include -void random_unsort (char *s, unsigned int n, unsigned int chunksize) +void random_unsort (char *s, size_t n, size_t chunksize) { char tmp[chunksize] ; while (n--) { - register uint32 i = random_uint32(n+1) ; + register uint32_t i = random_uint32(n+1) ; byte_copy(tmp, chunksize, s + i * chunksize) ; byte_copy(s + i * chunksize, chunksize, s + n * chunksize) ; byte_copy(s + n * chunksize, chunksize, tmp) ; diff --git a/src/librandom/surf.c b/src/librandom/surf.c index ad0aab1..fe5346e 100644 --- a/src/librandom/surf.c +++ b/src/librandom/surf.c @@ -1,5 +1,7 @@ /* ISC license. */ +#include +#include #include #include #include @@ -9,10 +11,10 @@ static void surfit (SURFSchedule *ctx) { - uint32 t[12] ; - uint32 z[8] ; - uint32 x ; - uint32 sum = 0 ; + uint32_t t[12] ; + uint32_t z[8] ; + uint32_t x ; + uint32_t sum = 0 ; unsigned int i = 0, loop = 0 ; ; if (!++ctx->in[0] && !++ctx->in[1] && !++ctx->in[2]) ++ctx->in[3] ; @@ -33,10 +35,10 @@ static void surfit (SURFSchedule *ctx) for (i = 0 ; i < 8 ; i++) uint32_pack(ctx->out + (i<<2), z[i]) ; } -void surf (SURFSchedule *ctx, char *s, unsigned int n) +void surf (SURFSchedule *ctx, char *s, size_t n) { { - register unsigned int i = 32 - ctx->pos ; + register size_t i = 32 - ctx->pos ; if (n < i) i = n ; byte_copy(s, i, ctx->out + ctx->pos) ; s += i ; n -= i ; ctx->pos += i ; diff --git a/src/libstdcrypto/md5-internal.h b/src/libstdcrypto/md5-internal.h index 374528a..59ffeea 100644 --- a/src/libstdcrypto/md5-internal.h +++ b/src/libstdcrypto/md5-internal.h @@ -3,9 +3,9 @@ #ifndef MD5_INTERNAL_H #define MD5_INTERNAL_H -#include +#include #include -extern void md5_transform (uint32 * /* 4 uint32s */, uint32 const * /* 16 uint32s */) ; +extern void md5_transform (uint32_t * /* 4 uint32s */, uint32_t const * /* 16 uint32s */) ; #endif diff --git a/src/libstdcrypto/md5_final.c b/src/libstdcrypto/md5_final.c index 1512ebc..1ecdedf 100644 --- a/src/libstdcrypto/md5_final.c +++ b/src/libstdcrypto/md5_final.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include #include @@ -15,7 +16,7 @@ void md5_final (MD5Schedule *ctx, char *digest /* 16 chars */) { byte_zero(p, count) ; uint32_little_endian((char *)ctx->in, 16) ; - md5_transform(ctx->buf, (uint32 *)ctx->in) ; + md5_transform(ctx->buf, (uint32_t *)ctx->in) ; byte_zero(ctx->in, 56) ; } else byte_zero(p, count - 8) ; @@ -24,7 +25,7 @@ void md5_final (MD5Schedule *ctx, char *digest /* 16 chars */) byte_copy((char *)ctx->in + 56, 4, (char *)&ctx->bits[0]) ; byte_copy((char *)ctx->in + 60, 4, (char *)&ctx->bits[1]) ; - md5_transform(ctx->buf, (uint32 *)ctx->in) ; + md5_transform(ctx->buf, (uint32_t *)ctx->in) ; uint32_little_endian((char *)ctx->buf, 4) ; byte_copy(digest, 16, (char *)ctx->buf) ; } diff --git a/src/libstdcrypto/md5_init.c b/src/libstdcrypto/md5_init.c index 56c85de..eac96b0 100644 --- a/src/libstdcrypto/md5_init.c +++ b/src/libstdcrypto/md5_init.c @@ -4,10 +4,10 @@ void md5_init (MD5Schedule *ctx) { - ctx->buf[0] = 0x67452301UL ; - ctx->buf[1] = 0xefcdab89UL ; - ctx->buf[2] = 0x98badcfeUL ; - ctx->buf[3] = 0x10325476UL ; + ctx->buf[0] = 0x67452301U ; + ctx->buf[1] = 0xefcdab89U ; + ctx->buf[2] = 0x98badcfeU ; + ctx->buf[3] = 0x10325476U ; ctx->bits[0] = 0 ; ctx->bits[1] = 0 ; } diff --git a/src/libstdcrypto/md5_transform.c b/src/libstdcrypto/md5_transform.c index 2449b58..0e65671 100644 --- a/src/libstdcrypto/md5_transform.c +++ b/src/libstdcrypto/md5_transform.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include +#include #include "md5-internal.h" /* #define F1(x, y, z) (x & y | ~x & z) */ @@ -12,77 +12,77 @@ #define MD5STEP(f, w, x, y, z, data, s) \ ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) -void md5_transform (uint32 *buf /* 4 uint32s */, uint32 const *in /* 16 uint32s */) +void md5_transform (uint32_t *buf /* 4 uint32s */, uint32_t const *in /* 16 uint32s */) { - register uint32 a = buf[0], b = buf[1], c = buf[2], d = buf[3] ; + register uint32_t a = buf[0], b = buf[1], c = buf[2], d = buf[3] ; - MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7) ; - MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12) ; - MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17) ; - MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22) ; - MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7) ; - MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12) ; - MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17) ; - MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22) ; - MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7) ; - MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12) ; - MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17) ; - MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22) ; - MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7) ; - MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12) ; - MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17) ; - MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22) ; + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478U, 7) ; + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756U, 12) ; + MD5STEP(F1, c, d, a, b, in[2] + 0x242070dbU, 17) ; + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceeeU, 22) ; + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0fafU, 7) ; + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62aU, 12) ; + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613U, 17) ; + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501U, 22) ; + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8U, 7) ; + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7afU, 12) ; + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1U, 17) ; + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7beU, 22) ; + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122U, 7) ; + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193U, 12) ; + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438eU, 17) ; + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821U, 22) ; - MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5) ; - MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9) ; - MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14) ; - MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20) ; - MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5) ; - MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9) ; - MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14) ; - MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20) ; - MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5) ; - MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9) ; - MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14) ; - MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20) ; - MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5) ; - MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9) ; - MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14) ; - MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20) ; + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562U, 5) ; + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340U, 9) ; + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51U, 14) ; + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aaU, 20) ; + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105dU, 5) ; + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453U, 9) ; + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681U, 14) ; + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8U, 20) ; + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6U, 5) ; + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6U, 9) ; + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87U, 14) ; + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14edU, 20) ; + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905U, 5) ; + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8U, 9) ; + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9U, 14) ; + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8aU, 20) ; - MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4) ; - MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11) ; - MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16) ; - MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23) ; - MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4) ; - MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11) ; - MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16) ; - MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23) ; - MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4) ; - MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11) ; - MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16) ; - MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23) ; - MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4) ; - MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11) ; - MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16) ; - MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23) ; + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942U, 4) ; + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681U, 11) ; + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122U, 16) ; + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380cU, 23) ; + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44U, 4) ; + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9U, 11) ; + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60U, 16) ; + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70U, 23) ; + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6U, 4) ; + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127faU, 11) ; + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085U, 16) ; + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05U, 23) ; + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039U, 4) ; + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5U, 11) ; + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8U, 16) ; + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665U, 23) ; - MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6) ; - MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10) ; - MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15) ; - MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21) ; - MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6) ; - MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10) ; - MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15) ; - MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21) ; - MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6) ; - MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10) ; - MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15) ; - MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21) ; - MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6) ; - MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10) ; - MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15) ; - MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21) ; + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244U, 6) ; + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97U, 10) ; + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7U, 15) ; + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039U, 21) ; + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3U, 6) ; + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92U, 10) ; + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47dU, 15) ; + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1U, 21) ; + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4fU, 6) ; + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0U, 10) ; + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314U, 15) ; + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1U, 21) ; + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82U, 6) ; + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235U, 10) ; + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bbU, 15) ; + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391U, 21) ; buf[0] += a ; buf[1] += b ; diff --git a/src/libstdcrypto/md5_update.c b/src/libstdcrypto/md5_update.c index c03a598..3b53abb 100644 --- a/src/libstdcrypto/md5_update.c +++ b/src/libstdcrypto/md5_update.c @@ -1,11 +1,13 @@ /* ISC license. */ +#include +#include #include #include #include #include "md5-internal.h" -void md5_update (MD5Schedule *ctx, char const *s, unsigned int len) +void md5_update (MD5Schedule *ctx, char const *s, size_t len) { register uint32 t = ctx->bits[0] ; if ((ctx->bits[0] = t + (len << 3)) < t) @@ -23,14 +25,14 @@ void md5_update (MD5Schedule *ctx, char const *s, unsigned int len) } byte_copy((char *)p, t, s) ; uint32_little_endian((char *)ctx->in, 16) ; - md5_transform(ctx->buf, (uint32 *)ctx->in) ; + md5_transform(ctx->buf, (uint32_t *)ctx->in) ; s += t ; len -= t ; } while (len >= 64) { byte_copy((char *)ctx->in, 64, s) ; uint32_little_endian((char *)ctx->in, 16) ; - md5_transform(ctx->buf, (uint32 *)ctx->in) ; + md5_transform(ctx->buf, (uint32_t *)ctx->in) ; s += 64 ; len -= 64 ; } byte_copy((char *)ctx->in, len, s) ; diff --git a/src/libstdcrypto/rc4.c b/src/libstdcrypto/rc4.c index e52a706..ea16a82 100644 --- a/src/libstdcrypto/rc4.c +++ b/src/libstdcrypto/rc4.c @@ -1,12 +1,13 @@ /* ISC license. */ /* Thanks to Thomas Pornin */ +#include #include #include -void rc4 (RC4Schedule *r, char const *in, char *out, unsigned int n) +void rc4 (RC4Schedule *r, char const *in, char *out, size_t n) { - register unsigned int i = 0 ; + register size_t i = 0 ; for (; i < n ; i++) { register unsigned char t ; diff --git a/src/libstdcrypto/rc4_init.c b/src/libstdcrypto/rc4_init.c index 2be9ac3..e5c512d 100644 --- a/src/libstdcrypto/rc4_init.c +++ b/src/libstdcrypto/rc4_init.c @@ -4,9 +4,10 @@ #include #include -void rc4_init (RC4Schedule *r, char const *key, unsigned int ksize) +void rc4_init (RC4Schedule *r, char const *key, size_t ksize) { - register unsigned int i = 0, j = 0 ; + size_t j = 0 ; + register unsigned int i = 0 ; register unsigned char c = 0; r->x = r->y = 0 ; diff --git a/src/libstdcrypto/sha1-internal.h b/src/libstdcrypto/sha1-internal.h index 584c874..0006628 100644 --- a/src/libstdcrypto/sha1-internal.h +++ b/src/libstdcrypto/sha1-internal.h @@ -3,10 +3,10 @@ #ifndef SHA1_INTERNAL_H #define SHA1_INTERNAL_H -#include +#include #include extern void sha1_feed (SHA1Schedule *, unsigned char) ; -extern void sha1_transform (uint32 * /* 5 uint32s */, uint32 const * /* 16 uint32s */) ; +extern void sha1_transform (uint32_t * /* 5 uint32s */, uint32_t const * /* 16 uint32s */) ; #endif diff --git a/src/libstdcrypto/sha1_feed.c b/src/libstdcrypto/sha1_feed.c index 65764bc..578348b 100644 --- a/src/libstdcrypto/sha1_feed.c +++ b/src/libstdcrypto/sha1_feed.c @@ -1,13 +1,13 @@ /* ISC license. */ -#include +#include #include #include #include "sha1-internal.h" void sha1_feed (SHA1Schedule *ctx, unsigned char inb) { - register uint32 tmp ; + register uint32_t tmp ; ctx->in[ctx->b>>2] <<= 8 ; ctx->in[ctx->b>>2] |= T8(inb) ; diff --git a/src/libstdcrypto/sha1_init.c b/src/libstdcrypto/sha1_init.c index e6fadd9..6aad123 100644 --- a/src/libstdcrypto/sha1_init.c +++ b/src/libstdcrypto/sha1_init.c @@ -5,11 +5,11 @@ void sha1_init (SHA1Schedule *ctx) { register unsigned int i = 0 ; - ctx->buf[0] = 0x67452301UL ; - ctx->buf[1] = 0xefcdab89UL ; - ctx->buf[2] = 0x98badcfeUL ; - ctx->buf[3] = 0x10325476UL ; - ctx->buf[4] = 0xc3d2e1f0UL ; + ctx->buf[0] = 0x67452301U ; + ctx->buf[1] = 0xefcdab89U ; + ctx->buf[2] = 0x98badcfeU ; + ctx->buf[3] = 0x10325476U ; + ctx->buf[4] = 0xc3d2e1f0U ; ctx->bits[0] = ctx->bits[1] = 0 ; for (; i < 16 ; i++) ctx->in[i] = 0 ; ctx->b = 0 ; diff --git a/src/libstdcrypto/sha1_transform.c b/src/libstdcrypto/sha1_transform.c index bd6e624..106c356 100644 --- a/src/libstdcrypto/sha1_transform.c +++ b/src/libstdcrypto/sha1_transform.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include +#include #include "sha1-internal.h" #define F1(x, y, z) ((x & y) | ((~x) & z)) @@ -10,7 +10,7 @@ #define SHA1STEP(f, data) \ { \ - register uint32 tmp = e + f(b, c, d) + data + ((a<<5) | (a>>27)); \ + register uint32_t tmp = e + f(b, c, d) + data + ((a<<5) | (a>>27)); \ e = d ; \ d = c ; \ c = (b<<30) | (b>>2) ; \ @@ -18,10 +18,10 @@ a = tmp ; \ } -void sha1_transform (uint32 *buf, uint32 const *in) +void sha1_transform (uint32_t *buf, uint32_t const *in) { - register uint32 a = buf[0], b = buf[1], c = buf[2], d = buf[3], e = buf[4] ; - uint32 w[80] ; + register uint32_t a = buf[0], b = buf[1], c = buf[2], d = buf[3], e = buf[4] ; + uint32_t w[80] ; register unsigned int i = 0 ; for (; i < 16 ; i++) w[i] = in[i] ; @@ -31,12 +31,12 @@ void sha1_transform (uint32 *buf, uint32 const *in) w[i] = (w[i]<<1) | (w[i]>>31) ; } for (i = 0 ; i < 20 ; i++) - SHA1STEP(F1, w[i] + 0x5a827999UL) ; + SHA1STEP(F1, w[i] + 0x5a827999U) ; for (; i < 40 ; i++) - SHA1STEP(F2, w[i] + 0x6ed9eba1UL) ; + SHA1STEP(F2, w[i] + 0x6ed9eba1U) ; for (; i < 60 ; i++) - SHA1STEP(F3, w[i] + 0x8f1bbcdcUL) ; + SHA1STEP(F3, w[i] + 0x8f1bbcdcU) ; for (; i < 80 ; i++) - SHA1STEP(F4, w[i] + 0xca62c1d6UL) ; + SHA1STEP(F4, w[i] + 0xca62c1d6U) ; buf[0] += a ; buf[1] += b ; buf[2] += c ; buf[3] += d ; buf[4] += e ; } diff --git a/src/libstdcrypto/sha1_update.c b/src/libstdcrypto/sha1_update.c index 8758a4d..8c0dc54 100644 --- a/src/libstdcrypto/sha1_update.c +++ b/src/libstdcrypto/sha1_update.c @@ -1,10 +1,11 @@ /* ISC license. */ +#include #include #include "sha1-internal.h" -void sha1_update (SHA1Schedule *ctx, char const *buf, unsigned int len) +void sha1_update (SHA1Schedule *ctx, char const *buf, size_t len) { - register unsigned int i = 0 ; + register size_t i = 0 ; for (; i < len ; i++) sha1_feed(ctx, (unsigned char)buf[i]) ; } diff --git a/src/libstdcrypto/sha256-internal.h b/src/libstdcrypto/sha256-internal.h index e5bb974..a01d75c 100644 --- a/src/libstdcrypto/sha256-internal.h +++ b/src/libstdcrypto/sha256-internal.h @@ -3,10 +3,10 @@ #ifndef SHA256_INTERNAL_H #define SHA256_INTERNAL_H -#include +#include #include extern void sha256_feed (SHA256Schedule *, unsigned char) ; -extern void sha256_transform (uint32 *, uint32 const *) ; +extern void sha256_transform (uint32_t *, uint32_t const *) ; #endif diff --git a/src/libstdcrypto/sha256_feed.c b/src/libstdcrypto/sha256_feed.c index a0a3503..8f1ecbe 100644 --- a/src/libstdcrypto/sha256_feed.c +++ b/src/libstdcrypto/sha256_feed.c @@ -1,13 +1,13 @@ /* ISC license. */ -#include +#include #include #include #include "sha256-internal.h" void sha256_feed (SHA256Schedule *ctx, unsigned char inb) { - register uint32 tmp ; + register uint32_t tmp ; ctx->in[ctx->b>>2] <<= 8 ; ctx->in[ctx->b>>2] |= T8(inb) ; if (++ctx->b >= 64) diff --git a/src/libstdcrypto/sha256_final.c b/src/libstdcrypto/sha256_final.c index be0af2d..b981459 100644 --- a/src/libstdcrypto/sha256_final.c +++ b/src/libstdcrypto/sha256_final.c @@ -1,7 +1,7 @@ /* ISC license. */ +#include #include -#include #include #include "sha256-internal.h" @@ -9,7 +9,7 @@ void sha256_final (SHA256Schedule *ctx, char *digest) { register unsigned int i = 0 ; register unsigned char *p = (unsigned char *)digest ; - uint32 bits[2] = { ctx->bits[0], ctx->bits[1] } ; + uint32_t bits[2] = { ctx->bits[0], ctx->bits[1] } ; sha256_feed(ctx, 0x80) ; while (ctx->b != 56) sha256_feed(ctx, 0) ; diff --git a/src/libstdcrypto/sha256_transform.c b/src/libstdcrypto/sha256_transform.c index e61775c..bc39e33 100644 --- a/src/libstdcrypto/sha256_transform.c +++ b/src/libstdcrypto/sha256_transform.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include +#include #include "sha256-internal.h" #define F1(x, y, z) ((x & y) | ((~x) & z)) @@ -12,39 +12,39 @@ #define SMALLSIGMA0(x) (ROTR(x,7)^ROTR(x,18)^((x)>>3)) #define SMALLSIGMA1(x) (ROTR(x,17)^ROTR(x,19)^((x)>>10)) -static uint32 const sha256_constants[64] = +static uint32_t const sha256_constants[64] = { - 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, - 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, - 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, - 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL, - 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, - 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, - 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, - 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL, - 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL, - 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, - 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, - 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, - 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL, - 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL, - 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, - 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL + 0x428a2f98U, 0x71374491U, 0xb5c0fbcfU, 0xe9b5dba5U, + 0x3956c25bU, 0x59f111f1U, 0x923f82a4U, 0xab1c5ed5U, + 0xd807aa98U, 0x12835b01U, 0x243185beU, 0x550c7dc3U, + 0x72be5d74U, 0x80deb1feU, 0x9bdc06a7U, 0xc19bf174U, + 0xe49b69c1U, 0xefbe4786U, 0x0fc19dc6U, 0x240ca1ccU, + 0x2de92c6fU, 0x4a7484aaU, 0x5cb0a9dcU, 0x76f988daU, + 0x983e5152U, 0xa831c66dU, 0xb00327c8U, 0xbf597fc7U, + 0xc6e00bf3U, 0xd5a79147U, 0x06ca6351U, 0x14292967U, + 0x27b70a85U, 0x2e1b2138U, 0x4d2c6dfcU, 0x53380d13U, + 0x650a7354U, 0x766a0abbU, 0x81c2c92eU, 0x92722c85U, + 0xa2bfe8a1U, 0xa81a664bU, 0xc24b8b70U, 0xc76c51a3U, + 0xd192e819U, 0xd6990624U, 0xf40e3585U, 0x106aa070U, + 0x19a4c116U, 0x1e376c08U, 0x2748774cU, 0x34b0bcb5U, + 0x391c0cb3U, 0x4ed8aa4aU, 0x5b9cca4fU, 0x682e6ff3U, + 0x748f82eeU, 0x78a5636fU, 0x84c87814U, 0x8cc70208U, + 0x90befffaU, 0xa4506cebU, 0xbef9a3f7U, 0xc67178f2U } ; -void sha256_transform (uint32 *buf, uint32 const *in) +void sha256_transform (uint32_t *buf, uint32_t const *in) { - uint32 w[64] ; + uint32_t w[64] ; unsigned int i = 0 ; - register uint32 a = buf[0], b = buf[1], c = buf[2], d = buf[3], e = buf[4], f = buf[5], g = buf[6], h = buf[7] ; + register uint32_t a = buf[0], b = buf[1], c = buf[2], d = buf[3], e = buf[4], f = buf[5], g = buf[6], h = buf[7] ; for (; i < 16 ; i++) w[i] = in[i] ; for (; i < 64 ; i++) w[i] = SMALLSIGMA1(w[i-2]) + w[i-7] + SMALLSIGMA0(w[i-15]) + w[i-16] ; for (i = 0 ; i < 64 ; i++) { - uint32 temp1 = h + CAPITALSIGMA1(e) + F1(e, f, g) + sha256_constants[i] + w[i] ; - uint32 temp2 = CAPITALSIGMA0(a) + F2(a, b, c) ; + uint32_t temp1 = h + CAPITALSIGMA1(e) + F1(e, f, g) + sha256_constants[i] + w[i] ; + uint32_t temp2 = CAPITALSIGMA0(a) + F2(a, b, c) ; h = g ; g = f ; f = e ; e = d + temp1 ; d = c ; c = b ; b = a ; a = temp1 + temp2 ; } diff --git a/src/libstdcrypto/sha256_update.c b/src/libstdcrypto/sha256_update.c index 3cd4781..6d69469 100644 --- a/src/libstdcrypto/sha256_update.c +++ b/src/libstdcrypto/sha256_update.c @@ -1,10 +1,11 @@ /* ISC license. */ +#include #include #include "sha256-internal.h" -void sha256_update (SHA256Schedule *ctx, char const *buf, unsigned int len) +void sha256_update (SHA256Schedule *ctx, char const *buf, size_t len) { - register unsigned int i = 0 ; + register size_t i = 0 ; for (; i < len ; i++) sha256_feed(ctx, (unsigned char)buf[i]) ; } diff --git a/src/libstdcrypto/sha512_transform.c b/src/libstdcrypto/sha512_transform.c index b28e97b..7b94adf 100644 --- a/src/libstdcrypto/sha512_transform.c +++ b/src/libstdcrypto/sha512_transform.c @@ -74,7 +74,7 @@ void sha512_transform (SHA512Schedule *ctx, unsigned char const *block) register unsigned int i = 0 ; for (; i < 16 ; i++) uint64_unpack_big((char const *)block + (i << 3), w + i) ; - for (; i < 80; i++) w[i] = R1(w[i-2]) + w[i-7] + R0(w[i-15]) + w[i-16] ; + for (; i < 80 ; i++) w[i] = R1(w[i-2]) + w[i-7] + R0(w[i-15]) + w[i-16] ; for (i = 0 ; i < 8 ; i++) h[i] = ctx->h[i] ; for (i = 0 ; i < 80 ; i++) { diff --git a/src/libstdcrypto/sha512_update.c b/src/libstdcrypto/sha512_update.c index 4c8029e..63bc6fb 100644 --- a/src/libstdcrypto/sha512_update.c +++ b/src/libstdcrypto/sha512_update.c @@ -1,12 +1,13 @@ /* ISC license. */ +#include #include #include #include "sha512-internal.h" -void sha512_update (SHA512Schedule *ctx, char const *buf, unsigned int len) +void sha512_update (SHA512Schedule *ctx, char const *buf, size_t len) { - register unsigned int pad = ctx->len & 0x7fu ; + register unsigned int pad = ctx->len & 0x7fU ; ctx->len += len ; if (pad && len >= 128 - pad) { -- cgit v1.2.3