]>
git.ipfire.org Git - thirdparty/openssl.git/blob - crypto/riscv64cpuid.pl
2 # Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the Apache License 2.0 (the "License"). You may not use
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
10 # $output is the last argument if it looks like a file (it has an extension)
11 # $flavour is the first argument if it doesn't look like a file
12 $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m
|\
.\w
+$| ?
pop : undef;
13 $flavour = $#ARGV >= 0 && $ARGV[0] !~ m
|\
.| ?
shift : undef;
15 $output and open STDOUT
,">$output";
18 my ($in_a,$in_b,$len,$x,$temp1,$temp2) = ('a0','a1','a2','t0','t1','t2');
20 ################################################################################
21 # int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len)
22 ################################################################################
26 .type CRYPTO_memcmp
,\
@function
29 beqz
$len,2f
# len == 0
36 xor $temp1,$temp1,$temp2
45 my ($ptr,$len,$temp1,$temp2) = ('a0','a1','t0','t1');
47 ################################################################################
48 # void OPENSSL_cleanse(void *ptr, size_t len)
49 ################################################################################
52 .globl OPENSSL_cleanse
53 .type OPENSSL_cleanse
,\
@function
55 beqz
$len,2f
# len == 0, return
57 bnez
$temp1,3f
# len > 15
59 1: # Store <= 15 individual bytes
67 3: # Store individual bytes until we are aligned
75 4: # Store aligned dwords
81 bge
$len,$temp2,4b
# if len>=8 loop
82 bnez
$len,1b
# if len<8 and len != 0, store remaining bytes
89 close STDOUT
or die "error closing STDOUT: $!";