Text file src/crypto/internal/fips140/aes/aes_s390x.s

     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  #include "textflag.h"
     8  
     9  // func cryptBlocks(c code, key, dst, src *byte, length int)
    10  TEXT ·cryptBlocks(SB),NOSPLIT,$0-40
    11  	MOVD	key+8(FP), R1
    12  	MOVD	dst+16(FP), R2
    13  	MOVD	src+24(FP), R4
    14  	MOVD	length+32(FP), R5
    15  	MOVD	c+0(FP), R0
    16  loop:
    17  	KM	R2, R4      // cipher message (KM)
    18  	BVS	loop        // branch back if interrupted
    19  	XOR	R0, R0
    20  	RET
    21  
    22  // func cryptBlocksChain(c code, iv, key, dst, src *byte, length int)
    23  TEXT ·cryptBlocksChain(SB),NOSPLIT,$48-48
    24  	LA	params-48(SP), R1
    25  	MOVD	iv+8(FP), R8
    26  	MOVD	key+16(FP), R9
    27  	MVC	$16, 0(R8), 0(R1)  // move iv into params
    28  	MVC	$32, 0(R9), 16(R1) // move key into params
    29  	MOVD	dst+24(FP), R2
    30  	MOVD	src+32(FP), R4
    31  	MOVD	length+40(FP), R5
    32  	MOVD	c+0(FP), R0
    33  loop:
    34  	KMC	R2, R4            // cipher message with chaining (KMC)
    35  	BVS	loop              // branch back if interrupted
    36  	XOR	R0, R0
    37  	MVC	$16, 0(R1), 0(R8) // update iv
    38  	RET
    39  
    40  

View as plain text