This is an archive of the discontinued LLVM Phabricator instance.

Add interceptors for the sha2(3) from NetBSD
ClosedPublic

Authored by krytarowski on Nov 27 2018, 8:03 PM.

Details

Summary

SHA224_Init, SHA224_Update, SHA224_Final, SHA224_End, SHA224_File,
SHA224_FileChunk, SHA224_Data, SHA256_Init, SHA256_Update, SHA256_Final,
SHA256_End, SHA256_File, SHA256_FileChunk, SHA256_Data, SHA384_Init,
SHA384_Update, SHA384_Final, SHA384_End, SHA384_File, SHA384_FileChunk,
SHA384_Data, SHA512_Init, SHA512_Update, SHA512_Final, SHA512_End,
SHA512_File, SHA512_FileChunk, SHA512_Data – calculates the NIST Secure
Hash Standard (version 2)

Add tests for new interceptors.

Diff Detail

Repository
rL LLVM

Event Timeline

krytarowski created this revision.Nov 27 2018, 8:03 PM
vitalybuka requested changes to this revision.Nov 29 2018, 5:36 PM
vitalybuka added inline comments.
lib/sanitizer_common/sanitizer_common_interceptors.inc
7420
#define INIT_SHA2_INTECEPTORS(LEN) \
 COMMON_INTERCEPT_FUNCTION(SHA##LEN##_Init); \
...
 COMMON_INTERCEPT_FUNCTION(SHA##LEN##_Data); \


#define INIT_SHA2 \
   INIT_SHA2_INTECEPTORS(224); \
   INIT_SHA2_INTECEPTORS(256); \
   INIT_SHA2_INTECEPTORS(384); \
   INIT_SHA2_INTECEPTORS(512);
test/sanitizer_common/TestCases/NetBSD/sha224.cc
1

tests are very similar. can you just use multiple:

RUN: .. -DSSH_SIZE=224..
RUN: .. -DSSH_SIZE=256..
RUN: .. -DSSH_SIZE=384..
test/sanitizer_common/TestCases/NetBSD/sha256.cc
144

tests are broken by clang-format
please protect such lines with
clang-format off
clang-format on

This revision now requires changes to proceed.Nov 29 2018, 5:36 PM
  • apply enhancements
  • align style
krytarowski marked 3 inline comments as done.Dec 7 2018, 5:10 PM
vitalybuka accepted this revision.Dec 10 2018, 12:20 AM
vitalybuka added inline comments.
test/sanitizer_common/TestCases/NetBSD/sha2.cc
161 ↗(On Diff #177360)

actually I've recently updated clang-format config, similar to llvm and clang
it will not brake long lines in tests, so off/on is not needed

This revision is now accepted and ready to land.Dec 10 2018, 12:20 AM
This revision was automatically updated to reflect the committed changes.