mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
hashes/sha224: Remove static variables from sha224
This commit is contained in:
parent
bac3f48dc9
commit
434e5647d0
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "hashes/sha224.h"
|
||||
#include "hashes/sha2xx_common.h"
|
||||
@ -40,18 +41,12 @@ void sha224_init(sha224_context_t *ctx)
|
||||
ctx->state[7] = 0xBEFA4FA4;
|
||||
}
|
||||
|
||||
void *sha224(const void *data, size_t len, void *digest)
|
||||
void sha224(const void *data, size_t len, void *digest)
|
||||
{
|
||||
sha224_context_t c;
|
||||
static unsigned char m[SHA224_DIGEST_LENGTH];
|
||||
|
||||
if (digest == NULL) {
|
||||
digest = m;
|
||||
}
|
||||
assert(digest);
|
||||
|
||||
sha224_init(&c);
|
||||
sha224_update(&c, data, len);
|
||||
sha224_final(&c, digest);
|
||||
|
||||
return digest;
|
||||
}
|
||||
|
@ -110,11 +110,10 @@ static inline void sha224_final(sha224_context_t *ctx, void *digest)
|
||||
*
|
||||
* @param[in] data pointer to the buffer to generate hash from
|
||||
* @param[in] len length of the buffer
|
||||
* @param[out] digest optional pointer to an array for the result, length must
|
||||
* @param[out] digest Pointer to an array for the result, length must
|
||||
* be SHA224_DIGEST_LENGTH
|
||||
* if digest == NULL, one static buffer is used
|
||||
*/
|
||||
void *sha224(const void *data, size_t len, void *digest);
|
||||
void sha224(const void *data, size_t len, void *digest);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user