Skip to content

Commit 7633952

Browse files
committed
Merge branch 'ab/sha1dc-maint' into maint
* ab/sha1dc-maint: sha1dc: update from upstream sha1dc: ignore indent-with-non-tab whitespace violations
2 parents 2c04f63 + 6b851e5 commit 7633952

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

sha1dc/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* whitespace=-indent-with-non-tab

sha1dc/sha1.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,33 @@
3535
#ifdef SHA1DC_BIGENDIAN
3636
#undef SHA1DC_BIGENDIAN
3737
#endif
38-
#if (!defined SHA1DC_FORCE_LITTLEENDIAN) && \
39-
((defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || \
40-
(defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) || \
41-
defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
42-
defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) || defined(SHA1DC_FORCE_BIGENDIAN))
4338

39+
#if (defined(_BYTE_ORDER) || defined(__BYTE_ORDER) || defined(__BYTE_ORDER__))
40+
41+
#if ((defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)) || \
42+
(defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || \
43+
(defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) )
4444
#define SHA1DC_BIGENDIAN
45+
#endif
46+
47+
#else
48+
49+
#if (defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN) || defined(__BIG_ENDIAN__) || \
50+
defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
51+
defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || \
52+
defined(__sparc))
53+
#define SHA1DC_BIGENDIAN
54+
#endif
4555

46-
#endif /*ENDIANNESS SELECTION*/
56+
#endif
57+
58+
#if (defined(SHA1DC_FORCE_LITTLEENDIAN) && defined(SHA1DC_BIGENDIAN))
59+
#undef SHA1DC_BIGENDIAN
60+
#endif
61+
#if (defined(SHA1DC_FORCE_BIGENDIAN) && !defined(SHA1DC_BIGENDIAN))
62+
#define SHA1DC_BIGENDIAN
63+
#endif
64+
/*ENDIANNESS SELECTION*/
4765

4866
#if (defined SHA1DC_FORCE_UNALIGNED_ACCESS || \
4967
defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || \

sha1dc/sha1.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ void SHA1DCInit(SHA1_CTX*);
6161
Function to enable safe SHA-1 hashing:
6262
Collision attacks are thwarted by hashing a detected near-collision block 3 times.
6363
Think of it as extending SHA-1 from 80-steps to 240-steps for such blocks:
64-
The best collision attacks against SHA-1 have complexity about 2^60,
65-
thus for 240-steps an immediate lower-bound for the best cryptanalytic attacks would be 2^180.
66-
An attacker would be better off using a generic birthday search of complexity 2^80.
64+
The best collision attacks against SHA-1 have complexity about 2^60,
65+
thus for 240-steps an immediate lower-bound for the best cryptanalytic attacks would be 2^180.
66+
An attacker would be better off using a generic birthday search of complexity 2^80.
6767
6868
Enabling safe SHA-1 hashing will result in the correct SHA-1 hash for messages where no collision attack was detected,
6969
but it will result in a different SHA-1 hash for messages where a collision attack was detected.

0 commit comments

Comments
 (0)