Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
ashman-p committed Nov 27, 2023
1 parent d7308ab commit abc636d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/common/sha2/sha2_armv8.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ void oqs_sha2_sha256_inc_finalize_armv8(uint8_t *out, sha256ctx *state, const ui
new_in = in;
} else { //Combine incremental data with final input
tmp_in = malloc(tmp_len);
if (tmp_in == NULL)
if (tmp_in == NULL) {
exit(111);
}

memcpy(tmp_in, state->data, state->data_len);
memcpy(tmp_in + state->data_len, in, inlen);
Expand Down Expand Up @@ -231,7 +232,7 @@ void oqs_sha2_sha256_inc_finalize_armv8(uint8_t *out, sha256ctx *state, const ui

for (size_t i = 0; i < 32; ++i) {
out[i] = state->ctx[i];
}
}
oqs_sha2_sha256_inc_ctx_release_c(state);
OQS_MEM_secure_free(tmp_in, tmp_len);
}
Expand All @@ -254,8 +255,9 @@ void oqs_sha2_sha256_inc_blocks_armv8(sha256ctx *state, const uint8_t *in, size_
/* Process any existing incremental data first */
if (state->data_len) {
tmp_in = malloc(buf_len);
if (tmp_in == NULL)
if (tmp_in == NULL) {
exit(111);
}

memcpy(tmp_in, state->data, state->data_len);
memcpy(tmp_in + state->data_len, in, buf_len - state->data_len);
Expand Down
8 changes: 5 additions & 3 deletions src/common/sha2/sha2_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,9 @@ void oqs_sha2_sha256_inc_blocks_c(sha256ctx *state, const uint8_t *in, size_t in
/* Process any existing incremental data first */
if (state->data_len) {
tmp_in = malloc(tmp_buflen);
if (tmp_in == NULL)
if (tmp_in == NULL) {
exit(111);
}

memcpy(tmp_in, state->data, state->data_len);
memcpy(tmp_in + state->data_len, in, tmp_buflen - state->data_len);
Expand Down Expand Up @@ -712,9 +713,10 @@ void oqs_sha2_sha256_inc_finalize_c(uint8_t *out, sha256ctx *state, const uint8_
new_in = in;
} else { //Combine incremental data with final input
tmp_in = malloc(tmp_len);
if (tmp_in == NULL)
if (tmp_in == NULL) {
exit(111);

}

memcpy(tmp_in, state->data, state->data_len);
memcpy(tmp_in + state->data_len, in, inlen);
new_in = tmp_in;
Expand Down

0 comments on commit abc636d

Please sign in to comment.