aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2019-07-19 16:29:34 -0400
committerPaul Duncan <pabs@pablotron.org>2019-07-19 16:29:34 -0400
commitf9a7d81ea228c2d87dcd6fee986bb58a3d0813c2 (patch)
treef64b263c82987635811de5a1034c81015a6c368f
parent49ae79d294ac27ba837c4d734f396b5cb4bd182e (diff)
downloadsha2-f9a7d81ea228c2d87dcd6fee986bb58a3d0813c2.tar.bz2
sha2-f9a7d81ea228c2d87dcd6fee986bb58a3d0813c2.zip
more restricts
-rw-r--r--sha2.c32
-rw-r--r--sha2.h18
2 files changed, 25 insertions, 25 deletions
diff --git a/sha2.c b/sha2.c
index 456671d..25bf7af 100644
--- a/sha2.c
+++ b/sha2.c
@@ -215,8 +215,8 @@ sha256_block(sha256_t * const ctx) {
#undef WC
void sha256_push(
- sha256_t * const ctx,
- const void * const src_ptr,
+ sha256_t * const restrict ctx,
+ const void * const restrict src_ptr,
const size_t src_len
) {
const uint8_t * const src = src_ptr;
@@ -285,8 +285,8 @@ sha256_push_footer(
}
void sha256_fini(
- sha256_t * const ctx,
- void * const out
+ sha256_t * const restrict ctx,
+ void * const restrict out
) {
// push footer
sha256_push_footer(ctx);
@@ -325,8 +325,8 @@ void sha224_init(sha224_t * const ctx) {
}
void sha224_push(
- sha224_t * const sha224_ctx,
- const void * const src,
+ sha224_t * const restrict sha224_ctx,
+ const void * const restrict src,
const size_t src_len
) {
sha256_t * const ctx = (sha256_t * const) sha224_ctx;
@@ -513,8 +513,8 @@ sha512_block(sha512_t * const ctx) {
#undef WC64
void sha512_push(
- sha512_t * const ctx,
- const void * const src_ptr,
+ sha512_t * const restrict ctx,
+ const void * const restrict src_ptr,
const size_t src_len
) {
const uint8_t * const src = src_ptr;
@@ -594,8 +594,8 @@ sha512_push_footer(
}
void sha512_fini(
- sha512_t * const ctx,
- void * const out
+ sha512_t * const restrict ctx,
+ void * const restrict out
) {
// push footer
sha512_push_footer(ctx);
@@ -636,8 +636,8 @@ void sha384_init(sha384_t * const ctx) {
}
void sha384_push(
- sha384_t * const sha384_ctx,
- const void * const src,
+ sha384_t * const restrict sha384_ctx,
+ const void * const restrict src,
const size_t src_len
) {
sha512_t * const ctx = (sha512_t * const) sha384_ctx;
@@ -645,8 +645,8 @@ void sha384_push(
}
void sha384_fini(
- sha384_t * const sha384_ctx,
- void * const out
+ sha384_t * const restrict sha384_ctx,
+ void * const restrict out
) {
sha512_t * const ctx = (sha512_t * const) sha384_ctx;
@@ -663,9 +663,9 @@ void sha384_fini(
}
void sha384(
- const void * const src,
+ const void * const restrict src,
const size_t src_len,
- void * restrict const dst
+ void * const restrict dst
) {
sha384_t ctx;
sha384_init(&ctx);
diff --git a/sha2.h b/sha2.h
index 6494700..3186dbe 100644
--- a/sha2.h
+++ b/sha2.h
@@ -17,8 +17,8 @@ typedef struct {
} sha256_t;
void sha256_init(sha256_t * const);
-void sha256_push(sha256_t * const, const void *, size_t);
-void sha256_fini(sha256_t * const, void * const);
+void sha256_push(sha256_t * const restrict, const void * const restrict, const size_t);
+void sha256_fini(sha256_t * const restrict, void * const restrict);
void sha256(const void * const restrict, const size_t, void * const restrict);
#define SHA224_HASH_SIZE 28
@@ -28,8 +28,8 @@ typedef struct {
} sha224_t;
void sha224_init(sha224_t * const);
-void sha224_push(sha224_t * const, const void *, size_t);
-void sha224_fini(sha224_t * const, void * const);
+void sha224_push(sha224_t * const restrict, const void * const restrict, const size_t);
+void sha224_fini(sha224_t * const restrict, void * const restrict);
void sha224(const void * const restrict, const size_t, void * const restrict);
@@ -43,8 +43,8 @@ typedef struct {
} sha512_t;
void sha512_init(sha512_t * const);
-void sha512_push(sha512_t * const, const void *, size_t);
-void sha512_fini(sha512_t * const, void * const);
+void sha512_push(sha512_t * const restrict, const void * restrict, const size_t);
+void sha512_fini(sha512_t * const restrict, void * const restrict);
void sha512(const void * const restrict, const size_t, void * const restrict);
#define SHA384_HASH_SIZE 48
@@ -54,9 +54,9 @@ typedef struct {
} sha384_t;
void sha384_init(sha384_t * const);
-void sha384_push(sha384_t * const, const void *, size_t);
-void sha384_fini(sha384_t * const, void * const);
-void sha384(const void * const restrict, const size_t, void * restrict const);
+void sha384_push(sha384_t * const restrict, const void * const restrict, const size_t);
+void sha384_fini(sha384_t * const restrict, void * const restrict);
+void sha384(const void * const restrict, const size_t, void * const restrict);
#ifdef __cplusplus
};