C64x+ assembly pack: make it work with older toolchain.
authorAndy Polyakov <appro@openssl.org>
Sun, 4 May 2014 14:38:32 +0000 (16:38 +0200)
committerAndy Polyakov <appro@openssl.org>
Sun, 4 May 2014 14:38:32 +0000 (16:38 +0200)
crypto/aes/asm/aes-c64xplus.pl
crypto/bn/asm/bn-c64xplus.asm
crypto/bn/asm/c64xplus-gf2m.pl
crypto/c64xpluscpuid.pl
crypto/modes/asm/ghash-c64xplus.pl
crypto/sha/asm/sha1-c64xplus.pl
crypto/sha/asm/sha256-c64xplus.pl
crypto/sha/asm/sha512-c64xplus.pl

index cc14ae3..24b2ba4 100644 (file)
@@ -44,6 +44,10 @@ open STDOUT,">$output";
 
 $code=<<___;
        .text
 
 $code=<<___;
        .text
+
+       .if     .ASSEMBLER_VERSION<7000000
+       .asg    0,__TI_EABI__
+       .endif
        .if     __TI_EABI__
        .nocmp
        .asg    AES_encrypt,_AES_encrypt
        .if     __TI_EABI__
        .nocmp
        .asg    AES_encrypt,_AES_encrypt
@@ -85,18 +89,18 @@ _AES_encrypt:
 __encrypt:
        .if     __TI_EABI__
    [B2]        LDNDW   *INP++,A9:A8                    ; load input
 __encrypt:
        .if     __TI_EABI__
    [B2]        LDNDW   *INP++,A9:A8                    ; load input
-||     MVKL    \$PCR_OFFSET(AES_Te,_AES_encrypt),$TEA
-||     ADDKPC  _AES_encrypt,B0
+||     MVKL    \$PCR_OFFSET(AES_Te,__encrypt),$TEA
+||     ADDKPC  __encrypt,B0
    [B2]        LDNDW   *INP++,B9:B8
    [B2]        LDNDW   *INP++,B9:B8
-||     MVKH    \$PCR_OFFSET(AES_Te,_AES_encrypt),$TEA
+||     MVKH    \$PCR_OFFSET(AES_Te,__encrypt),$TEA
 ||     ADD     0,KEY,$KPA
 ||     ADD     4,KEY,$KPB
        .else
    [B2]        LDNDW   *INP++,A9:A8                    ; load input
 ||     ADD     0,KEY,$KPA
 ||     ADD     4,KEY,$KPB
        .else
    [B2]        LDNDW   *INP++,A9:A8                    ; load input
-||     MVKL    (AES_Te-_AES_encrypt),$TEA
-||     ADDKPC  _AES_encrypt,B0
+||     MVKL    (AES_Te-__encrypt),$TEA
+||     ADDKPC  __encrypt,B0
    [B2]        LDNDW   *INP++,B9:B8
    [B2]        LDNDW   *INP++,B9:B8
-||     MVKH    (AES_Te-_AES_encrypt),$TEA
+||     MVKH    (AES_Te-__encrypt),$TEA
 ||     ADD     0,KEY,$KPA
 ||     ADD     4,KEY,$KPB
        .endif
 ||     ADD     0,KEY,$KPA
 ||     ADD     4,KEY,$KPB
        .endif
@@ -297,18 +301,18 @@ _AES_decrypt:
 __decrypt:
        .if     __TI_EABI__
    [B2]        LDNDW   *INP++,A9:A8                    ; load input
 __decrypt:
        .if     __TI_EABI__
    [B2]        LDNDW   *INP++,A9:A8                    ; load input
-||     MVKL    \$PCR_OFFSET(AES_Td,_AES_decrypt),$TEA
-||     ADDKPC  _AES_decrypt,B0
+||     MVKL    \$PCR_OFFSET(AES_Td,__decrypt),$TEA
+||     ADDKPC  __decrypt,B0
    [B2]        LDNDW   *INP++,B9:B8
    [B2]        LDNDW   *INP++,B9:B8
-||     MVKH    \$PCR_OFFSET(AES_Td,_AES_decrypt),$TEA
+||     MVKH    \$PCR_OFFSET(AES_Td,__decrypt),$TEA
 ||     ADD     0,KEY,$KPA
 ||     ADD     4,KEY,$KPB
        .else
    [B2]        LDNDW   *INP++,A9:A8                    ; load input
 ||     ADD     0,KEY,$KPA
 ||     ADD     4,KEY,$KPB
        .else
    [B2]        LDNDW   *INP++,A9:A8                    ; load input
-||     MVKL    (AES_Td-_AES_decrypt),$TEA
-||     ADDKPC  _AES_decrypt,B0
+||     MVKL    (AES_Td-__decrypt),$TEA
+||     ADDKPC  __decrypt,B0
    [B2]        LDNDW   *INP++,B9:B8
    [B2]        LDNDW   *INP++,B9:B8
-||     MVKH    (AES_Td-_AES_decrypt),$TEA
+||     MVKH    (AES_Td-__decrypt),$TEA
 ||     ADD     0,KEY,$KPA
 ||     ADD     4,KEY,$KPB
        .endif
 ||     ADD     0,KEY,$KPA
 ||     ADD     4,KEY,$KPB
        .endif
@@ -546,16 +550,16 @@ __set_encrypt_key:
        .if     __TI_EABI__
    [A0]        ADD     0,KEY,$KPA
 || [A0]        ADD     4,KEY,$KPB
        .if     __TI_EABI__
    [A0]        ADD     0,KEY,$KPA
 || [A0]        ADD     4,KEY,$KPB
-|| [A0]        MVKL    \$PCR_OFFSET(AES_Te4,_AES_set_encrypt_key),$TEA
-|| [A0]        ADDKPC  _AES_set_encrypt_key,B6
-   [A0]        MVKH    \$PCR_OFFSET(AES_Te4,_AES_set_encrypt_key),$TEA
+|| [A0]        MVKL    \$PCR_OFFSET(AES_Te4,__set_encrypt_key),$TEA
+|| [A0]        ADDKPC  __set_encrypt_key,B6
+   [A0]        MVKH    \$PCR_OFFSET(AES_Te4,__set_encrypt_key),$TEA
    [A0]        ADD     B6,$TEA,$TEA                    ; AES_Te4
        .else
    [A0]        ADD     0,KEY,$KPA
 || [A0]        ADD     4,KEY,$KPB
    [A0]        ADD     B6,$TEA,$TEA                    ; AES_Te4
        .else
    [A0]        ADD     0,KEY,$KPA
 || [A0]        ADD     4,KEY,$KPB
-|| [A0]        MVKL    (AES_Te4-_AES_set_encrypt_key),$TEA
-|| [A0]        ADDKPC  _AES_set_encrypt_key,B6
-   [A0]        MVKH    (AES_Te4-_AES_set_encrypt_key),$TEA
+|| [A0]        MVKL    (AES_Te4-__set_encrypt_key),$TEA
+|| [A0]        ADDKPC  __set_encrypt_key,B6
+   [A0]        MVKH    (AES_Te4-__set_encrypt_key),$TEA
    [A0]        ADD     B6,$TEA,$TEA                    ; AES_Te4
        .endif
        NOP
    [A0]        ADD     B6,$TEA,$TEA                    ; AES_Te4
        .endif
        NOP
index f07b09e..7cd5881 100644 (file)
 ;; SPLOOPs spin at ... 2*n cycles [plus epilogue].
 ;;====================================================================
        .text
 ;; SPLOOPs spin at ... 2*n cycles [plus epilogue].
 ;;====================================================================
        .text
+
+       .if     .ASSEMBLER_VERSION<7000000
+       .asg    0,__TI_EABI__
+       .endif
        .if     __TI_EABI__
        .asg    bn_mul_add_words,_bn_mul_add_words
        .asg    bn_mul_words,_bn_mul_words
        .if     __TI_EABI__
        .asg    bn_mul_add_words,_bn_mul_add_words
        .asg    bn_mul_words,_bn_mul_words
index 1b3ecc2..e4aa4e4 100644 (file)
@@ -107,6 +107,10 @@ ___
 }
 $code.=<<___;
        .text
 }
 $code.=<<___;
        .text
+
+       .if     .ASSEMBLER_VERSION<7000000
+       .asg    0,__TI_EABI__
+       .endif
        .if     __TI_EABI__
        .asg    bn_GF2m_mul_2x2,_bn_GF2m_mul_2x2
        .endif
        .if     __TI_EABI__
        .asg    bn_GF2m_mul_2x2,_bn_GF2m_mul_2x2
        .endif
index 0ee0a4e..2feb4e3 100644 (file)
@@ -6,6 +6,10 @@ open STDOUT,">$output";
 
 $code.=<<___;
        .text
 
 $code.=<<___;
        .text
+
+       .if     .ASSEMBLER_VERSION<7000000
+       .asg    0,__TI_EABI__
+       .endif
        .if     __TI_EABI__
        .asg    OPENSSL_rdtsc,_OPENSSL_rdtsc
        .asg    OPENSSL_cleanse,_OPENSSL_cleanse
        .if     __TI_EABI__
        .asg    OPENSSL_rdtsc,_OPENSSL_rdtsc
        .asg    OPENSSL_cleanse,_OPENSSL_cleanse
index 409b0d6..a465b42 100644 (file)
@@ -35,6 +35,10 @@ open STDOUT,">$output";
 
 $code.=<<___;
        .text
 
 $code.=<<___;
        .text
+
+       .if     .ASSEMBLER_VERSION<7000000
+       .asg    0,__TI_EABI__
+       .endif
        .if     __TI_EABI__
        .asg    gcm_gmult_1bit,_gcm_gmult_1bit
        .asg    gcm_gmult_4bit,_gcm_gmult_4bit
        .if     __TI_EABI__
        .asg    gcm_gmult_1bit,_gcm_gmult_1bit
        .asg    gcm_gmult_4bit,_gcm_gmult_4bit
index 456f80a..ad8b172 100644 (file)
@@ -38,6 +38,10 @@ open STDOUT,">$output";
 
 $code=<<___;
        .text
 
 $code=<<___;
        .text
+
+       .if     .ASSEMBLER_VERSION<7000000
+       .asg    0,__TI_EABI__
+       .endif
        .if     __TI_EABI__
        .asg    sha1_block_data_order,_sha1_block_data_order
        .endif
        .if     __TI_EABI__
        .asg    sha1_block_data_order,_sha1_block_data_order
        .endif
index 798f783..2f775ac 100644 (file)
@@ -38,6 +38,10 @@ open STDOUT,">$output";
 
 $code.=<<___;
        .text
 
 $code.=<<___;
        .text
+
+       .if     .ASSEMBLER_VERSION<7000000
+       .asg    0,__TI_EABI__
+       .endif
        .if     __TI_EABI__
        .nocmp
        .asg    sha256_block_data_order,_sha256_block_data_order
        .if     __TI_EABI__
        .nocmp
        .asg    sha256_block_data_order,_sha256_block_data_order
@@ -54,24 +58,25 @@ $code.=<<___;
 
        .global _sha256_block_data_order
 _sha256_block_data_order:
 
        .global _sha256_block_data_order
 _sha256_block_data_order:
+__sha256_block:
        .asmfunc stack_usage(64)
        MV      $NUM,A0                         ; reassign $NUM
 ||     MVK     -64,B0
   [!A0]        BNOP    RA                              ; if ($NUM==0) return;
 || [A0]        STW     FP,*SP--[16]                    ; save frame pointer and alloca(64)
 || [A0]        MV      SP,FP
        .asmfunc stack_usage(64)
        MV      $NUM,A0                         ; reassign $NUM
 ||     MVK     -64,B0
   [!A0]        BNOP    RA                              ; if ($NUM==0) return;
 || [A0]        STW     FP,*SP--[16]                    ; save frame pointer and alloca(64)
 || [A0]        MV      SP,FP
-   [A0]        ADDKPC  _sha256_block_data_order,B2
+   [A0]        ADDKPC  __sha256_block,B2
 || [A0]        AND     B0,SP,SP                        ; align stack at 64 bytes
        .if     __TI_EABI__
    [A0]        MVK     0x00404,B1
 || [A0]        AND     B0,SP,SP                        ; align stack at 64 bytes
        .if     __TI_EABI__
    [A0]        MVK     0x00404,B1
-|| [A0]        MVKL    \$PCR_OFFSET(K256,_sha256_block_data_order),$K256
+|| [A0]        MVKL    \$PCR_OFFSET(K256,__sha256_block),$K256
    [A0]        MVKH    0x50000,B1
    [A0]        MVKH    0x50000,B1
-|| [A0]        MVKH    \$PCR_OFFSET(K256,_sha256_block_data_order),$K256
+|| [A0]        MVKH    \$PCR_OFFSET(K256,__sha256_block),$K256
        .else
    [A0]        MVK     0x00404,B1
        .else
    [A0]        MVK     0x00404,B1
-|| [A0]        MVKL    (K256-_sha256_block_data_order),$K256
+|| [A0]        MVKL    (K256-__sha256_block),$K256
    [A0]        MVKH    0x50000,B1
    [A0]        MVKH    0x50000,B1
-|| [A0]        MVKH    (K256-_sha256_block_data_order),$K256
+|| [A0]        MVKH    (K256-__sha256_block),$K256
        .endif
    [A0]        MVC     B1,AMR                          ; setup circular addressing
 || [A0]        MV      SP,$Xia
        .endif
    [A0]        MVC     B1,AMR                          ; setup circular addressing
 || [A0]        MV      SP,$Xia
index 77a6252..71a1e80 100644 (file)
@@ -46,6 +46,10 @@ open STDOUT,">$output";
 
 $code.=<<___;
        .text
 
 $code.=<<___;
        .text
+
+       .if     .ASSEMBLER_VERSION<7000000
+       .asg    0,__TI_EABI__
+       .endif
        .if     __TI_EABI__
        .nocmp
        .asg    sha512_block_data_order,_sha512_block_data_order
        .if     __TI_EABI__
        .nocmp
        .asg    sha512_block_data_order,_sha512_block_data_order
@@ -65,6 +69,7 @@ $code.=<<___;
 
        .global _sha512_block_data_order
 _sha512_block_data_order:
 
        .global _sha512_block_data_order
 _sha512_block_data_order:
+__sha512_block:
        .asmfunc stack_usage(40+128)
        MV      $NUM,A0                         ; reassign $NUM
 ||     MVK     -128,B0
        .asmfunc stack_usage(40+128)
        MV      $NUM,A0                         ; reassign $NUM
 ||     MVK     -128,B0
@@ -81,15 +86,15 @@ _sha512_block_data_order:
 || [A0]        ADD     B0,SP,SP                        ; alloca(128)
        .if     __TI_EABI__
    [A0]        AND     B0,SP,SP                        ; align stack at 128 bytes
 || [A0]        ADD     B0,SP,SP                        ; alloca(128)
        .if     __TI_EABI__
    [A0]        AND     B0,SP,SP                        ; align stack at 128 bytes
-|| [A0]        ADDKPC  _sha512_block_data_order,B1
-|| [A0]        MVKL    \$PCR_OFFSET(K512,_sha512_block_data_order),$K512
-   [A0]        MVKH    \$PCR_OFFSET(K512,_sha512_block_data_order),$K512
+|| [A0]        ADDKPC  __sha512_block,B1
+|| [A0]        MVKL    \$PCR_OFFSET(K512,__sha512_block),$K512
+   [A0]        MVKH    \$PCR_OFFSET(K512,__sha512_block),$K512
 || [A0]        SUBAW   SP,2,SP                         ; reserve two words above buffer
        .else
    [A0]        AND     B0,SP,SP                        ; align stack at 128 bytes
 || [A0]        SUBAW   SP,2,SP                         ; reserve two words above buffer
        .else
    [A0]        AND     B0,SP,SP                        ; align stack at 128 bytes
-|| [A0]        ADDKPC  _sha512_block_data_order,B1
-|| [A0]        MVKL    (K512-_sha512_block_data_order),$K512
-   [A0]        MVKH    (K512-_sha512_block_data_order),$K512
+|| [A0]        ADDKPC  __sha512_block,B1
+|| [A0]        MVKL    (K512-__sha512_block),$K512
+   [A0]        MVKH    (K512-__sha512_block),$K512
 || [A0]        SUBAW   SP,2,SP                         ; reserve two words above buffer
        .endif
        ADDAW   SP,3,$Xilo
 || [A0]        SUBAW   SP,2,SP                         ; reserve two words above buffer
        .endif
        ADDAW   SP,3,$Xilo