-#!/usr/bin/env perl
+#! /usr/bin/env perl
+# Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.
+#
+# 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
+
#
# ====================================================================
# Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
$code=<<___;
.text
+
+ .if .ASSEMBLER_VERSION<7000000
+ .asg 0,__TI_EABI__
+ .endif
.if __TI_EABI__
.nocmp
.asg AES_encrypt,_AES_encrypt
__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
-|| 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
-|| MVKL (AES_Te-_AES_encrypt),$TEA
-|| ADDKPC _AES_encrypt,B0
+|| MVKL (AES_Te-__encrypt),$TEA
+|| ADDKPC __encrypt,B0
[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
__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
-|| 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
-|| MVKL (AES_Td-_AES_decrypt),$TEA
-|| ADDKPC _AES_decrypt,B0
+|| MVKL (AES_Td-__decrypt),$TEA
+|| ADDKPC __decrypt,B0
[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
.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] 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
NOP
BNOP RA,5
-|| MVK -2,RET ; unknown bit lenght
+|| MVK -2,RET ; unknown bit length
|| MVK 0,B0 ; redundant
;;====================================================================
;;====================================================================
MVC B0,ILC
|| SUB B0,1,B0
- GMPY4 $K[0],A24,$Kx9[0] ; ·0x09
+ GMPY4 $K[0],A24,$Kx9[0] ; ·0x09
|| GMPY4 $K[1],A24,$Kx9[1]
|| MVK 0x00000D0D,A25
|| MVK 0x00000E0E,B25
|| MVKH 0x0D0D0000,A25
|| MVKH 0x0E0E0000,B25
- GMPY4 $K[0],B24,$KxB[0] ; ·0x0B
+ GMPY4 $K[0],B24,$KxB[0] ; ·0x0B
|| GMPY4 $K[1],B24,$KxB[1]
GMPY4 $K[2],B24,$KxB[2]
|| GMPY4 $K[3],B24,$KxB[3]
SPLOOP 11 ; InvMixColumns
;;====================================================================
- GMPY4 $K[0],A25,$KxD[0] ; ·0x0D
+ GMPY4 $K[0],A25,$KxD[0] ; ·0x0D
|| GMPY4 $K[1],A25,$KxD[1]
|| SWAP2 $Kx9[0],$Kx9[0] ; rotate by 16
|| SWAP2 $Kx9[1],$Kx9[1]
|| [B0] LDW *${KPA}[6],$K[2]
|| [B0] LDW *${KPB}[7],$K[3]
- GMPY4 $s[0],B25,$KxE[0] ; ·0x0E
+ GMPY4 $s[0],B25,$KxE[0] ; ·0x0E
|| GMPY4 $s[1],B25,$KxE[1]
|| XOR $Kx9[0],$KxB[0],$KxB[0]
|| XOR $Kx9[1],$KxB[1],$KxB[1]
XOR $KxE[0],$KxD[0],$KxE[0]
|| XOR $KxE[1],$KxD[1],$KxE[1]
-|| [B0] GMPY4 $K[0],A24,$Kx9[0] ; ·0x09
+|| [B0] GMPY4 $K[0],A24,$Kx9[0] ; ·0x09
|| [B0] GMPY4 $K[1],A24,$Kx9[1]
|| ADDAW $KPA,4,$KPA
XOR $KxE[2],$KxD[2],$KxE[2]
XOR $KxB[0],$KxE[0],$KxE[0]
|| XOR $KxB[1],$KxE[1],$KxE[1]
-|| [B0] GMPY4 $K[0],B24,$KxB[0] ; ·0x0B
+|| [B0] GMPY4 $K[0],B24,$KxB[0] ; ·0x0B
|| [B0] GMPY4 $K[1],B24,$KxB[1]
XOR $KxB[2],$KxE[2],$KxE[2]
|| XOR $KxB[3],$KxE[3],$KxE[3]