Skip to content

Commit

Permalink
Move finalXOF to end of evp_md_st to preserve memory layout
Browse files Browse the repository at this point in the history
  • Loading branch information
WillChilds-Klein committed Sep 19, 2023
1 parent f702100 commit d2d298b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crypto/digest_extra/digest_extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ static const EVP_MD evp_md_blake2b256 = {
blake2b256_init,
blake2b256_update,
blake2b256_final,
/*finalXOf*/ NULL,
BLAKE2B_CBLOCK,
sizeof(BLAKE2B_CTX),
/*finalXOf*/ NULL,
};

const EVP_MD *EVP_blake2b256(void) { return &evp_md_blake2b256; }
8 changes: 4 additions & 4 deletions crypto/fipsmodule/digest/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ struct env_md_st {
// final completes the hash and writes |md_size| bytes of digest to |out|.
void (*final)(EVP_MD_CTX *ctx, uint8_t *out);

// finalXOF completes the hash and writes |len| bytes of digest extended output
// to |out|.
void (*finalXOF)(EVP_MD_CTX *ctx, uint8_t *out, size_t len);

// block_size contains the hash's native block size.
unsigned block_size;

// ctx_size contains the size, in bytes, of the state of the hash function.
unsigned ctx_size;

// finalXOF completes the hash and writes |len| bytes of digest extended output
// to |out|.
void (*finalXOF)(EVP_MD_CTX *ctx, uint8_t *out, size_t len);
};

// evp_md_pctx_ops contains function pointers to allow the |pctx| member of
Expand Down

0 comments on commit d2d298b

Please sign in to comment.