aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj
diff options
context:
space:
mode:
authorSrinivas Pokala <Pokala.Srinivas@ibm.com>2023-10-16 11:18:50 +0200
committerKeith Randall <khr@golang.org>2023-11-22 03:55:32 +0000
commitb06f59e75c5774171759fb70729b14c7f40c285c (patch)
tree33e084ece57cf2a07ae59f34b674676caaa8482a /src/cmd/internal/obj
parent5f7a40856372142372d3b67c9dd737373932f088 (diff)
downloadgo-b06f59e75c5774171759fb70729b14c7f40c285c.tar.xz
cmd/asm: fix the KMCTR instruction encoding and argument passing
KMCTR encoding arguments incorrect way, which leading illegal instruction wherver we call KMCTR instruction.IBM z13 machine test's TestAESGCM test using gcmASM implementation, which uses KMCTR instruction to encrypt using AES in counter mode and the KIMD instruction for GHASH. z14+ machines onwards uses gcmKMA implementation for the same. Fixes #63387 Change-Id: I86aeb99573c3f636a71908c99e06a9530655aa5d Reviewed-on: https://go-review.googlesource.com/c/go/+/535675 Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/internal/obj')
-rw-r--r--src/cmd/internal/obj/s390x/asmz.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/cmd/internal/obj/s390x/asmz.go b/src/cmd/internal/obj/s390x/asmz.go
index bf6d48e305..7b560e0053 100644
--- a/src/cmd/internal/obj/s390x/asmz.go
+++ b/src/cmd/internal/obj/s390x/asmz.go
@@ -4434,7 +4434,7 @@ func (c *ctxtz) asmout(p *obj.Prog, asm *[]byte) {
}
zRRE(op_KDSA, uint32(p.From.Reg), uint32(p.To.Reg), asm)
- case 126: // KMA and KMCTR - CIPHER MESSAGE WITH AUTHENTICATION; CIPHER MESSAGE WITH
+ case 126: // KMA and KMCTR - CIPHER MESSAGE WITH AUTHENTICATION; CIPHER MESSAGE WITH COUNTER
var opcode uint32
switch p.As {
default:
@@ -4458,16 +4458,13 @@ func (c *ctxtz) asmout(p *obj.Prog, asm *[]byte) {
if p.Reg&1 != 0 {
c.ctxt.Diag("third argument must be even register in %v", p)
}
- if p.Reg == p.To.Reg || p.Reg == p.From.Reg {
- c.ctxt.Diag("third argument must not be input or output argument registers in %v", p)
- }
if p.As == AKMA {
opcode = op_KMA
} else if p.As == AKMCTR {
opcode = op_KMCTR
}
}
- zRRF(opcode, uint32(p.From.Reg), 0, uint32(p.Reg), uint32(p.To.Reg), asm)
+ zRRF(opcode, uint32(p.Reg), 0, uint32(p.From.Reg), uint32(p.To.Reg), asm)
}
}