Add the OSSL_PROVIDER_get_capabilities() API function
[oweals/openssl.git] / crypto / x86cpuid.pl
index 1266d7634c152777f98896f4ca89a86c679ee2ea..a7bcb27e262d6a2933d4a5fe18fded409afc2fa5 100644 (file)
@@ -1,7 +1,7 @@
 #! /usr/bin/env perl
-# Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved.
 #
-# Licensed under the OpenSSL license (the "License").  You may not use
+# Licensed under the Apache License 2.0 (the "License").  You may not use
 # this file except in compliance with the License.  You can obtain a copy
 # in the file LICENSE in the source distribution or at
 # https://www.openssl.org/source/license.html
@@ -10,9 +10,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC, "${dir}perlasm", "perlasm");
 require "x86asm.pl";
 
-$output = pop;
-open OUT,">$output";
-*STDOUT=*OUT;
+$output = pop and open STDOUT,">$output";
 
 &asm_init($ARGV[0]);
 
@@ -110,7 +108,7 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
        &cmp    ("ebp",0);
        &jne    (&label("notintel"));
        &or     ("edx",1<<30);          # set reserved bit#30 on Intel CPUs
-       &and    (&HB("eax"),15);        # familiy ID
+       &and    (&HB("eax"),15);        # family ID
        &cmp    (&HB("eax"),15);        # P4?
        &jne    (&label("notintel"));
        &or     ("edx",1<<20);          # set reserved bit#20 to engage RC4_CHAR
@@ -453,18 +451,6 @@ my $max = "ebp";
 
 sub gen_random {
 my $rdop = shift;
-&function_begin_B("OPENSSL_ia32_${rdop}");
-       &mov    ("ecx",8);
-&set_label("loop");
-       &${rdop}("eax");
-       &jc     (&label("break"));
-       &loop   (&label("loop"));
-&set_label("break");
-       &cmp    ("eax",0);
-       &cmove  ("eax","ecx");
-       &ret    ();
-&function_end_B("OPENSSL_ia32_${rdop}");
-
 &function_begin_B("OPENSSL_ia32_${rdop}_bytes");
        &push   ("edi");
        &push   ("ebx");
@@ -502,6 +488,7 @@ my $rdop = shift;
        &jnz    (&label("tail"));
 
 &set_label("done");
+       &xor    ("edx","edx");          # Clear random value from registers
        &pop    ("ebx");
        &pop    ("edi");
        &ret    ();
@@ -517,4 +504,4 @@ my $rdop = shift;
 
 &asm_finish();
 
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";