...
Run Format

Text file src/crypto/internal/cipherhw/asm_s390x.s

Documentation: crypto/internal/cipherhw

     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	// +build s390x,!gccgo,!appengine
     6	
     7	#include "textflag.h"
     8	
     9	// func hasHWSupport() bool
    10	TEXT ·hasHWSupport(SB),NOSPLIT,$16-1
    11		XOR	R0, R0          // set function code to 0 (query)
    12		LA	mask-16(SP), R1 // 16-byte stack variable for mask
    13		MOVD	$(0x38<<40), R3 // mask for bits 18-20 (big endian)
    14	
    15		// check for KM AES functions
    16		WORD	$0xB92E0024 // cipher message (KM)
    17		MOVD	mask-16(SP), R2
    18		AND	R3, R2
    19		CMPBNE	R2, R3, notfound
    20	
    21		// check for KMC AES functions
    22		WORD	$0xB92F0024 // cipher message with chaining (KMC)
    23		MOVD	mask-16(SP), R2
    24		AND	R3, R2
    25		CMPBNE	R2, R3, notfound
    26	
    27		// check for KMCTR AES functions
    28		WORD	$0xB92D4024 // cipher message with counter (KMCTR)
    29		MOVD	mask-16(SP), R2
    30		AND	R3, R2
    31		CMPBNE	R2, R3, notfound
    32	
    33		// check for KIMD GHASH function
    34		WORD	$0xB93E0024    // compute intermediate message digest (KIMD)
    35		MOVD	mask-8(SP), R2 // bits 64-127
    36		MOVD	$(1<<62), R5
    37		AND	R5, R2
    38		CMPBNE	R2, R5, notfound
    39	
    40		MOVB	$1, ret+0(FP)
    41		RET
    42	notfound:
    43		MOVB	$0, ret+0(FP)
    44		RET

View as plain text