Skip to content

Commit

Permalink
lib: Mark md4/md5/sha1/sha2 code with ATTR_UNSIGNED_WRAPS
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and GitLab committed Nov 24, 2016
1 parent 2c488bf commit 21484e1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/lib/md4.c
Expand Up @@ -65,7 +65,7 @@
* This processes one or more 64-byte data blocks, but does NOT update
* the bit counters. There're no alignment requirements.
*/
static const void * ATTR_NOWARN_UNUSED_RESULT
static const void * ATTR_NOWARN_UNUSED_RESULT ATTR_UNSIGNED_WRAPS
body(struct md4_context *ctx, const void *data, size_t size)
{
const unsigned char *ptr;
Expand Down
8 changes: 5 additions & 3 deletions src/lib/md5.c
Expand Up @@ -66,7 +66,7 @@
* This processes one or more 64-byte data blocks, but does NOT update
* the bit counters. There're no alignment requirements.
*/
static const void * ATTR_NOWARN_UNUSED_RESULT
static const void * ATTR_NOWARN_UNUSED_RESULT ATTR_UNSIGNED_WRAPS
body(struct md5_context *ctx, const void *data, size_t size)
{
const unsigned char *ptr;
Expand Down Expand Up @@ -186,7 +186,8 @@ void md5_init(struct md5_context *ctx)
memset(ctx->block, 0, sizeof(ctx->block));
}

void md5_update(struct md5_context *ctx, const void *data, size_t size)
void ATTR_UNSIGNED_WRAPS
md5_update(struct md5_context *ctx, const void *data, size_t size)
{
/* @UNSAFE */
uint_fast32_t saved_lo;
Expand Down Expand Up @@ -221,7 +222,8 @@ void md5_update(struct md5_context *ctx, const void *data, size_t size)
memcpy(ctx->buffer, data, size);
}

void md5_final(struct md5_context *ctx, unsigned char result[STATIC_ARRAY MD5_RESULTLEN])
void ATTR_UNSIGNED_WRAPS
md5_final(struct md5_context *ctx, unsigned char result[STATIC_ARRAY MD5_RESULTLEN])
{
/* @UNSAFE */
unsigned long used, free;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/sha1.c
Expand Up @@ -73,7 +73,7 @@ static uint32_t SHA1_K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 };

static void sha1_step(struct sha1_ctxt *);

static void
static void ATTR_UNSIGNED_WRAPS
sha1_step(struct sha1_ctxt *ctxt)
{
uint32_t a, b, c, d, e;
Expand Down
10 changes: 6 additions & 4 deletions src/lib/sha2.c
Expand Up @@ -175,8 +175,9 @@ static const uint64_t sha512_k[80] =

/* SHA-256 functions */

static void sha256_transf(struct sha256_ctx *ctx, const unsigned char *data,
size_t block_nb)
static void ATTR_UNSIGNED_WRAPS
sha256_transf(struct sha256_ctx *ctx, const unsigned char *data,
size_t block_nb)
{
uint32_t w[64];
uint32_t wv[8];
Expand Down Expand Up @@ -301,8 +302,9 @@ void sha256_get_digest(const void *data, size_t size,

/* SHA-512 functions */

static void sha512_transf(struct sha512_ctx *ctx, const unsigned char *data,
size_t block_nb)
static void ATTR_UNSIGNED_WRAPS
sha512_transf(struct sha512_ctx *ctx, const unsigned char *data,
size_t block_nb)
{
uint64_t w[80];
uint64_t wv[8];
Expand Down

0 comments on commit 21484e1

Please sign in to comment.