X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=crypto%2Fs390xcpuid.pl;h=790fbc2c80579a19303396d2661a0f496ce8d477;hb=ce9b996409fbd8a34ccb21dc5785216d7e6a830b;hp=ea95dd286dd20303f35f83d71654a610883b57c1;hpb=3c7d0945b655a71a026bd0d855943037d8ce2bec;p=openssl.git diff --git a/crypto/s390xcpuid.pl b/crypto/s390xcpuid.pl index ea95dd286d..790fbc2c80 100755 --- a/crypto/s390xcpuid.pl +++ b/crypto/s390xcpuid.pl @@ -1,7 +1,7 @@ #! /usr/bin/env perl # Copyright 2009-2018 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 @@ -38,7 +38,26 @@ OPENSSL_s390x_facilities: stg %r0,S390X_STFLE+8(%r4) # wipe capability vectors stg %r0,S390X_STFLE+16(%r4) stg %r0,S390X_STFLE+24(%r4) - stg %r0,S390X_KIMD(%r4) + + .long 0xb2b04000 # stfle 0(%r4) + brc 8,.Ldone + lghi %r0,1 + .long 0xb2b04000 # stfle 0(%r4) + brc 8,.Ldone + lghi %r0,2 + .long 0xb2b04000 # stfle 0(%r4) +.Ldone: + br $ra +.size OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities + +.globl OPENSSL_s390x_functions +.type OPENSSL_s390x_functions,\@function +.align 16 +OPENSSL_s390x_functions: + lghi %r0,0 + larl %r4,OPENSSL_s390xcap_P + + stg %r0,S390X_KIMD(%r4) # wipe capability vectors stg %r0,S390X_KIMD+8(%r4) stg %r0,S390X_KLMD(%r4) stg %r0,S390X_KLMD+8(%r4) @@ -59,14 +78,6 @@ OPENSSL_s390x_facilities: stg %r0,S390X_KMA(%r4) stg %r0,S390X_KMA+8(%r4) - .long 0xb2b04000 # stfle 0(%r4) - brc 8,.Ldone - lghi %r0,1 - .long 0xb2b04000 # stfle 0(%r4) - brc 8,.Ldone - lghi %r0,2 - .long 0xb2b04000 # stfle 0(%r4) -.Ldone: lmg %r2,%r3,S390X_STFLE(%r4) tmhl %r2,0x4000 # check for message-security-assist jz .Lret @@ -123,12 +134,20 @@ OPENSSL_s390x_facilities: .Lret: br $ra -.size OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities +.size OPENSSL_s390x_functions,.-OPENSSL_s390x_functions .globl OPENSSL_rdtsc .type OPENSSL_rdtsc,\@function .align 16 OPENSSL_rdtsc: + larl %r4,OPENSSL_s390xcap_P + tm S390X_STFLE+3(%r4),0x40 # check for store-clock-fast facility + jz .Lstck + + .long 0xb27cf010 # stckf 16($sp) + lg %r2,16($sp) + br $ra +.Lstck: stck 16($sp) lg %r2,16($sp) br $ra @@ -254,6 +273,48 @@ OPENSSL_vx_probe: .size OPENSSL_vx_probe,.-OPENSSL_vx_probe ___ +{ +################ +# void s390x_kimd(const unsigned char *in, size_t len, unsigned int fc, +# void *param) +my ($in,$len,$fc,$param) = map("%r$_",(2..5)); +$code.=<<___; +.globl s390x_kimd +.type s390x_kimd,\@function +.align 16 +s390x_kimd: + llgfr %r0,$fc + lgr %r1,$param + + .long 0xb93e0002 # kimd %r0,%r2 + brc 1,.-4 # pay attention to "partial completion" + + br $ra +.size s390x_kimd,.-s390x_kimd +___ +} + +{ +################ +# void s390x_klmd(const unsigned char *in, size_t inlen, unsigned char *out, +# size_t outlen, unsigned int fc, void *param) +my ($in,$inlen,$out,$outlen,$fc) = map("%r$_",(2..6)); +$code.=<<___; +.globl s390x_klmd +.type s390x_klmd,\@function +.align 32 +s390x_klmd: + llgfr %r0,$fc + l${g} %r1,$stdframe($sp) + + .long 0xb93f0042 # klmd %r4,%r2 + brc 1,.-4 # pay attention to "partial completion" + + br $ra +.size s390x_klmd,.-s390x_klmd +___ +} + ################ # void s390x_km(const unsigned char *in, size_t len, unsigned char *out, # unsigned int fc, void *param) @@ -275,6 +336,69 @@ s390x_km: ___ } +################ +# void s390x_kmac(const unsigned char *in, size_t len, unsigned int fc, +# void *param) +{ +my ($in,$len,$fc,$param) = map("%r$_",(2..5)); +$code.=<<___; +.globl s390x_kmac +.type s390x_kmac,\@function +.align 16 +s390x_kmac: + lr %r0,$fc + l${g}r %r1,$param + + .long 0xb91e0002 # kmac %r0,$in + brc 1,.-4 # pay attention to "partial completion" + + br $ra +.size s390x_kmac,.-s390x_kmac +___ +} + +################ +# void s390x_kmo(const unsigned char *in, size_t len, unsigned char *out, +# unsigned int fc, void *param) +{ +my ($in,$len,$out,$fc,$param) = map("%r$_",(2..6)); +$code.=<<___; +.globl s390x_kmo +.type s390x_kmo,\@function +.align 16 +s390x_kmo: + lr %r0,$fc + l${g}r %r1,$param + + .long 0xb92b0042 # kmo $out,$in + brc 1,.-4 # pay attention to "partial completion" + + br $ra +.size s390x_kmo,.-s390x_kmo +___ +} + +################ +# void s390x_kmf(const unsigned char *in, size_t len, unsigned char *out, +# unsigned int fc, void *param) +{ +my ($in,$len,$out,$fc,$param) = map("%r$_",(2..6)); +$code.=<<___; +.globl s390x_kmf +.type s390x_kmf,\@function +.align 16 +s390x_kmf: + lr %r0,$fc + l${g}r %r1,$param + + .long 0xb92a0042 # kmf $out,$in + brc 1,.-4 # pay attention to "partial completion" + + br $ra +.size s390x_kmf,.-s390x_kmf +___ +} + ################ # void s390x_kma(const unsigned char *aad, size_t alen, # const unsigned char *in, size_t len,