]> git.ipfire.org Git - thirdparty/openssl.git/blame - ms/uplink-x86_64.pl
Don't downgrade keys in libssl
[thirdparty/openssl.git] / ms / uplink-x86_64.pl
CommitLineData
e0a65194
RS
1#! /usr/bin/env perl
2# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
3#
c7fcbc09 4# Licensed under the Apache License 2.0 (the "License"). You may not use
e0a65194
RS
5# this file except in compliance with the License. You can obtain a copy
6# in the file LICENSE in the source distribution or at
7# https://www.openssl.org/source/license.html
4c048211 8
1aa89a7a
RL
9# $output is the last argument if it looks like a file (it has an extension)
10$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
11
4c048211 12$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
1aa89a7a
RL
13open OUT,"| \"$^X\" \"${dir}../crypto/perlasm/x86_64-xlate.pl\" \"$output\""
14 or die "can't call ${dir}../crypto/perlasm/x86_64-xlate.pl: $!";
46bf83f0 15*STDOUT=*OUT;
4c048211
AP
16push(@INC,"${dir}.");
17
18require "uplink-common.pl";
19
20$prefix="_lazy";
21
22print <<___;
23.text
24.extern OPENSSL_Uplink
be01f79d 25.globl OPENSSL_UplinkTable
4c048211
AP
26___
27for ($i=1;$i<=$N;$i++) {
28print <<___;
29.type $prefix${i},\@abi-omnipotent
30.align 16
31$prefix${i}:
32 .byte 0x48,0x83,0xEC,0x28 # sub rsp,40
33 mov %rcx,48(%rsp)
34 mov %rdx,56(%rsp)
35 mov %r8,64(%rsp)
36 mov %r9,72(%rsp)
37 lea OPENSSL_UplinkTable(%rip),%rcx
38 mov \$$i,%rdx
39 call OPENSSL_Uplink
40 mov 48(%rsp),%rcx
41 mov 56(%rsp),%rdx
42 mov 64(%rsp),%r8
43 mov 72(%rsp),%r9
4c048211 44 lea OPENSSL_UplinkTable(%rip),%rax
be01f79d 45 add \$40,%rsp
4c048211
AP
46 jmp *8*$i(%rax)
47$prefix${i}_end:
48.size $prefix${i},.-$prefix${i}
49___
50}
51print <<___;
52.data
4c048211
AP
53OPENSSL_UplinkTable:
54 .quad $N
55___
56for ($i=1;$i<=$N;$i++) { print " .quad $prefix$i\n"; }
57print <<___;
be01f79d
AP
58.section .pdata,"r"
59.align 4
4c048211
AP
60___
61for ($i=1;$i<=$N;$i++) {
62print <<___;
be01f79d 63 .rva $prefix${i},$prefix${i}_end,${prefix}_unwind_info
4c048211
AP
64___
65}
66print <<___;
be01f79d
AP
67.section .xdata,"r"
68.align 8
4c048211
AP
69${prefix}_unwind_info:
70 .byte 0x01,0x04,0x01,0x00
71 .byte 0x04,0x42,0x00,0x00
72___
be01f79d
AP
73
74close STDOUT;