SYNC // 07e0
+ KM R2, R4 // b92e0024
+ KMC R2, R6 // b92f0026
+ KLMD R2, R8 // b93f0028
+ KIMD R0, R4 // b93e0004
+
// vector add and sub instructions
VAB V3, V4, V4 // e743400000f3
VAH V3, V4, V4 // e743400010f3
// macros
ACLEAR
+ // crypto
+ AKM
+ AKMC
+ AKLMD
+ AKIMD
+
// vector
AVA
AVAB
"STCKE",
"STCKF",
"CLEAR",
+ "KM",
+ "KMC",
+ "KLMD",
+ "KIMD",
"VA",
"VAB",
"VAH",
// 2 byte no-operation
{i: 66, as: ANOPH},
+ // crypto instructions
+
+ // KM
+ {i: 124, as: AKM, a1: C_REG, a6: C_REG},
+
// vector instructions
// VRX store
opset(AVFMSDB, r)
opset(AWFMSDB, r)
opset(AVPERM, r)
+ case AKM:
+ opset(AKMC, r)
+ opset(AKLMD, r)
+ opset(AKIMD, r)
}
}
}
op, _, _ := vop(p.As)
m4 := c.regoff(&p.From)
zVRRc(op, uint32(p.To.Reg), uint32(p.Reg), uint32(p.GetFrom3().Reg), 0, 0, uint32(m4), asm)
+
+ case 124:
+ var opcode uint32
+ switch p.As {
+ default:
+ c.ctxt.Diag("unexpected opcode %v", p.As)
+ case AKM, AKMC, AKLMD:
+ if p.From.Reg == REG_R0 {
+ c.ctxt.Diag("input must not be R0 in %v", p)
+ }
+ if p.From.Reg&1 != 0 {
+ c.ctxt.Diag("input must be even register in %v", p)
+ }
+ if p.To.Reg == REG_R0 {
+ c.ctxt.Diag("second argument must not be R0 in %v", p)
+ }
+ if p.To.Reg&1 != 0 {
+ c.ctxt.Diag("second argument must be even register in %v", p)
+ }
+ if p.As == AKM {
+ opcode = op_KM
+ } else if p.As == AKMC {
+ opcode = op_KMC
+ } else {
+ opcode = op_KLMD
+ }
+ case AKIMD:
+ if p.To.Reg == REG_R0 {
+ c.ctxt.Diag("second argument must not be R0 in %v", p)
+ }
+ if p.To.Reg&1 != 0 {
+ c.ctxt.Diag("second argument must be even register in %v", p)
+ }
+ opcode = op_KIMD
+ }
+ zRRE(opcode, uint32(p.From.Reg), uint32(p.To.Reg), asm)
}
}
MOVD length+32(FP), R5
MOVD c+0(FP), R0
loop:
- WORD $0xB92E0024 // cipher message (KM)
+ KM R2, R4 // cipher message (KM)
BVS loop // branch back if interrupted
XOR R0, R0
RET
MOVD length+40(FP), R5
MOVD c+0(FP), R0
loop:
- WORD $0xB92F0024 // cipher message with chaining (KMC)
+ KMC R2, R4 // cipher message with chaining (KMC)
BVS loop // branch back if interrupted
XOR R0, R0
MVC $16, 0(R1), 0(R8) // update iv
STMG R4, R7, (R1)
LMG data+16(FP), R2, R3 // R2=base, R3=len
loop:
- WORD $0xB93E0002 // compute intermediate message digest (KIMD)
+ KIMD R0, R2 // compute intermediate message digest (KIMD)
BVS loop // branch back if interrupted
MVC $16, (R1), (R8)
MOVD $0, R0
CMPBEQ R4, $0, generic
loop:
- WORD $0xB93E0002 // KIMD R2
+ KIMD R0, R2 // compute intermediate message digest (KIMD)
BVS loop // continue if interrupted
RET
CMPBEQ R4, $0, generic
loop:
- WORD $0xB93E0002 // KIMD R2
+ KIMD R0, R2 // compute intermediate message digest (KIMD)
BVS loop // continue if interrupted
RET
CMPBEQ R4, $0, generic
loop:
- WORD $0xB93E0002 // KIMD R2
+ KIMD R0, R2 // compute intermediate message digest (KIMD)
BVS loop // continue if interrupted
RET
TEXT ·kmQuery(SB), NOSPLIT|NOFRAME, $0-16
MOVD $0, R0 // set function code to 0 (KM-Query)
MOVD $ret+0(FP), R1 // address of 16-byte return value
- WORD $0xB92E0024 // cipher message (KM)
+ KM R2, R4 // cipher message (KM)
RET
// func kmcQuery() queryResult
TEXT ·kmcQuery(SB), NOSPLIT|NOFRAME, $0-16
MOVD $0, R0 // set function code to 0 (KMC-Query)
MOVD $ret+0(FP), R1 // address of 16-byte return value
- WORD $0xB92F0024 // cipher message with chaining (KMC)
+ KMC R2, R4 // cipher message with chaining (KMC)
RET
// func kmctrQuery() queryResult
TEXT ·kimdQuery(SB), NOSPLIT|NOFRAME, $0-16
MOVD $0, R0 // set function code to 0 (KIMD-Query)
MOVD $ret+0(FP), R1 // address of 16-byte return value
- WORD $0xB93E0024 // compute intermediate message digest (KIMD)
+ KIMD R2, R4 // compute intermediate message digest (KIMD)
RET
// func klmdQuery() queryResult
TEXT ·klmdQuery(SB), NOSPLIT|NOFRAME, $0-16
MOVD $0, R0 // set function code to 0 (KLMD-Query)
MOVD $ret+0(FP), R1 // address of 16-byte return value
- WORD $0xB93F0024 // compute last message digest (KLMD)
+ KLMD R2, R4 // compute last message digest (KLMD)
RET
// func kdsaQuery() queryResult