summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2019-04-29 15:28:28 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2019-06-27 06:45:36 +0200
commitd9f22bc61f1434dc6be9affbb59bab3725dc64ce (patch)
tree0990a43f86353d78c2f32bc936c7daae65f5bd51 /devel
parentbc36db1ebad82ec3da8cc30259bc293093c0aaab (diff)
downloadgnutls-d9f22bc61f1434dc6be9affbb59bab3725dc64ce.tar.gz
Align _gnutls_x86_cpuid_s as OPENSSL_ia32cap_P would be
We were not setting the third array member correctly, though this didn't have any impact to previous implementations as they did not rely on it. This also moves away from the custom implementation of cpuid (which was limited), and we now rely on the compiler's version. This effectively enables support for SHA_NI. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'devel')
-rw-r--r--devel/perlasm/cpuid-x86.pl62
l---------devel/perlasm/cpuid-x86.pl.license1
-rw-r--r--devel/perlasm/cpuid-x86_64.pl69
l---------devel/perlasm/cpuid-x86_64.pl.license1
4 files changed, 0 insertions, 133 deletions
diff --git a/devel/perlasm/cpuid-x86.pl b/devel/perlasm/cpuid-x86.pl
deleted file mode 100644
index a5541d4586..0000000000
--- a/devel/perlasm/cpuid-x86.pl
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/perl
-#
-# ====================================================================
-# Written by Nikos Mavrogiannopoulos
-# Placed under the LGPL
-# ====================================================================
-#
-
-$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
-push(@INC,"${dir}","${dir}../../crypto/perlasm");
-require "x86asm.pl";
-
-$output=pop;
-open STDOUT,">$output";
-
-&asm_init($ARGV[0],$0);
-
-&function_begin_B("gnutls_cpuid");
- &push ("ebp");
- &mov ("ebp", "esp");
- &sub ("esp", 12);
- &mov (&DWP(0,"esp"), "ebx");
- &mov ("eax",&DWP(8,"ebp"));
- &mov (&DWP(4,"esp"), "esi");
- &mov (&DWP(8,"esp"), "edi");
- &push ("ebx");
- &cpuid ();
- &mov ("edi", "ebx");
- &pop ("ebx");
- &mov ("esi","edx");
- &mov ("edx",&DWP(12,"ebp"));
- &mov (&DWP(0,"edx"), "eax");
- &mov ("eax",&DWP(16,"ebp"));
- &mov (&DWP(0,"eax"), "edi");
- &mov ("eax",&DWP(20,"ebp"));
- &mov (&DWP(0,"eax"), "ecx");
- &mov ("eax",&DWP(24,"ebp"));
- &mov (&DWP(0,"eax"), "esi");
- &mov ("ebx",&DWP(0,"esp"));
- &mov ("esi",&DWP(4,"esp"));
- &mov ("edi",&DWP(8,"esp"));
- &mov ("esp","ebp");
- &pop ("ebp");
- &ret ();
-&function_end_B("gnutls_cpuid");
-
-&function_begin_B("gnutls_have_cpuid");
- &pushf ();
- &pop ("eax");
- &or ("eax",0x200000);
- &push ("eax");
- &popf ();
- &pushf ();
- &pop ("eax");
- &and ("eax",0x200000);
- &ret ();
-&function_end_B("gnutls_have_cpuid");
-
-&asciz("CPUID for x86");
-&asm_finish();
-
-close STDOUT;
diff --git a/devel/perlasm/cpuid-x86.pl.license b/devel/perlasm/cpuid-x86.pl.license
deleted file mode 120000
index 6879a72497..0000000000
--- a/devel/perlasm/cpuid-x86.pl.license
+++ /dev/null
@@ -1 +0,0 @@
-license-gnutls.txt \ No newline at end of file
diff --git a/devel/perlasm/cpuid-x86_64.pl b/devel/perlasm/cpuid-x86_64.pl
deleted file mode 100644
index a6bb30ed7e..0000000000
--- a/devel/perlasm/cpuid-x86_64.pl
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env perl
-#
-# ====================================================================
-# Written by Nikos Mavrogiannopoulos
-# Based on e_padlock-x86_64
-# ====================================================================
-#
-
-$flavour = shift;
-$output = shift;
-if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
-
-$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
-
-$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
-( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or
-( $xlate="${dir}../../crypto/perlasm/x86_64-xlate.pl" and -f $xlate) or
-die "can't locate x86_64-xlate.pl";
-
-open STDOUT,"| $^X $xlate $flavour $output";
-
-$code=".text\n";
-
-($arg1,$arg2,$arg3,$arg4)=$win64?("%rcx","%rdx","%r8", "%r9") : # Win64 order
- ("%rdi","%rsi","%rdx","%rcx"); # Unix order
-
-
-$code.=<<___;
-.globl gnutls_cpuid
-.type gnutls_cpuid,\@function
-.align 16
-gnutls_cpuid:
- pushq %rbp
- movq %rsp, %rbp
- pushq %rbx
- movl %edi, -12(%rbp)
- movq %rsi, -24(%rbp)
- movq %rdx, -32(%rbp)
- movq %rcx, -40(%rbp)
- movq %r8, -48(%rbp)
- movl -12(%rbp), %eax
- movl %eax, -60(%rbp)
- movl -60(%rbp), %eax
- cpuid
- movl %edx, -56(%rbp)
- movl %ecx, %esi
- movl %eax, -52(%rbp)
- movq -24(%rbp), %rax
- movl -52(%rbp), %edx
- movl %edx, (%rax)
- movq -32(%rbp), %rax
- movl %ebx, (%rax)
- movq -40(%rbp), %rax
- movl %esi, (%rax)
- movq -48(%rbp), %rax
- movl -56(%rbp), %ecx
- movl %ecx, (%rax)
- popq %rbx
- leave
- ret
-.size gnutls_cpuid,.-gnutls_cpuid
-___
-
-$code =~ s/\`([^\`]*)\`/eval($1)/gem;
-
-print $code;
-
-close STDOUT;
-
diff --git a/devel/perlasm/cpuid-x86_64.pl.license b/devel/perlasm/cpuid-x86_64.pl.license
deleted file mode 120000
index 6879a72497..0000000000
--- a/devel/perlasm/cpuid-x86_64.pl.license
+++ /dev/null
@@ -1 +0,0 @@
-license-gnutls.txt \ No newline at end of file