From 5538091f0d52c82fd77c60ef2e7807883341cb1b Mon Sep 17 00:00:00 2001 From: Jacob Nevins Date: Sat, 2 Feb 2019 11:12:37 +0000 Subject: [PATCH] Allow x86 SHA intrinsics on GCC 4.9 too. Pavel says there was no specific reason they avoided it, and compiling with Debian Jessie's GCC 4.9.2 produces a binary that I've no reason to believe won't work, although I haven't tested it on a real or emulated CPU that supports the instructions. --- sshsh256.c | 3 ++- sshsha.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sshsh256.c b/sshsh256.c index 03ff6ab1..cb138f63 100644 --- a/sshsh256.c +++ b/sshsh256.c @@ -22,7 +22,8 @@ # define HW_SHA256 HW_SHA256_NI # endif #elif defined(__GNUC__) -# if (__GNUC__ >= 5) && (defined(__x86_64__) || defined(__i386)) +# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) && \ + (defined(__x86_64__) || defined(__i386)) # define HW_SHA256 HW_SHA256_NI # endif #elif defined (_MSC_VER) diff --git a/sshsha.c b/sshsha.c index d59f1f3d..3c09d4c5 100644 --- a/sshsha.c +++ b/sshsha.c @@ -22,7 +22,8 @@ # define HW_SHA1 HW_SHA1_NI # endif #elif defined(__GNUC__) -# if (__GNUC__ >= 5) && (defined(__x86_64__) || defined(__i386)) +# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) && \ + (defined(__x86_64__) || defined(__i386)) # define HW_SHA1 HW_SHA1_NI # endif #elif defined (_MSC_VER)