cbc_s390x.mx raw

   1  // Copyright 2016 The Go Authors. All rights reserved.
   2  // Use of this source code is governed by a BSD-style
   3  // license that can be found in the LICENSE file.
   4  
   5  //go:build !purego
   6  
   7  package aes
   8  
   9  // cryptBlocksChain invokes the cipher message with chaining (KMC) instruction
  10  // with the given function code. The length must be a multiple of BlockSize (16).
  11  //
  12  //go:noescape
  13  func cryptBlocksChain(c code, iv, key, dst, src *byte, length int)
  14  
  15  func cryptBlocksEnc(b *Block, civ *[BlockSize]byte, dst, src []byte) {
  16  	if b.fallback != nil {
  17  		cryptBlocksEncGeneric(b, civ, dst, src)
  18  		return
  19  	}
  20  	cryptBlocksChain(b.function, &civ[0], &b.key[0], &dst[0], &src[0], len(src))
  21  }
  22  
  23  func cryptBlocksDec(b *Block, civ *[BlockSize]byte, dst, src []byte) {
  24  	if b.fallback != nil {
  25  		cryptBlocksDecGeneric(b, civ, dst, src)
  26  		return
  27  	}
  28  	// Decrypt function code is encrypt + 128.
  29  	cryptBlocksChain(b.function+128, &civ[0], &b.key[0], &dst[0], &src[0], len(src))
  30  }
  31