1#include "s390x_arch.h" 2 3.text 4 5.globl gcm_gmult_4bit 6.align 32 7gcm_gmult_4bit: 8 stmg %r6,%r14,6*8(%r15) 9 10 aghi %r2,-1 11 lghi %r5,1 12 lghi %r13,120 13 larl %r14,rem_4bit 14 15 lg %r1,8+1(%r2) # Xi 16 j .Lgmult_shortcut 17.type gcm_gmult_4bit,@function 18.size gcm_gmult_4bit,(.-gcm_gmult_4bit) 19 20.globl gcm_ghash_4bit 21.align 32 22gcm_ghash_4bit: 23 larl %r1,OPENSSL_s390xcap_P 24 lg %r0,S390X_KIMD+8(%r1) # load second word of kimd capabilities 25 # vector 26 tmhh %r0,0x4000 # check for function 65 27 jz .Lsoft_ghash 28 lghi %r0,S390X_GHASH # function 65 29 la %r1,0(%r2) # H lies right after Xi in gcm128_context 30 .long 0xb93e0004 # kimd %r0,%r4 31 brc 1,.-4 # pay attention to "partial completion" 32 br %r14 33.align 32 34.Lsoft_ghash: 35 stmg %r6,%r14,6*8(%r15) 36 37 aghi %r2,-1 38 srlg %r5,%r5,4 39 lghi %r13,120 40 larl %r14,rem_4bit 41 42 lg %r1,8+1(%r2) # Xi 43 lg %r0,0+1(%r2) 44 lghi %r12,0 45.Louter: 46 xg %r0,0(%r4) # Xi ^= inp 47 xg %r1,8(%r4) 48 xgr %r0,%r12 49 stg %r1,8+1(%r2) 50 stg %r0,0+1(%r2) 51 52.Lgmult_shortcut: 53 lghi %r12,0xf0 54 sllg %r8,%r1,4 55 srlg %r10,%r1,8 # extract second byte 56 ngr %r8,%r12 57 lgr %r9,%r1 58 lghi %r11,14 59 ngr %r9,%r12 60 61 lg %r1,8(%r8,%r3) 62 lg %r0,0(%r8,%r3) 63 64 sllg %r8,%r10,4 65 sllg %r6,%r1,3 66 ngr %r8,%r12 67 ngr %r6,%r13 68 ngr %r10,%r12 69 70 sllg %r12,%r0,60 71 srlg %r1,%r1,4 72 srlg %r0,%r0,4 73 xg %r1,8(%r9,%r3) 74 xg %r0,0(%r9,%r3) 75 lgr %r9,%r10 76 sllg %r7,%r1,3 77 xgr %r1,%r12 78 ngr %r7,%r13 79 sllg %r12,%r0,60 80 j .Lghash_inner 81.align 16 82.Lghash_inner: 83 srlg %r1,%r1,4 84 srlg %r0,%r0,4 85 xg %r1,8(%r8,%r3) 86 llgc %r10,0(%r11,%r2) 87 xg %r0,0(%r8,%r3) 88 sllg %r8,%r10,4 89 xg %r0,0(%r6,%r14) 90 nill %r8,0xf0 91 sllg %r6,%r1,3 92 xgr %r1,%r12 93 ngr %r6,%r13 94 nill %r10,0xf0 95 96 sllg %r12,%r0,60 97 srlg %r1,%r1,4 98 srlg %r0,%r0,4 99 xg %r1,8(%r9,%r3) 100 xg %r0,0(%r9,%r3) 101 lgr %r9,%r10 102 xg %r0,0(%r7,%r14) 103 sllg %r7,%r1,3 104 xgr %r1,%r12 105 ngr %r7,%r13 106 sllg %r12,%r0,60 107 brct %r11,.Lghash_inner 108 109 srlg %r1,%r1,4 110 srlg %r0,%r0,4 111 xg %r1,8(%r8,%r3) 112 xg %r0,0(%r8,%r3) 113 sllg %r10,%r1,3 114 xg %r0,0(%r6,%r14) 115 xgr %r1,%r12 116 ngr %r10,%r13 117 118 sllg %r12,%r0,60 119 srlg %r1,%r1,4 120 srlg %r0,%r0,4 121 xg %r1,8(%r9,%r3) 122 xg %r0,0(%r9,%r3) 123 xgr %r1,%r12 124 xg %r0,0(%r7,%r14) 125 126 lg %r12,0(%r10,%r14) 127 la %r4,16(%r4) 128 sllg %r12,%r12,4 # correct last rem_4bit[rem] 129 brctg %r5,.Louter 130 131 xgr %r0,%r12 132 stg %r1,8+1(%r2) 133 stg %r0,0+1(%r2) 134 lmg %r6,%r14,6*8(%r15) 135 br %r14 136.type gcm_ghash_4bit,@function 137.size gcm_ghash_4bit,(.-gcm_ghash_4bit) 138 139.align 64 140rem_4bit: 141 .long 0,0,29491200,0,58982400,0,38141952,0 142 .long 117964800,0,113901568,0,76283904,0,88997888,0 143 .long 235929600,0,265420800,0,227803136,0,206962688,0 144 .long 152567808,0,148504576,0,177995776,0,190709760,0 145.type rem_4bit,@object 146.size rem_4bit,(.-rem_4bit) 147.string "GHASH for s390x, CRYPTOGAMS by <appro@openssl.org>" 148