summaryrefslogtreecommitdiff
path: root/src/libstdcrypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstdcrypto')
-rw-r--r--src/libstdcrypto/md5_final.c4
-rw-r--r--src/libstdcrypto/md5_transform.c2
-rw-r--r--src/libstdcrypto/md5_update.c2
-rw-r--r--src/libstdcrypto/rc4.c4
-rw-r--r--src/libstdcrypto/rc4_init.c4
-rw-r--r--src/libstdcrypto/sha1_feed.c5
-rw-r--r--src/libstdcrypto/sha1_final.c2
-rw-r--r--src/libstdcrypto/sha1_init.c4
-rw-r--r--src/libstdcrypto/sha1_transform.c6
-rw-r--r--src/libstdcrypto/sha1_update.c2
-rw-r--r--src/libstdcrypto/sha256_feed.c4
-rw-r--r--src/libstdcrypto/sha256_final.c4
-rw-r--r--src/libstdcrypto/sha256_transform.c2
-rw-r--r--src/libstdcrypto/sha256_update.c2
-rw-r--r--src/libstdcrypto/sha512_final.c4
-rw-r--r--src/libstdcrypto/sha512_transform.c12
-rw-r--r--src/libstdcrypto/sha512_update.c9
17 files changed, 35 insertions, 37 deletions
diff --git a/src/libstdcrypto/md5_final.c b/src/libstdcrypto/md5_final.c
index 1ecdedf..706162b 100644
--- a/src/libstdcrypto/md5_final.c
+++ b/src/libstdcrypto/md5_final.c
@@ -8,8 +8,8 @@
void md5_final (MD5Schedule *ctx, char *digest /* 16 chars */)
{
- register unsigned int count = (ctx->bits[0] >> 3) & 0x3F ;
- register unsigned char *p = ctx->in + count ;
+ unsigned int count = (ctx->bits[0] >> 3) & 0x3F ;
+ unsigned char *p = ctx->in + count ;
*p++ = 0x80;
count = 63 - count ;
if (count < 8)
diff --git a/src/libstdcrypto/md5_transform.c b/src/libstdcrypto/md5_transform.c
index 0e65671..e210e73 100644
--- a/src/libstdcrypto/md5_transform.c
+++ b/src/libstdcrypto/md5_transform.c
@@ -14,7 +14,7 @@
void md5_transform (uint32_t *buf /* 4 uint32s */, uint32_t const *in /* 16 uint32s */)
{
- register uint32_t a = buf[0], b = buf[1], c = buf[2], d = buf[3] ;
+ uint32_t a = buf[0], b = buf[1], c = buf[2], d = buf[3] ;
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478U, 7) ;
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756U, 12) ;
diff --git a/src/libstdcrypto/md5_update.c b/src/libstdcrypto/md5_update.c
index 3b53abb..1a88540 100644
--- a/src/libstdcrypto/md5_update.c
+++ b/src/libstdcrypto/md5_update.c
@@ -9,7 +9,7 @@
void md5_update (MD5Schedule *ctx, char const *s, size_t len)
{
- register uint32 t = ctx->bits[0] ;
+ uint32 t = ctx->bits[0] ;
if ((ctx->bits[0] = t + (len << 3)) < t)
ctx->bits[1]++ ;
ctx->bits[1] += len >> 29 ;
diff --git a/src/libstdcrypto/rc4.c b/src/libstdcrypto/rc4.c
index ea16a82..2f39b95 100644
--- a/src/libstdcrypto/rc4.c
+++ b/src/libstdcrypto/rc4.c
@@ -7,10 +7,10 @@
void rc4 (RC4Schedule *r, char const *in, char *out, size_t n)
{
- register size_t i = 0 ;
+ size_t i = 0 ;
for (; i < n ; i++)
{
- register unsigned char t ;
+ unsigned char t ;
r->x = T8(r->x + 1) ;
t = r->tab[r->x] ;
r->y = T8(r->y + t) ;
diff --git a/src/libstdcrypto/rc4_init.c b/src/libstdcrypto/rc4_init.c
index e5c512d..bbcefda 100644
--- a/src/libstdcrypto/rc4_init.c
+++ b/src/libstdcrypto/rc4_init.c
@@ -7,8 +7,8 @@
void rc4_init (RC4Schedule *r, char const *key, size_t ksize)
{
size_t j = 0 ;
- register unsigned int i = 0 ;
- register unsigned char c = 0;
+ unsigned int i = 0 ;
+ unsigned char c = 0;
r->x = r->y = 0 ;
for (; i < 256 ; i++) r->tab[i] = i ;
diff --git a/src/libstdcrypto/sha1_feed.c b/src/libstdcrypto/sha1_feed.c
index 578348b..cb00852 100644
--- a/src/libstdcrypto/sha1_feed.c
+++ b/src/libstdcrypto/sha1_feed.c
@@ -7,13 +7,12 @@
void sha1_feed (SHA1Schedule *ctx, unsigned char inb)
{
- register uint32_t tmp ;
-
+ uint32_t tmp ;
ctx->in[ctx->b>>2] <<= 8 ;
ctx->in[ctx->b>>2] |= T8(inb) ;
if (++ctx->b >= 64)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
sha1_transform(ctx->buf, ctx->in) ;
ctx->b = 0 ;
for (i = 0 ; i < 16 ; i++) ctx->in[i] = 0 ;
diff --git a/src/libstdcrypto/sha1_final.c b/src/libstdcrypto/sha1_final.c
index 603c89c..d29a621 100644
--- a/src/libstdcrypto/sha1_final.c
+++ b/src/libstdcrypto/sha1_final.c
@@ -7,7 +7,7 @@
void sha1_final (SHA1Schedule *ctx, char *digest)
{
char pack[8] ;
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
uint32_pack_big(pack, ctx->bits[1]) ;
uint32_pack_big(pack+4, ctx->bits[0]) ;
sha1_feed(ctx, 0x80) ;
diff --git a/src/libstdcrypto/sha1_init.c b/src/libstdcrypto/sha1_init.c
index 6aad123..589230d 100644
--- a/src/libstdcrypto/sha1_init.c
+++ b/src/libstdcrypto/sha1_init.c
@@ -4,13 +4,13 @@
void sha1_init (SHA1Schedule *ctx)
{
- register unsigned int i = 0 ;
+ unsigned int i = 16 ;
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 ;
+ while (i--) ctx->in[i] = 0 ;
ctx->b = 0 ;
}
diff --git a/src/libstdcrypto/sha1_transform.c b/src/libstdcrypto/sha1_transform.c
index 106c356..66a1c52 100644
--- a/src/libstdcrypto/sha1_transform.c
+++ b/src/libstdcrypto/sha1_transform.c
@@ -10,7 +10,7 @@
#define SHA1STEP(f, data) \
{ \
- register uint32_t tmp = e + f(b, c, d) + data + ((a<<5) | (a>>27)); \
+ uint32_t tmp = e + f(b, c, d) + data + ((a<<5) | (a>>27)); \
e = d ; \
d = c ; \
c = (b<<30) | (b>>2) ; \
@@ -20,9 +20,9 @@
void sha1_transform (uint32_t *buf, uint32_t const *in)
{
- register uint32_t a = buf[0], b = buf[1], c = buf[2], d = buf[3], e = buf[4] ;
+ 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 ;
+ unsigned int i = 0 ;
for (; i < 16 ; i++) w[i] = in[i] ;
for (; i < 80 ; i++)
diff --git a/src/libstdcrypto/sha1_update.c b/src/libstdcrypto/sha1_update.c
index 8c0dc54..4fa393c 100644
--- a/src/libstdcrypto/sha1_update.c
+++ b/src/libstdcrypto/sha1_update.c
@@ -6,6 +6,6 @@
void sha1_update (SHA1Schedule *ctx, char const *buf, size_t len)
{
- register size_t i = 0 ;
+ size_t i = 0 ;
for (; i < len ; i++) sha1_feed(ctx, (unsigned char)buf[i]) ;
}
diff --git a/src/libstdcrypto/sha256_feed.c b/src/libstdcrypto/sha256_feed.c
index 8f1ecbe..197b8f0 100644
--- a/src/libstdcrypto/sha256_feed.c
+++ b/src/libstdcrypto/sha256_feed.c
@@ -7,12 +7,12 @@
void sha256_feed (SHA256Schedule *ctx, unsigned char inb)
{
- register uint32_t tmp ;
+ uint32_t tmp ;
ctx->in[ctx->b>>2] <<= 8 ;
ctx->in[ctx->b>>2] |= T8(inb) ;
if (++ctx->b >= 64)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
sha256_transform(ctx->buf, ctx->in) ;
ctx->b = 0 ;
for (; i < 16 ; i++) ctx->in[i] = 0 ;
diff --git a/src/libstdcrypto/sha256_final.c b/src/libstdcrypto/sha256_final.c
index b981459..ba4b5ea 100644
--- a/src/libstdcrypto/sha256_final.c
+++ b/src/libstdcrypto/sha256_final.c
@@ -7,8 +7,8 @@
void sha256_final (SHA256Schedule *ctx, char *digest)
{
- register unsigned int i = 0 ;
- register unsigned char *p = (unsigned char *)digest ;
+ unsigned int i = 0 ;
+ unsigned char *p = (unsigned char *)digest ;
uint32_t bits[2] = { ctx->bits[0], ctx->bits[1] } ;
sha256_feed(ctx, 0x80) ;
diff --git a/src/libstdcrypto/sha256_transform.c b/src/libstdcrypto/sha256_transform.c
index bc39e33..65a51c4 100644
--- a/src/libstdcrypto/sha256_transform.c
+++ b/src/libstdcrypto/sha256_transform.c
@@ -36,7 +36,7 @@ void sha256_transform (uint32_t *buf, uint32_t const *in)
{
uint32_t w[64] ;
unsigned int i = 0 ;
- 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] ;
+ 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++)
diff --git a/src/libstdcrypto/sha256_update.c b/src/libstdcrypto/sha256_update.c
index 6d69469..d8bb3b1 100644
--- a/src/libstdcrypto/sha256_update.c
+++ b/src/libstdcrypto/sha256_update.c
@@ -6,6 +6,6 @@
void sha256_update (SHA256Schedule *ctx, char const *buf, size_t len)
{
- register size_t i = 0 ;
+ size_t i = 0 ;
for (; i < len ; i++) sha256_feed(ctx, (unsigned char)buf[i]) ;
}
diff --git a/src/libstdcrypto/sha512_final.c b/src/libstdcrypto/sha512_final.c
index 62a6187..ebda597 100644
--- a/src/libstdcrypto/sha512_final.c
+++ b/src/libstdcrypto/sha512_final.c
@@ -7,8 +7,8 @@
void sha512_final (SHA512Schedule *ctx, char *digest)
{
- register unsigned int i = 0 ;
- register unsigned int pad = ctx->len % 128;
+ unsigned int i = 0 ;
+ unsigned int pad = ctx->len % 128;
ctx->buf[pad++] = 0x80 ;
if (pad > 112)
diff --git a/src/libstdcrypto/sha512_transform.c b/src/libstdcrypto/sha512_transform.c
index 7b94adf..3413828 100644
--- a/src/libstdcrypto/sha512_transform.c
+++ b/src/libstdcrypto/sha512_transform.c
@@ -4,7 +4,7 @@
#include <skalibs/sha512.h>
#include "sha512-internal.h"
-static uint64 ror (uint64 n, unsigned int k)
+static uint64_t ror (uint64_t n, unsigned int k)
{
return (n >> k) | (n << (64 - k)) ;
}
@@ -25,7 +25,7 @@ static uint64 ror (uint64 n, unsigned int k)
void sha512_transform (SHA512Schedule *ctx, unsigned char const *block)
{
- static uint64 const K[80] =
+ static uint64_t const K[80] =
{
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL,
0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL,
@@ -68,10 +68,10 @@ void sha512_transform (SHA512Schedule *ctx, unsigned char const *block)
0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL
} ;
- uint64 w[80] ;
- uint64 h[8] ;
- uint64 t[2] ;
- register unsigned int i = 0 ;
+ uint64_t w[80] ;
+ uint64_t h[8] ;
+ uint64_t t[2] ;
+ 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] ;
diff --git a/src/libstdcrypto/sha512_update.c b/src/libstdcrypto/sha512_update.c
index 63bc6fb..a6c004f 100644
--- a/src/libstdcrypto/sha512_update.c
+++ b/src/libstdcrypto/sha512_update.c
@@ -1,17 +1,16 @@
/* ISC license. */
-#include <sys/types.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
#include <skalibs/sha512.h>
#include "sha512-internal.h"
void sha512_update (SHA512Schedule *ctx, char const *buf, size_t len)
{
- register unsigned int pad = ctx->len & 0x7fU ;
+ unsigned int pad = ctx->len & 0x7fU ;
ctx->len += len ;
if (pad && len >= 128 - pad)
{
- byte_copy((char *)ctx->buf + pad, 128 - pad, buf) ;
+ memcpy((char *)ctx->buf + pad, buf, 128 - pad) ;
buf += 128 - pad ; len -= 128 - pad ; pad = 0 ;
sha512_transform(ctx, ctx->buf) ;
}
@@ -21,5 +20,5 @@ void sha512_update (SHA512Schedule *ctx, char const *buf, size_t len)
sha512_transform(ctx, (unsigned char const *)buf) ;
buf += 128 ; len -= 128 ;
}
- byte_copy((char *)ctx->buf + pad, len, buf) ;
+ memcpy((char *)ctx->buf + pad, buf, len) ;
}