Do not clear the padding (for alignment) section of a blake2b state
So that it's acceptable for an application to provide a state that doesn't include padding.
This commit is contained in:
parent
b503d75e43
commit
394e21884c
@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -160,11 +161,12 @@ static inline int
|
|||||||
blake2b_init0(blake2b_state *S)
|
blake2b_init0(blake2b_state *S)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
memset(S, 0, sizeof(blake2b_state));
|
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
S->h[i] = blake2b_IV[i];
|
S->h[i] = blake2b_IV[i];
|
||||||
}
|
}
|
||||||
|
memset(S->t, 0, offsetof(blake2b_state, last_node) + sizeof(S->last_node)
|
||||||
|
- offsetof(blake2b_state, t));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user