You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, Hacl_SHA2_Streaming.c has two nearly identical functions for Streaming_sha2_224_finish, and Streaming_sha2_256_finish... these two functions call update_224/update_256 (these are identical, we have a proof), update_last_224/update_last_256 (same deal), then finish_224/finish_256.
finish_224 can be expressed in terms of finish_256 followed by a truncation; or worded differently, one could rewrite Streaming_sha2_224_finish to call Streaming_sha2_256_finish then truncate the result, which would save one code size in that file.
(Same deal with 384/512).
The text was updated successfully, but these errors were encountered:
msprotz
changed the title
Code quality in SHA2 streaming
Code quality in SHA2 streaming: could share more code between finish_224 and finish_256
May 22, 2023
Right now, Hacl_SHA2_Streaming.c has two nearly identical functions for Streaming_sha2_224_finish, and Streaming_sha2_256_finish... these two functions call update_224/update_256 (these are identical, we have a proof), update_last_224/update_last_256 (same deal), then finish_224/finish_256.
finish_224 can be expressed in terms of finish_256 followed by a truncation; or worded differently, one could rewrite Streaming_sha2_224_finish to call Streaming_sha2_256_finish then truncate the result, which would save one code size in that file.
(Same deal with 384/512).
The text was updated successfully, but these errors were encountered: