Reset the HKDF state between operations
[openssl.git] / ms / uplink-x86_64.pl
index 80807ce05b4e618137a4ffa3a6a89bd930090dc0..1f244504cdffc43df5e8578a526f71dc3757079e 100755 (executable)
@@ -1,8 +1,15 @@
-#!/usr/bin/env perl
+#! /usr/bin/env perl
+# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the OpenSSL license (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
 
-$output=shift;
+$output=pop;
 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
-open STDOUT,"| $^X ${dir}../crypto/perlasm/x86_64-xlate.pl $output";
+open OUT,"| \"$^X\" \"${dir}../crypto/perlasm/x86_64-xlate.pl\" \"$output\"";
+*STDOUT=*OUT;
 push(@INC,"${dir}.");
 
 require "uplink-common.pl";
@@ -12,6 +19,7 @@ $prefix="_lazy";
 print <<___;
 .text
 .extern        OPENSSL_Uplink
+.globl OPENSSL_UplinkTable
 ___
 for ($i=1;$i<=$N;$i++) {
 print <<___;
@@ -30,8 +38,8 @@ $prefix${i}:
        mov     56(%rsp),%rdx
        mov     64(%rsp),%r8
        mov     72(%rsp),%r9
-       add     \$40,%rsp
        lea     OPENSSL_UplinkTable(%rip),%rax
+       add     \$40,%rsp
        jmp     *8*$i(%rax)
 $prefix${i}_end:
 .size  $prefix${i},.-$prefix${i}
@@ -39,24 +47,25 @@ ___
 }
 print <<___;
 .data
-.globl  OPENSSL_UplinkTable
 OPENSSL_UplinkTable:
         .quad   $N
 ___
 for ($i=1;$i<=$N;$i++) {   print "      .quad   $prefix$i\n";   }
 print <<___;
-.section       .pdata
+.section       .pdata,"r"
+.align         4
 ___
 for ($i=1;$i<=$N;$i++) {
 print <<___;
-       .long   $prefix${i}
-       .long   $prefix${i}_end
-       .long   ${prefix}_unwind_info
+       .rva    $prefix${i},$prefix${i}_end,${prefix}_unwind_info
 ___
 }
 print <<___;
-.section       .xdata
+.section       .xdata,"r"
+.align         8
 ${prefix}_unwind_info:
        .byte   0x01,0x04,0x01,0x00
        .byte   0x04,0x42,0x00,0x00
 ___
+
+close STDOUT;