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/mips Handle m...



details:   https://anonhg.NetBSD.org/src/rev/afe9d597d492
branches:  trunk
changeset: 830355:afe9d597d492
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Mar 05 16:43:50 2018 +0000

description:
Handle mips64 properly.

diffstat:

 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/Makefile          |    14 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes-mips.S        |    12 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes-mips64.S      |  1835 ++++++
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc            |     2 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc        |     2 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/mips-mont.S       |     2 +
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/mips-mont64.S     |   282 +
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/mips64.S          |  2158 +++++++
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305-mips64.S |   321 +
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc      |    10 +
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc           |     5 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha1-mips64.S     |  2979 ++++++++++
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha512-mips.S     |     3 +-
 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha512-mips64.S   |  2979 ++++++++++
 14 files changed, 10586 insertions(+), 18 deletions(-)

diffs (truncated from 10751 to 300 lines):

diff -r 3ff3244aa4bc -r afe9d597d492 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/Makefile
--- a/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/Makefile      Mon Mar 05 12:42:28 2018 +0000
+++ b/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/Makefile      Mon Mar 05 16:43:50 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.1 2018/03/04 00:59:44 christos Exp $
+#      $NetBSD: Makefile,v 1.2 2018/03/05 16:43:50 christos Exp $
 
 .include "bsd.own.mk"
 
@@ -6,13 +6,17 @@
 .include "${NETBSDSRCDIR}/crypto/Makefile.openssl"
 
 regen:
-       # poly is mips64 only
        for i in $$(find ${OPENSSLSRC} -name \*mips\*.pl); \
        do \
                case $$i in \
-               (*poly*);; \
+               (*poly*) perl -I${OPENSSLSRC}/crypto/perlasm \
+                           -I${OPENSSLSRC}/crypto/bn/asm $$i 64 /dev/stdout \
+                           > $$(basename $$i .pl)64.S;; \
                (*) perl -I${OPENSSLSRC}/crypto/perlasm \
-               -I${OPENSSLSRC}/crypto/bn/asm $$i linux /dev/stdout \
-               > $$(basename $$i .pl).S;; \
+                       -I${OPENSSLSRC}/crypto/bn/asm $$i o32 /dev/stdout \
+                       > $$(basename $$i .pl).S; \
+                   perl -I${OPENSSLSRC}/crypto/perlasm \
+                       -I${OPENSSLSRC}/crypto/bn/asm $$i 64 /dev/stdout \
+                       > $$(basename $$i .pl)64.S;; \
                esac; \
        done
diff -r 3ff3244aa4bc -r afe9d597d492 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes-mips.S
--- a/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes-mips.S    Mon Mar 05 12:42:28 2018 +0000
+++ b/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes-mips.S    Mon Mar 05 16:43:50 2018 +0000
@@ -507,6 +507,7 @@
        .frame  $29,64,$31
        .mask   0xc0ff0000,-4
        .set    noreorder
+       .cpload $25
        sub $29,64
        sw      $31,64-1*4($29)
        sw      $30,64-2*4($29)
@@ -518,8 +519,6 @@
        sw      $18,64-8*4($29)
        sw      $17,64-9*4($29)
        sw      $16,64-10*4($29)
-       .cplocal        $7
-       .cpsetup        $25,$0,AES_encrypt
        .set    reorder
        la      $7,AES_Te               # PIC-ified 'load address'
 
@@ -1050,6 +1049,7 @@
        .frame  $29,64,$31
        .mask   0xc0ff0000,-4
        .set    noreorder
+       .cpload $25
        sub $29,64
        sw      $31,64-1*4($29)
        sw      $30,64-2*4($29)
@@ -1061,8 +1061,6 @@
        sw      $18,64-8*4($29)
        sw      $17,64-9*4($29)
        sw      $16,64-10*4($29)
-       .cplocal        $7
-       .cpsetup        $25,$0,AES_decrypt
        .set    reorder
        la      $7,AES_Td               # PIC-ified 'load address'
 
@@ -1359,11 +1357,10 @@
        .frame  $29,32,$31
        .mask   0xc0000000,-4
        .set    noreorder
+       .cpload $25
        sub $29,32
        sw      $31,32-1*4($29)
        sw      $30,32-2*4($29)
-       .cplocal        $7
-       .cpsetup        $25,$0,AES_set_encrypt_key
        .set    reorder
        la      $7,AES_Te4              # PIC-ified 'load address'
 
@@ -1383,11 +1380,10 @@
        .frame  $29,32,$31
        .mask   0xc0000000,-4
        .set    noreorder
+       .cpload $25
        sub $29,32
        sw      $31,32-1*4($29)
        sw      $30,32-2*4($29)
-       .cplocal        $7
-       .cpsetup        $25,$0,AES_set_decrypt_key
        .set    reorder
        la      $7,AES_Te4              # PIC-ified 'load address'
 
diff -r 3ff3244aa4bc -r afe9d597d492 crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes-mips64.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes-mips64.S  Mon Mar 05 16:43:50 2018 +0000
@@ -0,0 +1,1835 @@
+.text
+#ifdef OPENSSL_FIPSCANISTER
+# include <openssl/fipssyms.h>
+#endif
+
+#if defined(__mips_smartmips) && !defined(_MIPS_ARCH_MIPS32R2)
+#define _MIPS_ARCH_MIPS32R2
+#endif
+
+#if !defined(__mips_eabi) && (!defined(__vxworks) || defined(__pic__))
+.option        pic2
+#endif
+.set   noat
+.align 5
+.ent   _mips_AES_encrypt
+_mips_AES_encrypt:
+       .frame  $29,0,$31
+       .set    reorder
+       lw      $12,0($6)
+       lw      $13,4($6)
+       lw      $14,8($6)
+       lw      $15,12($6)
+       lw      $30,240($6)
+       dadd $3,$6,16
+
+       xor     $8,$12
+       xor     $9,$13
+       xor     $10,$14
+       xor     $11,$15
+
+       sub     $30,1
+#if defined(__mips_smartmips)
+       ext     $1,$9,8,8
+.Loop_enc:
+       ext     $2,$10,8,8
+       ext     $24,$11,8,8
+       ext     $25,$8,8,8
+       lwxs    $12,$1($7)              # Te1[s1>>16]
+       ext     $1,$10,16,8
+       lwxs    $13,$2($7)              # Te1[s2>>16]
+       ext     $2,$11,16,8
+       lwxs    $14,$24($7)             # Te1[s3>>16]
+       ext     $24,$8,16,8
+       lwxs    $15,$25($7)             # Te1[s0>>16]
+       ext     $25,$9,16,8
+
+       lwxs    $16,$1($7)              # Te2[s2>>8]
+       ext     $1,$11,24,8
+       lwxs    $17,$2($7)              # Te2[s3>>8]
+       ext     $2,$8,24,8
+       lwxs    $18,$24($7)             # Te2[s0>>8]
+       ext     $24,$9,24,8
+       lwxs    $19,$25($7)             # Te2[s1>>8]
+       ext     $25,$10,24,8
+
+       lwxs    $20,$1($7)              # Te3[s3]
+       ext     $1,$8,0,8
+       lwxs    $21,$2($7)              # Te3[s0]
+       ext     $2,$9,0,8
+       lwxs    $22,$24($7)             # Te3[s1]
+       ext     $24,$10,0,8
+       lwxs    $23,$25($7)             # Te3[s2]
+       ext     $25,$11,0,8
+
+       rotr    $12,$12,24
+       rotr    $13,$13,24
+       rotr    $14,$14,24
+       rotr    $15,$15,24
+
+       rotr    $16,$16,16
+       rotr    $17,$17,16
+       rotr    $18,$18,16
+       rotr    $19,$19,16
+
+       xor     $12,$16
+       lwxs    $16,$1($7)              # Te0[s0>>24]
+       xor     $13,$17
+       lwxs    $17,$2($7)              # Te0[s1>>24]
+       xor     $14,$18
+       lwxs    $18,$24($7)             # Te0[s2>>24]
+       xor     $15,$19
+       lwxs    $19,$25($7)             # Te0[s3>>24]
+
+       rotr    $20,$20,8
+       lw      $8,0($3)
+       rotr    $21,$21,8
+       lw      $9,4($3)
+       rotr    $22,$22,8
+       lw      $10,8($3)
+       rotr    $23,$23,8
+       lw      $11,12($3)
+
+       xor     $12,$20
+       xor     $13,$21
+       xor     $14,$22
+       xor     $15,$23
+
+       xor     $12,$16
+       xor     $13,$17
+       xor     $14,$18
+       xor     $15,$19
+
+       sub     $30,1
+       dadd $3,16
+       xor     $8,$12
+       xor     $9,$13
+       xor     $10,$14
+       xor     $11,$15
+       .set    noreorder
+       bnez    $30,.Loop_enc
+       ext     $1,$9,8,8
+
+       srl     $1,$9,6
+#else
+       srl     $1,$9,6
+.Loop_enc:
+       srl     $2,$10,6
+       srl     $24,$11,6
+       srl     $25,$8,6
+       and     $1,0x3fc
+       and     $2,0x3fc
+       and     $24,0x3fc
+       and     $25,0x3fc
+       dadd $1,$7
+       dadd $2,$7
+       dadd $24,$7
+       dadd $25,$7
+#if defined(_MIPS_ARCH_MIPS32R2) || defined(_MIPS_ARCH_MIPS64R2)
+       lw      $12,0($1)               # Te1[s1>>16]
+       srl     $1,$10,14
+       lw      $13,0($2)               # Te1[s2>>16]
+       srl     $2,$11,14
+       lw      $14,0($24)              # Te1[s3>>16]
+       srl     $24,$8,14
+       lw      $15,0($25)              # Te1[s0>>16]
+       srl     $25,$9,14
+#else
+       lwl     $12,2($1)               # Te1[s1>>16]
+       lwl     $13,2($2)               # Te1[s2>>16]
+       lwl     $14,2($24)              # Te1[s3>>16]
+       lwl     $15,2($25)              # Te1[s0>>16]
+       lwr     $12,3($1)               # Te1[s1>>16]
+       srl     $1,$10,14
+       lwr     $13,3($2)               # Te1[s2>>16]
+       srl     $2,$11,14
+       lwr     $14,3($24)              # Te1[s3>>16]
+       srl     $24,$8,14
+       lwr     $15,3($25)              # Te1[s0>>16]
+       srl     $25,$9,14
+#endif
+       and     $1,0x3fc
+       and     $2,0x3fc
+       and     $24,0x3fc
+       and     $25,0x3fc
+       dadd $1,$7
+       dadd $2,$7
+       dadd $24,$7
+       dadd $25,$7
+#if defined(_MIPS_ARCH_MIPS32R2) || defined(_MIPS_ARCH_MIPS64R2)
+       rotr    $12,$12,24
+       rotr    $13,$13,24
+       rotr    $14,$14,24
+       rotr    $15,$15,24
+# if defined(_MIPSEL)
+       lw      $16,0($1)               # Te2[s2>>8]
+       srl     $1,$11,22
+       lw      $17,0($2)               # Te2[s3>>8]
+       srl     $2,$8,22
+       lw      $18,0($24)              # Te2[s0>>8]
+       srl     $24,$9,22
+       lw      $19,0($25)              # Te2[s1>>8]
+       srl     $25,$10,22
+
+       and     $1,0x3fc
+       and     $2,0x3fc
+       and     $24,0x3fc
+       and     $25,0x3fc
+       dadd $1,$7
+       dadd $2,$7
+       dadd $24,$7
+       dadd $25,$7
+       lw      $20,0($1)               # Te3[s3]
+       dins $1,$8,2,8
+       lw      $21,0($2)               # Te3[s0]
+       dins $2,$9,2,8
+       lw      $22,0($24)              # Te3[s1]
+       dins $24,$10,2,8
+       lw      $23,0($25)              # Te3[s2]
+       dins $25,$11,2,8
+# else
+       lw      $16,0($1)               # Te2[s2>>8]
+       dins $1,$11,2,8
+       lw      $17,0($2)               # Te2[s3>>8]
+       dins $2,$8,2,8
+       lw      $18,0($24)              # Te2[s0>>8]
+       dins $24,$9,2,8
+       lw      $19,0($25)              # Te2[s1>>8]
+       dins $25,$10,2,8
+
+       lw      $20,0($1)               # Te3[s3]
+       sll     $1,$8,2
+       lw      $21,0($2)               # Te3[s0]



Home | Main Index | Thread Index | Old Index