mirror of
https://github.com/libtom/libtomcrypt
synced 2026-08-25 20:26:07 -04:00
Clean-up SHA1.
* we try to keep ifdef's at one place * the last real x86 was launched in 2007, while the SHA instructions were only introduced in 2013, so IMO we can safely assume that there's no need to handle non-x86-64 instruction sets. * some minor fixes Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
parent
902be86b8c
commit
fddbae2bbb
4 changed files with 16 additions and 28 deletions
|
|
@ -67,7 +67,7 @@ static LTC_INLINE int s_sha1_x86_is_supported(void)
|
|||
if(regs[0] >= 7) {
|
||||
s_x86_cpuid(regs, 1);
|
||||
sse2 = ((((unsigned int)(regs[3])) >> 26) & 1u) != 0; /* SSE2, leaf 1, edx, bit 26 */
|
||||
ssse3 = ((((unsigned int)(regs[2])) >> 9) & 1u) != 0; /* SSES3, leaf 1, ecx, bit 9 */
|
||||
ssse3 = ((((unsigned int)(regs[2])) >> 9) & 1u) != 0; /* SSSE3, leaf 1, ecx, bit 9 */
|
||||
sse41 = ((((unsigned int)(regs[2])) >> 19) & 1u) != 0; /* SSE4.1, leaf 1, ecx, bit 19 */
|
||||
s_x86_cpuid(regs, 7);
|
||||
sha = ((((unsigned int)(regs[1])) >> 29) & 1u) != 0; /* SHA, leaf 7, ebx, bit 29 */
|
||||
|
|
|
|||
|
|
@ -307,8 +307,13 @@ typedef unsigned long ltc_mp_digit;
|
|||
#define LTC_HAVE_CTZL_BUILTIN
|
||||
#endif
|
||||
|
||||
#if !defined(LTC_NO_AES_NI) && (defined(__x86_64__) || defined(_M_X64))
|
||||
#define LTC_AES_NI
|
||||
#if (defined(__x86_64__) || defined(_M_X64))
|
||||
#if !defined(LTC_NO_AES_NI)
|
||||
#define LTC_AES_NI
|
||||
#endif
|
||||
#if !defined(LTC_NO_SHA1_X86)
|
||||
#define LTC_SHA1_X86
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
|
|
|||
|
|
@ -61,17 +61,6 @@
|
|||
#define LTC_NO_PROTOTYPES
|
||||
#endif
|
||||
|
||||
#if \
|
||||
(defined _MSC_VER && defined _M_X64 && defined _M_AMD64) || \
|
||||
(defined __amd64__)
|
||||
#define LTC_ARCH_X64
|
||||
#endif
|
||||
#if \
|
||||
(defined _MSC_VER && defined _M_IX86 && !defined _M_I86 && !defined M_I86) || \
|
||||
(defined __i386__)
|
||||
#define LTC_ARCH_X86
|
||||
#endif
|
||||
|
||||
/* shortcut to disable automatic inclusion */
|
||||
#if defined LTC_NOTHING && !defined LTC_EASY
|
||||
#define LTC_NO_CIPHERS
|
||||
|
|
@ -100,9 +89,6 @@
|
|||
|
||||
#define LTC_NO_HASHES
|
||||
#define LTC_SHA1
|
||||
#if defined LTC_ARCH_X86 || defined LTC_ARCH_X64
|
||||
#define LTC_SHA1_X86
|
||||
#endif
|
||||
#define LTC_SHA3
|
||||
#define LTC_SHA512
|
||||
#define LTC_SHA512_256
|
||||
|
|
@ -297,9 +283,6 @@
|
|||
#endif
|
||||
#define LTC_TIGER
|
||||
#define LTC_SHA1
|
||||
#if defined LTC_ARCH_X86 || defined LTC_ARCH_X64
|
||||
#define LTC_SHA1_X86
|
||||
#endif
|
||||
#define LTC_MD5
|
||||
#define LTC_MD4
|
||||
#define LTC_MD2
|
||||
|
|
|
|||
|
|
@ -423,18 +423,17 @@ extern const struct ltc_hash_descriptor sha224_desc;
|
|||
#endif
|
||||
|
||||
#ifdef LTC_SHA1
|
||||
int sha1_c_init(hash_state * md);
|
||||
int sha1_c_process(hash_state * md, const unsigned char *in, unsigned long inlen);
|
||||
int sha1_c_done(hash_state * md, unsigned char *out);
|
||||
int sha1_c_test(void);
|
||||
extern const struct ltc_hash_descriptor sha1_portable_desc;
|
||||
|
||||
int sha1_init(hash_state * md);
|
||||
int sha1_process(hash_state * md, const unsigned char *in, unsigned long inlen);
|
||||
int sha1_done(hash_state * md, unsigned char *out);
|
||||
int sha1_test(void);
|
||||
extern const struct ltc_hash_descriptor sha1_desc;
|
||||
#endif
|
||||
|
||||
int sha1_c_init(hash_state * md);
|
||||
int sha1_c_process(hash_state * md, const unsigned char *in, unsigned long inlen);
|
||||
int sha1_c_done(hash_state * md, unsigned char *out);
|
||||
int sha1_c_test(void);
|
||||
extern const struct ltc_hash_descriptor sha1_portable_desc;
|
||||
|
||||
#ifdef LTC_SHA1_X86
|
||||
int sha1_x86_init(hash_state * md);
|
||||
|
|
@ -442,7 +441,8 @@ int sha1_x86_process(hash_state * md, const unsigned char *in, unsigned long inl
|
|||
int sha1_x86_done(hash_state * md, unsigned char *out);
|
||||
int sha1_x86_test(void);
|
||||
extern const struct ltc_hash_descriptor sha1_x86_desc;
|
||||
#endif
|
||||
#endif /* LTC_SHA1_X86 */
|
||||
#endif /* LTC_SHA1 */
|
||||
|
||||
#ifdef LTC_BLAKE2S
|
||||
extern const struct ltc_hash_descriptor blake2s_256_desc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue