Skip to content

Commit

Permalink
address some code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
anitgandhi committed Apr 11, 2018
1 parent 9eb8467 commit f960e99
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/crypto/aes/cipher_s390x.go
Expand Up @@ -31,7 +31,7 @@ type aesCipherAsm struct {
func cryptBlocks(c code, key, dst, src *byte, length int)

func newCipher(key []byte) (cipher.Block, error) {
if !(cpu.S390X.HasKM && cpu.S390X.HasKMC && cpu.S390X.HasKMCTR && cpu.S390x.HasKIMD) {
if !(cpu.S390X.HasKM && cpu.S390X.HasKMC && cpu.S390X.HasKMCTR && cpu.S390X.HasKIMD) {
return newCipherGeneric(key)
}

Expand Down
2 changes: 1 addition & 1 deletion src/crypto/tls/gcm_s390x.go
Expand Up @@ -8,5 +8,5 @@ import (
"internal/cpu"
)

var hasGCMAsm = cpu.S390X.HasKMA || (cpu.S390X.HasKM && cpu.S390X.HasKMC && cpu.S390X.HasKMCTR && cpu.S390x.HasKIMD)
var hasGCMAsm = cpu.S390X.HasKM && ( cpu.S390X.HasKMA || (cpu.S390X.HasKMC && cpu.S390X.HasKMCTR && cpu.S390X.HasKIMD) )

2 changes: 0 additions & 2 deletions src/internal/cpu/cpu_s390x.go
Expand Up @@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build s390x

package cpu

const CacheLineSize = 256
Expand Down
12 changes: 5 additions & 7 deletions src/internal/cpu/cpu_s390x.s
Expand Up @@ -2,13 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build s390x

#include "textflag.h"

// func hasKM() bool
TEXT ·hasKM(SB),NOSPLIT,$16-1
XOR R0, R0 // set function code to 0 (query)
XOR R0, R0 // set function code to 0 (query)
LA mask-16(SP), R1 // 16-byte stack variable for mask
MOVD $(0x38<<40), R3 // mask for bits 18-20 (big endian)

Expand All @@ -26,11 +24,11 @@ notfound:

// func hasKMC() bool
TEXT ·hasKMC(SB),NOSPLIT,$16-1
XOR R0, R0 // set function code to 0 (query)
XOR R0, R0 // set function code to 0 (query)
LA mask-16(SP), R1 // 16-byte stack variable for mask
MOVD $(0x38<<40), R3 // mask for bits 18-20 (big endian)

// check for KMC AES functions
// check for KMC AES functions
WORD $0xB92F0024 // cipher message with chaining (KMC)
MOVD mask-16(SP), R2
AND R3, R2
Expand All @@ -44,7 +42,7 @@ notfound:

// func hasKMCTR() bool
TEXT ·hasKMCTR(SB),NOSPLIT,$16-1
XOR R0, R0 // set function code to 0 (query)
XOR R0, R0 // set function code to 0 (query)
LA mask-16(SP), R1 // 16-byte stack variable for mask
MOVD $(0x38<<40), R3 // mask for bits 18-20 (big endian)

Expand Down Expand Up @@ -85,7 +83,7 @@ yes:

// func hasKIMD() bool
TEXT ·hasKIMD(SB),NOSPLIT,$16-1
XOR R0, R0 // set function code to 0 (query)
XOR R0, R0 // set function code to 0 (query)
LA mask-16(SP), R1 // 16-byte stack variable for mask
MOVD $(0x38<<40), R3 // mask for bits 18-20 (big endian)

Expand Down

0 comments on commit f960e99

Please sign in to comment.