Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc Backout...



details:   https://anonhg.NetBSD.org/src/rev/7e459131bc8f
branches:  trunk
changeset: 359675:7e459131bc8f
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Feb 20 13:14:02 2018 +0000

description:
Backout my over-eager backout - we need this for sparc64 building netbsd32
compat libs, but still lots of #ifdef's missing to make this ready for
usage by sparc.

diffstat:

 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/aes-sparcv9.S          |    22 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/aesfx-sparcv9.S        |  1180 ++
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/aest4-sparcv9.S        |   139 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/bn-sparcv8.S           |    10 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/cmllt4-sparcv9.S       |    42 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/des_enc-sparc.S        |   418 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/dest4-sparcv9.S        |    15 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/ec.inc                 |     6 +
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/ecp_nistz256-sparcv9.S |  5873 ++++++++++
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/ghash-sparcv9.S        |    19 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/poly1305-sparcv9.S     |   946 +
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/poly1305.inc           |     6 +
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/sparcv9-mont.S         |    95 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/sparcv9a-mont.S        |   148 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/vis3-mont.S            |    13 +-
 15 files changed, 8295 insertions(+), 637 deletions(-)

diffs (truncated from 10357 to 300 lines):

diff -r e2f7a585f769 -r 7e459131bc8f crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/aes-sparcv9.S
--- a/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/aes-sparcv9.S        Tue Feb 20 12:49:40 2018 +0000
+++ b/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/aes-sparcv9.S        Tue Feb 20 13:14:02 2018 +0000
@@ -1,3 +1,9 @@
+#include "sparc_arch.h"
+
+#ifdef  __arch64__
+.register      %g2,#scratch
+.register      %g3,#scratch
+#endif
 .section       ".text",#alloc,#execinstr
 
 .align 256
@@ -296,8 +302,8 @@
 .align 64
 .skip  16
 _sparcv9_AES_encrypt:
-       save    %sp,-112-16,%sp
-       stx     %i7,[%sp+0+112+0]       ! off-load return address
+       save    %sp,-STACK_FRAME-16,%sp
+       stx     %i7,[%sp+STACK_BIAS+STACK_FRAME+0]      ! off-load return address
        ld      [%i5+240],%i7
        ld      [%i5+0],%l4
        ld      [%i5+4],%l5                     !
@@ -585,7 +591,7 @@
        ldub    [%i7+%g5],%g5
                sll     %o0,16,%o0
                xor     %l0,%i0,%i0
-       ldx     [%sp+0+112+0],%i7       ! restore return address
+       ldx     [%sp+STACK_BIAS+STACK_FRAME+0],%i7      ! restore return address
        
                sll     %o1,8,%o1               !
                xor     %o0,%i0,%i0
@@ -623,7 +629,7 @@
        or      %o0,%o1,%g1
        andcc   %g1,3,%g0
        bnz,pn  %xcc,.Lunaligned_enc
-       save    %sp,-112,%sp
+       save    %sp,-STACK_FRAME,%sp
 
        ld      [%i0+0],%o0
        ld      [%i0+4],%o1
@@ -1028,8 +1034,8 @@
 .align 64
 .skip  16
 _sparcv9_AES_decrypt:
-       save    %sp,-112-16,%sp
-       stx     %i7,[%sp+0+112+0]       ! off-load return address
+       save    %sp,-STACK_FRAME-16,%sp
+       stx     %i7,[%sp+STACK_BIAS+STACK_FRAME+0]      ! off-load return address
        ld      [%i5+240],%i7
        ld      [%i5+0],%l4
        ld      [%i5+4],%l5                     !
@@ -1317,7 +1323,7 @@
        ldub    [%i7+%g5],%g5
                sll     %o0,16,%o0
                xor     %l0,%i0,%i0
-       ldx     [%sp+0+112+0],%i7       ! restore return address
+       ldx     [%sp+STACK_BIAS+STACK_FRAME+0],%i7      ! restore return address
        
                sll     %o1,8,%o1               !
                xor     %o0,%i0,%i0
@@ -1355,7 +1361,7 @@
        or      %o0,%o1,%g1
        andcc   %g1,3,%g0
        bnz,pn  %xcc,.Lunaligned_dec
-       save    %sp,-112,%sp
+       save    %sp,-STACK_FRAME,%sp
 
        ld      [%i0+0],%o0
        ld      [%i0+4],%o1
diff -r e2f7a585f769 -r 7e459131bc8f crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/aesfx-sparcv9.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/aesfx-sparcv9.S      Tue Feb 20 13:14:02 2018 +0000
@@ -0,0 +1,1180 @@
+#include "sparc_arch.h"
+
+#define LOCALS (STACK_BIAS+STACK_FRAME)
+
+.text
+
+.globl aes_fx_encrypt
+.align 32
+aes_fx_encrypt:
+       and             %o0, 7, %o4             ! is input aligned?
+       andn            %o0, 7, %o0
+       ldd             [%o2 +  0], %f6 ! round[0]
+       ldd             [%o2 +  8], %f8
+       mov             %o7, %g1
+       ld              [%o2 + 240], %o3
+
+1:     call            .+8
+       add             %o7, .Linp_align-1b, %o7
+
+       sll             %o4, 3, %o4
+       ldd             [%o0 + 0], %f0          ! load input
+       brz,pt          %o4, .Lenc_inp_aligned
+       ldd             [%o0 + 8], %f2
+
+       ldd             [%o7 + %o4], %f14       ! shift left params
+       ldd             [%o0 + 16], %f4
+       .word   0x81b81d62 !fshiftorx   %f0,%f2,%f14,%f0
+       .word   0x85b89d64 !fshiftorx   %f2,%f4,%f14,%f2
+
+.Lenc_inp_aligned:
+       ldd             [%o2 + 16], %f10        ! round[1]
+       ldd             [%o2 + 24], %f12
+
+       .word   0x81b00d86 !fxor        %f0,%f6,%f0             ! ^=round[0]
+       .word   0x85b08d88 !fxor        %f2,%f8,%f2
+       ldd             [%o2 + 32], %f6 ! round[2]
+       ldd             [%o2 + 40], %f8
+       add             %o2, 32, %o2
+       sub             %o3, 4, %o3
+
+.Loop_enc:
+       fmovd           %f0, %f4
+       .word   0x81b0920a !faesencx    %f2,%f10,%f0
+       .word   0x85b1120c !faesencx    %f4,%f12,%f2
+       ldd             [%o2 + 16], %f10
+       ldd             [%o2 + 24], %f12
+       add             %o2, 32, %o2
+
+       fmovd           %f0, %f4
+       .word   0x81b09206 !faesencx    %f2,%f6,%f0
+       .word   0x85b11208 !faesencx    %f4,%f8,%f2
+       ldd             [%o2 +  0], %f6
+       ldd             [%o2 +  8], %f8
+
+       brnz,a          %o3, .Loop_enc
+       sub             %o3, 2, %o3
+
+       andcc           %o1, 7, %o4             ! is output aligned?
+       andn            %o1, 7, %o1
+       mov             0xff, %o5
+       srl             %o5, %o4, %o5
+       add             %o7, 64, %o7
+       sll             %o4, 3, %o4
+
+       fmovd           %f0, %f4
+       .word   0x81b0920a !faesencx    %f2,%f10,%f0
+       .word   0x85b1120c !faesencx    %f4,%f12,%f2
+       ldd             [%o7 + %o4], %f14       ! shift right params
+
+       fmovd           %f0, %f4
+       .word   0x81b09246 !faesenclx   %f2,%f6,%f0
+       .word   0x85b11248 !faesenclx   %f4,%f8,%f2
+
+       bnz,pn          %icc, .Lenc_out_unaligned
+       mov             %g1, %o7
+
+       std             %f0, [%o1 + 0]
+       retl
+       std             %f2, [%o1 + 8]
+
+.align 16
+.Lenc_out_unaligned:
+       add             %o1, 16, %o0
+       orn             %g0, %o5, %o4
+       .word   0x89b81d60 !fshiftorx   %f0,%f0,%f14,%f4
+       .word   0x8db81d62 !fshiftorx   %f0,%f2,%f14,%f6
+       .word   0x91b89d62 !fshiftorx   %f2,%f2,%f14,%f8
+
+       stda            %f4, [%o1 + %o5]0xc0    ! partial store
+       std             %f6, [%o1 + 8]
+       stda            %f8, [%o0 + %o4]0xc0    ! partial store
+       retl
+       nop
+.type  aes_fx_encrypt,#function
+.size  aes_fx_encrypt,.-aes_fx_encrypt
+
+.globl aes_fx_decrypt
+.align 32
+aes_fx_decrypt:
+       and             %o0, 7, %o4             ! is input aligned?
+       andn            %o0, 7, %o0
+       ldd             [%o2 +  0], %f6 ! round[0]
+       ldd             [%o2 +  8], %f8
+       mov             %o7, %g1
+       ld              [%o2 + 240], %o3
+
+1:     call            .+8
+       add             %o7, .Linp_align-1b, %o7
+
+       sll             %o4, 3, %o4
+       ldd             [%o0 + 0], %f0          ! load input
+       brz,pt          %o4, .Ldec_inp_aligned
+       ldd             [%o0 + 8], %f2
+
+       ldd             [%o7 + %o4], %f14       ! shift left params
+       ldd             [%o0 + 16], %f4
+       .word   0x81b81d62 !fshiftorx   %f0,%f2,%f14,%f0
+       .word   0x85b89d64 !fshiftorx   %f2,%f4,%f14,%f2
+
+.Ldec_inp_aligned:
+       ldd             [%o2 + 16], %f10        ! round[1]
+       ldd             [%o2 + 24], %f12
+
+       .word   0x81b00d86 !fxor        %f0,%f6,%f0             ! ^=round[0]
+       .word   0x85b08d88 !fxor        %f2,%f8,%f2
+       ldd             [%o2 + 32], %f6 ! round[2]
+       ldd             [%o2 + 40], %f8
+       add             %o2, 32, %o2
+       sub             %o3, 4, %o3
+
+.Loop_dec:
+       fmovd           %f0, %f4
+       .word   0x81b0922a !faesdecx    %f2,%f10,%f0
+       .word   0x85b1122c !faesdecx    %f4,%f12,%f2
+       ldd             [%o2 + 16], %f10
+       ldd             [%o2 + 24], %f12
+       add             %o2, 32, %o2
+
+       fmovd           %f0, %f4
+       .word   0x81b09226 !faesdecx    %f2,%f6,%f0
+       .word   0x85b11228 !faesdecx    %f4,%f8,%f2
+       ldd             [%o2 +  0], %f6
+       ldd             [%o2 +  8], %f8
+
+       brnz,a          %o3, .Loop_dec
+       sub             %o3, 2, %o3
+
+       andcc           %o1, 7, %o4             ! is output aligned?
+       andn            %o1, 7, %o1
+       mov             0xff, %o5
+       srl             %o5, %o4, %o5
+       add             %o7, 64, %o7
+       sll             %o4, 3, %o4
+
+       fmovd           %f0, %f4
+       .word   0x81b0922a !faesdecx    %f2,%f10,%f0
+       .word   0x85b1122c !faesdecx    %f4,%f12,%f2
+       ldd             [%o7 + %o4], %f14       ! shift right params
+
+       fmovd           %f0, %f4
+       .word   0x81b09266 !faesdeclx   %f2,%f6,%f0
+       .word   0x85b11268 !faesdeclx   %f4,%f8,%f2
+
+       bnz,pn          %icc, .Ldec_out_unaligned
+       mov             %g1, %o7
+
+       std             %f0, [%o1 + 0]
+       retl
+       std             %f2, [%o1 + 8]
+
+.align 16
+.Ldec_out_unaligned:
+       add             %o1, 16, %o0
+       orn             %g0, %o5, %o4
+       .word   0x89b81d60 !fshiftorx   %f0,%f0,%f14,%f4
+       .word   0x8db81d62 !fshiftorx   %f0,%f2,%f14,%f6
+       .word   0x91b89d62 !fshiftorx   %f2,%f2,%f14,%f8
+
+       stda            %f4, [%o1 + %o5]0xc0    ! partial store
+       std             %f6, [%o1 + 8]
+       stda            %f8, [%o0 + %o4]0xc0    ! partial store
+       retl
+       nop
+.type  aes_fx_decrypt,#function
+.size  aes_fx_decrypt,.-aes_fx_decrypt
+.globl aes_fx_set_decrypt_key
+.align 32
+aes_fx_set_decrypt_key:
+       b               .Lset_encrypt_key
+       mov             -1, %o4
+       retl
+       nop
+.type  aes_fx_set_decrypt_key,#function
+.size  aes_fx_set_decrypt_key,.-aes_fx_set_decrypt_key
+
+.globl aes_fx_set_encrypt_key
+.align 32
+aes_fx_set_encrypt_key:
+       mov             1, %o4
+       nop
+.Lset_encrypt_key:
+       and             %o0, 7, %o3
+       andn            %o0, 7, %o0
+       sll             %o3, 3, %o3
+       mov             %o7, %g1
+
+1:     call            .+8
+       add             %o7, .Linp_align-1b, %o7
+
+       ldd             [%o7 + %o3], %f10       ! shift left params
+       mov             %g1, %o7
+
+       cmp             %o1, 192
+       ldd             [%o0 + 0], %f0
+       bl,pt           %icc, .L128
+       ldd             [%o0 + 8], %f2
+
+       be,pt           %icc, .L192
+       ldd             [%o0 + 16], %f4
+       brz,pt          %o3, .L256aligned
+       ldd             [%o0 + 24], %f6
+
+       ldd             [%o0 + 32], %f8
+       .word   0x81b81562 !fshiftorx   %f0,%f2,%f10,%f0
+       .word   0x85b89564 !fshiftorx   %f2,%f4,%f10,%f2



Home | Main Index | Thread Index | Old Index