Implement state clone for rest of SHA-2 incremental API
This commit is contained in:
parent
4d7e5886c9
commit
b70216eb8d
@ -529,10 +529,22 @@ void sha512_inc_init(sha512ctx *state) {
|
||||
}
|
||||
}
|
||||
|
||||
void sha224_inc_clone_state(sha224ctx *stateout, const sha224ctx *statein) {
|
||||
memcpy(stateout, statein, sizeof(sha224ctx));
|
||||
}
|
||||
|
||||
void sha256_inc_clone_state(sha256ctx *stateout, const sha256ctx *statein) {
|
||||
memcpy(stateout, statein, sizeof(sha256ctx));
|
||||
}
|
||||
|
||||
void sha384_inc_clone_state(sha384ctx *stateout, const sha384ctx *statein) {
|
||||
memcpy(stateout, statein, sizeof(sha384ctx));
|
||||
}
|
||||
|
||||
void sha512_inc_clone_state(sha512ctx *stateout, const sha512ctx *statein) {
|
||||
memcpy(stateout, statein, sizeof(sha512ctx));
|
||||
}
|
||||
|
||||
void sha256_inc_blocks(sha256ctx *state, const uint8_t *in, size_t inblocks) {
|
||||
uint64_t bytes = load_bigendian_64(state->ctx + 32);
|
||||
|
||||
|
@ -25,6 +25,7 @@ typedef struct {
|
||||
} sha512ctx;
|
||||
|
||||
void sha224_inc_init(sha224ctx *state);
|
||||
void sha224_inc_clone_state(sha224ctx *stateout, const sha224ctx *statein);
|
||||
void sha224_inc_blocks(sha224ctx *state, const uint8_t *in, size_t inblocks);
|
||||
void sha224_inc_finalize(uint8_t *out, sha224ctx *state, const uint8_t *in, size_t inlen);
|
||||
void sha224(uint8_t *out, const uint8_t *in, size_t inlen);
|
||||
@ -36,11 +37,13 @@ void sha256_inc_finalize(uint8_t *out, sha256ctx *state, const uint8_t *in, size
|
||||
void sha256(uint8_t *out, const uint8_t *in, size_t inlen);
|
||||
|
||||
void sha384_inc_init(sha384ctx *state);
|
||||
void sha384_inc_clone_state(sha384ctx *stateout, const sha384ctx *statein);
|
||||
void sha384_inc_blocks(sha384ctx *state, const uint8_t *in, size_t inblocks);
|
||||
void sha384_inc_finalize(uint8_t *out, sha384ctx *state, const uint8_t *in, size_t inlen);
|
||||
void sha384(uint8_t *out, const uint8_t *in, size_t inlen);
|
||||
|
||||
void sha512_inc_init(sha512ctx *state);
|
||||
void sha512_inc_clone_state(sha512ctx *stateout, const sha512ctx *statein);
|
||||
void sha512_inc_blocks(sha512ctx *state, const uint8_t *in, size_t inblocks);
|
||||
void sha512_inc_finalize(uint8_t *out, sha512ctx *state, const uint8_t *in, size_t inlen);
|
||||
void sha512(uint8_t *out, const uint8_t *in, size_t inlen);
|
||||
|
Loading…
Reference in New Issue
Block a user