From 4c78bc05c44ca16daaf5a568eedd0fee700f5de8 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Mon, 16 Mar 2009 13:32:38 +0000 Subject: [PATCH] Make SPARC assembler Pirify-friendly (Purify can't cope with certain PIC constructs). --- crypto/aes/asm/aes-sparcv9.pl | 24 +++++++-------- crypto/des/asm/des_enc.m4 | 55 +++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 37 deletions(-) diff --git a/crypto/aes/asm/aes-sparcv9.pl b/crypto/aes/asm/aes-sparcv9.pl index 095711ca71..76828ee767 100755 --- a/crypto/aes/asm/aes-sparcv9.pl +++ b/crypto/aes/asm/aes-sparcv9.pl @@ -522,10 +522,10 @@ AES_encrypt: ld [%i0+8],%o2 ld [%i0+12],%o3 - mov %i2,%o5 - nop -1: call _sparcv9_AES_encrypt +1: call .+8 sub %o7,1b-AES_Te,%o4 + call _sparcv9_AES_encrypt + mov %i2,%o5 st %o0,[%i1+0] st %o1,[%i1+4] @@ -582,10 +582,10 @@ AES_encrypt: or %l7,%l6,%l6 or %l4,%l6,%o3 - mov %i2,%o5 - nop -1: call _sparcv9_AES_encrypt +1: call .+8 sub %o7,1b-AES_Te,%o4 + call _sparcv9_AES_encrypt + mov %i2,%o5 srl %o0,24,%l0 srl %o0,16,%l1 @@ -1068,10 +1068,10 @@ AES_decrypt: ld [%i0+8],%o2 ld [%i0+12],%o3 - mov %i2,%o5 - nop -1: call _sparcv9_AES_decrypt +1: call .+8 sub %o7,1b-AES_Td,%o4 + call _sparcv9_AES_decrypt + mov %i2,%o5 st %o0,[%i1+0] st %o1,[%i1+4] @@ -1128,10 +1128,10 @@ AES_decrypt: or %l7,%l6,%l6 or %l4,%l6,%o3 - mov %i2,%o5 - nop -1: call _sparcv9_AES_decrypt +1: call .+8 sub %o7,1b-AES_Td,%o4 + call _sparcv9_AES_decrypt + mov %i2,%o5 srl %o0,24,%l0 srl %o0,16,%l1 diff --git a/crypto/des/asm/des_enc.m4 b/crypto/des/asm/des_enc.m4 index a114a92aaf..3280595478 100644 --- a/crypto/des/asm/des_enc.m4 +++ b/crypto/des/asm/des_enc.m4 @@ -1180,8 +1180,11 @@ DES_encrypt1: save %sp, FRAME, %sp - call .PIC.me.up - mov .PIC.me.up-(.-4),out0 + sethi %hi(.PIC.DES_SPtrans-1f),global1 + or global1,%lo(.PIC.DES_SPtrans-1f),global1 +1: call .+8 + add %o7,global1,global1 + sub global1,.PIC.DES_SPtrans-.des_and,out2 ld [in0], in5 ! left cmp in2, 0 ! enc @@ -1238,8 +1241,11 @@ DES_encrypt2: save %sp, FRAME, %sp - call .PIC.me.up - mov .PIC.me.up-(.-4),out0 + sethi %hi(.PIC.DES_SPtrans-1f),global1 + or global1,%lo(.PIC.DES_SPtrans-1f),global1 +1: call .+8 + add %o7,global1,global1 + sub global1,.PIC.DES_SPtrans-.des_and,out2 ! Set sbox address 1 to 6 and rotate halfs 3 left ! Errors caught by destest? Yes. Still? *NO* @@ -1353,8 +1359,11 @@ DES_encrypt3: save %sp, FRAME, %sp - call .PIC.me.up - mov .PIC.me.up-(.-4),out0 + sethi %hi(.PIC.DES_SPtrans-1f),global1 + or global1,%lo(.PIC.DES_SPtrans-1f),global1 +1: call .+8 + add %o7,global1,global1 + sub global1,.PIC.DES_SPtrans-.des_and,out2 ld [in0], in5 ! left add in2, 120, in4 ! ks2 @@ -1395,8 +1404,11 @@ DES_decrypt3: save %sp, FRAME, %sp - call .PIC.me.up - mov .PIC.me.up-(.-4),out0 + sethi %hi(.PIC.DES_SPtrans-1f),global1 + or global1,%lo(.PIC.DES_SPtrans-1f),global1 +1: call .+8 + add %o7,global1,global1 + sub global1,.PIC.DES_SPtrans-.des_and,out2 ld [in0], in5 ! left add in3, 120, in4 ! ks3 @@ -1425,19 +1437,6 @@ DES_decrypt3: .DES_decrypt3.end: .size DES_decrypt3,.DES_decrypt3.end-DES_decrypt3 -! input: out0 offset between .PIC.me.up and caller -! output: out0 pointer to .PIC.me.up -! out2 pointer to .des_and -! global1 pointer to DES_SPtrans - .align 32 -.PIC.me.up: - add out0,%o7,out0 ! pointer to .PIC.me.up - sethi %hi(.des_and-.PIC.me.up),out2 - or out2,%lo(.des_and-.PIC.me.up),out2 - add out0,out2,out2 - retl - add out2,.PIC.DES_SPtrans-.des_and,global1 - ! void DES_ncbc_encrypt(input, output, length, schedule, ivec, enc) ! ***************************************************************** @@ -1454,8 +1453,11 @@ DES_ncbc_encrypt: define({OUTPUT}, { [%sp+BIAS+ARG0+1*ARGSZ] }) define({IVEC}, { [%sp+BIAS+ARG0+4*ARGSZ] }) - call .PIC.me.up - mov .PIC.me.up-(.-4),out0 + sethi %hi(.PIC.DES_SPtrans-1f),global1 + or global1,%lo(.PIC.DES_SPtrans-1f),global1 +1: call .+8 + add %o7,global1,global1 + sub global1,.PIC.DES_SPtrans-.des_and,out2 cmp in5, 0 ! enc @@ -1676,8 +1678,11 @@ DES_ede3_cbc_encrypt: define({KS2}, { [%sp+BIAS+ARG0+4*ARGSZ] }) define({KS3}, { [%sp+BIAS+ARG0+5*ARGSZ] }) - call .PIC.me.up - mov .PIC.me.up-(.-4),out0 + sethi %hi(.PIC.DES_SPtrans-1f),global1 + or global1,%lo(.PIC.DES_SPtrans-1f),global1 +1: call .+8 + add %o7,global1,global1 + sub global1,.PIC.DES_SPtrans-.des_and,out2 LDPTR [%fp+BIAS+ARG0+7*ARGSZ], local3 ! enc LDPTR [%fp+BIAS+ARG0+6*ARGSZ], local4 ! ivec -- 2.25.1