OXIESEC PANEL
- Current Dir:
/
/
opt
/
golang
/
1.22.0
/
src
/
crypto
/
aes
Server IP: 191.96.63.230
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📄
aes_gcm.go
5.45 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
aes_test.go
11.3 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
asm_amd64.s
5.4 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
asm_arm64.s
6.86 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
asm_ppc64x.s
18.67 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
asm_s390x.s
4.4 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
block.go
6.5 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
cbc_ppc64x.go
1.7 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
cbc_s390x.go
1.58 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
cipher.go
1.94 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
cipher_asm.go
2.83 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
cipher_generic.go
760 bytes
02/02/2024 06:09:55 PM
rw-r--r--
📄
cipher_s390x.go
2.6 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
const.go
29.32 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
ctr_s390x.go
2.44 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
gcm_amd64.s
23.42 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
gcm_arm64.s
21.52 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
gcm_ppc64x.go
6.44 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
gcm_ppc64x.s
27.07 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
gcm_s390x.go
11.32 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
modes.go
1.15 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
modes_test.go
3.48 KB
02/02/2024 06:09:55 PM
rw-r--r--
Editing: cipher_s390x.go
Close
// Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package aes import ( "crypto/cipher" "crypto/internal/alias" "internal/cpu" ) type code int // Function codes for the cipher message family of instructions. const ( aes128 code = 18 aes192 = 19 aes256 = 20 ) type aesCipherAsm struct { function code // code for cipher message instruction key []byte // key (128, 192 or 256 bits) storage [32]byte // array backing key slice } // cryptBlocks invokes the cipher message (KM) instruction with // the given function code. This is equivalent to AES in ECB // mode. The length must be a multiple of BlockSize (16). // //go:noescape func cryptBlocks(c code, key, dst, src *byte, length int) func newCipher(key []byte) (cipher.Block, error) { // The aesCipherAsm type implements the cbcEncAble, cbcDecAble, // ctrAble and gcmAble interfaces. We therefore need to check // for all the features required to implement these modes. // Keep in sync with crypto/tls/common.go. if !(cpu.S390X.HasAES && cpu.S390X.HasAESCBC && cpu.S390X.HasAESCTR && (cpu.S390X.HasGHASH || cpu.S390X.HasAESGCM)) { return newCipherGeneric(key) } var function code switch len(key) { case 128 / 8: function = aes128 case 192 / 8: function = aes192 case 256 / 8: function = aes256 default: return nil, KeySizeError(len(key)) } var c aesCipherAsm c.function = function c.key = c.storage[:len(key)] copy(c.key, key) return &c, nil } func (c *aesCipherAsm) BlockSize() int { return BlockSize } func (c *aesCipherAsm) Encrypt(dst, src []byte) { if len(src) < BlockSize { panic("crypto/aes: input not full block") } if len(dst) < BlockSize { panic("crypto/aes: output not full block") } if alias.InexactOverlap(dst[:BlockSize], src[:BlockSize]) { panic("crypto/aes: invalid buffer overlap") } cryptBlocks(c.function, &c.key[0], &dst[0], &src[0], BlockSize) } func (c *aesCipherAsm) Decrypt(dst, src []byte) { if len(src) < BlockSize { panic("crypto/aes: input not full block") } if len(dst) < BlockSize { panic("crypto/aes: output not full block") } if alias.InexactOverlap(dst[:BlockSize], src[:BlockSize]) { panic("crypto/aes: invalid buffer overlap") } // The decrypt function code is equal to the function code + 128. cryptBlocks(c.function+128, &c.key[0], &dst[0], &src[0], BlockSize) } // expandKey is used by BenchmarkExpand. cipher message (KM) does not need key // expansion so there is no assembly equivalent. func expandKey(key []byte, enc, dec []uint32) { expandKeyGo(key, enc, dec) }