ubc_check.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /***
  2. * Copyright 2017 Marc Stevens <marc@marc-stevens.nl>, Dan Shumow <danshu@microsoft.com>
  3. * Distributed under the MIT Software License.
  4. * See accompanying file LICENSE.txt or copy at
  5. * https://opensource.org/licenses/MIT
  6. ***/
  7. /*
  8. // this file was generated by the 'parse_bitrel' program in the tools section
  9. // using the data files from directory 'tools/data/3565'
  10. //
  11. // sha1_dvs contains a list of SHA-1 Disturbance Vectors (DV) to check
  12. // dvType, dvK and dvB define the DV: I(K,B) or II(K,B) (see the paper)
  13. // dm[80] is the expanded message block XOR-difference defined by the DV
  14. // testt is the step to do the recompression from for collision detection
  15. // maski and maskb define the bit to check for each DV in the dvmask returned by ubc_check
  16. //
  17. // ubc_check takes as input an expanded message block and verifies the unavoidable bitconditions for all listed DVs
  18. // it returns a dvmask where each bit belonging to a DV is set if all unavoidable bitconditions for that DV have been met
  19. // thus one needs to do the recompression check for each DV that has its bit set
  20. */
  21. #ifndef SHA1DC_UBC_CHECK_H
  22. #define SHA1DC_UBC_CHECK_H
  23. #if defined(__cplusplus)
  24. extern "C" {
  25. #endif
  26. #ifndef SHA1DC_NO_STANDARD_INCLUDES
  27. #include <stdint.h>
  28. #endif
  29. #define DVMASKSIZE 1
  30. typedef struct { int dvType; int dvK; int dvB; int testt; int maski; int maskb; uint32_t dm[80]; } dv_info_t;
  31. extern dv_info_t sha1_dvs[];
  32. void ubc_check(const uint32_t W[80], uint32_t dvmask[DVMASKSIZE]);
  33. #define DOSTORESTATE58
  34. #define DOSTORESTATE65
  35. #define CHECK_DVMASK(_DVMASK) (0 != _DVMASK[0])
  36. #if defined(__cplusplus)
  37. }
  38. #endif
  39. #ifdef SHA1DC_CUSTOM_TRAILING_INCLUDE_UBC_CHECK_H
  40. #include SHA1DC_CUSTOM_TRAILING_INCLUDE_UBC_CHECK_H
  41. #endif
  42. #endif