about summary refs log tree commit diff
path: root/src/libstdcrypto
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-01-21 15:46:20 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-01-21 15:46:20 +0000
commit2746b131aa482ac17c94bc6b82e58dbcc1b752cf (patch)
tree87e50c57bc8458b0809c280ab5d00042d1102925 /src/libstdcrypto
parent05db4ba46ae1ca6143bb9b432d1e05e69eddd263 (diff)
downloadskalibs-2746b131aa482ac17c94bc6b82e58dbcc1b752cf.tar.gz
skalibs-2746b131aa482ac17c94bc6b82e58dbcc1b752cf.tar.xz
skalibs-2746b131aa482ac17c94bc6b82e58dbcc1b752cf.zip
Types fix: librandom, libstdcrypto
Diffstat (limited to 'src/libstdcrypto')
-rw-r--r--src/libstdcrypto/md5-internal.h4
-rw-r--r--src/libstdcrypto/md5_final.c5
-rw-r--r--src/libstdcrypto/md5_init.c8
-rw-r--r--src/libstdcrypto/md5_transform.c134
-rw-r--r--src/libstdcrypto/md5_update.c8
-rw-r--r--src/libstdcrypto/rc4.c5
-rw-r--r--src/libstdcrypto/rc4_init.c5
-rw-r--r--src/libstdcrypto/sha1-internal.h4
-rw-r--r--src/libstdcrypto/sha1_feed.c4
-rw-r--r--src/libstdcrypto/sha1_init.c10
-rw-r--r--src/libstdcrypto/sha1_transform.c18
-rw-r--r--src/libstdcrypto/sha1_update.c5
-rw-r--r--src/libstdcrypto/sha256-internal.h4
-rw-r--r--src/libstdcrypto/sha256_feed.c4
-rw-r--r--src/libstdcrypto/sha256_final.c4
-rw-r--r--src/libstdcrypto/sha256_transform.c46
-rw-r--r--src/libstdcrypto/sha256_update.c5
-rw-r--r--src/libstdcrypto/sha512_transform.c2
-rw-r--r--src/libstdcrypto/sha512_update.c5
19 files changed, 144 insertions, 136 deletions
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 <skalibs/uint32.h>
+#include <stdint.h>
 #include <skalibs/md5.h>
 
-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 <stdint.h>
 #include <skalibs/uint32.h>
 #include <skalibs/bytestr.h>
 #include <skalibs/md5.h>
@@ -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 <skalibs/uint32.h>
+#include <stdint.h>
 #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<<s | 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 <sys/types.h>
+#include <stdint.h>
 #include <skalibs/uint32.h>
 #include <skalibs/bytestr.h>
 #include <skalibs/md5.h>
 #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 <pornin@bolet.org> */
 
+#include <sys/types.h>
 #include <skalibs/bytestr.h>
 #include <skalibs/rc4.h>
 
-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 <skalibs/bytestr.h>
 #include <skalibs/rc4.h>
 
-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 <skalibs/uint32.h>
+#include <stdint.h>
 #include <skalibs/sha1.h>
 
 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 <skalibs/uint32.h>
+#include <stdint.h>
 #include <skalibs/bytestr.h>
 #include <skalibs/sha1.h>
 #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 <skalibs/uint32.h>
+#include <stdint.h>
 #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 <sys/types.h>
 #include <skalibs/sha1.h>
 #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 <skalibs/uint32.h>
+#include <stdint.h>
 #include <skalibs/sha256.h>
 
 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 <skalibs/uint32.h>
+#include <stdint.h>
 #include <skalibs/bytestr.h>
 #include <skalibs/sha256.h>
 #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 <stdint.h>
 #include <skalibs/bytestr.h>
-#include <skalibs/uint32.h>
 #include <skalibs/sha256.h>
 #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 <skalibs/uint32.h>
+#include <stdint.h>
 #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 <sys/types.h>
 #include <skalibs/sha256.h>
 #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 <sys/types.h>
 #include <skalibs/bytestr.h>
 #include <skalibs/sha512.h>
 #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)
   {