]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix nasm version check for sm3 & sm4 perlasm files
authorknut st. osmundsen <bird-nasm@anduin.net>
Tue, 9 Jun 2026 06:49:39 +0000 (08:49 +0200)
committerTomas Mraz <tomas@openssl.foundation>
Mon, 13 Jul 2026 15:46:52 +0000 (17:46 +0200)
Make the check correctly handle versions such as '3.00rc8'.
It was incorrectly expecting major.minor.patch.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
MergeDate: Mon Jul 13 15:48:03 2026
(Merged from https://github.com/openssl/openssl/pull/31420)

crypto/sm3/asm/sm3-x86_64.pl
crypto/sm4/asm/sm4-x86_64.pl

index d3c9d0541a9de3d43a6a8f6532aeccb175ef36a2..2f6ddf5616819a1e314a18fcfe0099d0cac2b943 100755 (executable)
@@ -35,8 +35,8 @@ if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`
 }
 
 if (!$avx2_sm3_ni && $win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) &&
-          `nasm -v 2>&1` =~ /NASM version ([2-9])\.([0-9]+)\.([0-9]+)/) {
-    my ($major, $minor, $patch) = ($1, $2, $3);
+          `nasm -v 2>&1` =~ /NASM version ([2-9])\.([0-9]+)(?:\.([0-9]+))?/) {
+    my ($major, $minor, $patch) = ($1, $2, defined($3) ? $3 : 0);
     $avx2_sm3_ni = ($major > 2) || ($major == 2 && $minor > 10); # minimal avx2 supported version, binary translation for SM3 instructions (sub sm3op) is used
        $avx2_sm3_ni_native = ($major > 2) || ($major == 2 && $minor > 16) || ($major == 2 && $minor == 16 && $patch >= 2); # support added at NASM 2.16.02
 }
index 9fc40fb96a4991e6fd8b7ce2404d52e07ba4ad7d..f5b485968ef08ec9f48a95cbae1554d5db160a4e 100644 (file)
@@ -35,8 +35,8 @@ if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`
 }
 
 if (!$avx2_sm4_ni && $win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) &&
-       `nasm -v 2>&1` =~ /NASM version ([2-9])\.([0-9]+)\.([0-9]+)/) {
-    my ($major, $minor, $patch) = ($1, $2, $3);
+       `nasm -v 2>&1` =~ /NASM version ([2-9])\.([0-9]+)(?:\.([0-9]+))?/) {
+    my ($major, $minor, $patch) = ($1, $2, defined($3) ? $3 : 0);
     $avx2_sm4_ni = ($major > 2) || ($major == 2 && $minor > 10); # minimal avx2 supported version, binary translation for SM4 instructions (sub sm4op) is used
     $avx2_sm4_ni_native = ($major > 2) || ($major == 2 && $minor > 16) || ($major == 2 && $minor == 16 && $patch >= 2); # support added at NASM 2.16.02
 }