File tree Expand file tree Collapse file tree 2 files changed +5
-11
lines changed
Expand file tree Collapse file tree 2 files changed +5
-11
lines changed Original file line number Diff line number Diff line change 1919 */
2020
2121#include <string.h>
22+ #include <assert.h>
2223
2324#include "hashes/sha224.h"
2425#include "hashes/sha2xx_common.h"
@@ -40,18 +41,12 @@ void sha224_init(sha224_context_t *ctx)
4041 ctx -> state [7 ] = 0xBEFA4FA4 ;
4142}
4243
43- void * sha224 (const void * data , size_t len , void * digest )
44+ void sha224 (const void * data , size_t len , void * digest )
4445{
4546 sha224_context_t c ;
46- static unsigned char m [SHA224_DIGEST_LENGTH ];
47-
48- if (digest == NULL ) {
49- digest = m ;
50- }
47+ assert (digest );
5148
5249 sha224_init (& c );
5350 sha224_update (& c , data , len );
5451 sha224_final (& c , digest );
55-
56- return digest ;
5752}
Original file line number Diff line number Diff line change @@ -110,11 +110,10 @@ static inline void sha224_final(sha224_context_t *ctx, void *digest)
110110 *
111111 * @param[in] data pointer to the buffer to generate hash from
112112 * @param[in] len length of the buffer
113- * @param[out] digest optional pointer to an array for the result, length must
113+ * @param[out] digest Pointer to an array for the result, length must
114114 * be SHA224_DIGEST_LENGTH
115- * if digest == NULL, one static buffer is used
116115 */
117- void * sha224 (const void * data , size_t len , void * digest );
116+ void sha224 (const void * data , size_t len , void * digest );
118117
119118#ifdef __cplusplus
120119}
You can’t perform that action at this time.
0 commit comments