Skip to content

Commit 7a9e3d9

Browse files
author
Andreas Auernhammer
committed
add AES-GCM support on ppc64le and bump go version
This commit adds pcc64le to the list of architectures that support AES-GCM - but only for Go 1.14 and newer. Since Go 1.14 there is a asm implementation of AES-GCM. Fixes #52 Further, this commit updates the required dependencies and bumps the required Go version (from 1.12 to 1.13). We bump the required Go version since Go only actively supports the latest two releases. Since Go 1.14 is now available we drop Go 1.12.
1 parent dfa7b7d commit 7a9e3d9

File tree

5 files changed

+42
-6
lines changed

5 files changed

+42
-6
lines changed

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/secure-io/sio-go
22

3-
go 1.12
3+
go 1.13
44

55
require (
6-
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f
7-
golang.org/x/sys v0.0.0-20190412213103-97732733099d
6+
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073
7+
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527
88
)

go.sum

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
2-
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo=
3-
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
2+
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM=
3+
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
44
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
55
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
6-
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
76
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7+
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So=
8+
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
89
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

sioutil/aes_generic.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2020 Andreas Auernhammer. All rights reserved.
2+
// Use of this source code is governed by a license that can be
3+
// found in the LICENSE file.
4+
5+
// +build !go1.14 !ppc64le
6+
7+
package sioutil
8+
9+
// An asm implementation of AES-GCM for ppc64le is not available
10+
// before Go 1.14.
11+
12+
const ppcHasAES = false

sioutil/aes_ppc64le.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2020 Andreas Auernhammer. All rights reserved.
2+
// Use of this source code is governed by a license that can be
3+
// found in the LICENSE file.
4+
5+
// +build go1.14,ppc64le
6+
7+
package sioutil
8+
9+
// An asm implementation of AES-GCM for ppc64le is available
10+
// since Go 1.14.
11+
12+
const ppcHasAES = true

sioutil/sio.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ func NativeAES() bool {
4242
return true
4343
}
4444

45+
// Go 1.14 introduces an AES-GCM asm implementation
46+
// for PPC64le. Therefore, we have to use build tags
47+
// to determine whether we're compiling for PPC64 and
48+
// use Go 1.14 (or newer).
49+
// TODO(aead): Once we drop Go 1.13 support
50+
// (bump go version in go.mod) we can remove
51+
// pcc64-related build tags again.
52+
if ppcHasAES {
53+
return true
54+
}
55+
4556
// On s390x, aes.NewCipher(...) returns a type
4657
// that provides AES asm implementations only
4758
// if all (CBC, CTR and GCM) AES hardware

0 commit comments

Comments
 (0)