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: modes_test.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" "testing" ) // Check that the optimized implementations of cipher modes will // be picked up correctly. // testInterface can be asserted to check that a type originates // from this test group. type testInterface interface { InAESPackage() bool } // testBlock implements the cipher.Block interface and any *Able // interfaces that need to be tested. type testBlock struct{} func (*testBlock) BlockSize() int { return 0 } func (*testBlock) Encrypt(a, b []byte) {} func (*testBlock) Decrypt(a, b []byte) {} func (*testBlock) NewGCM(int, int) (cipher.AEAD, error) { return &testAEAD{}, nil } func (*testBlock) NewCBCEncrypter([]byte) cipher.BlockMode { return &testBlockMode{} } func (*testBlock) NewCBCDecrypter([]byte) cipher.BlockMode { return &testBlockMode{} } func (*testBlock) NewCTR([]byte) cipher.Stream { return &testStream{} } // testAEAD implements the cipher.AEAD interface. type testAEAD struct{} func (*testAEAD) NonceSize() int { return 0 } func (*testAEAD) Overhead() int { return 0 } func (*testAEAD) Seal(a, b, c, d []byte) []byte { return []byte{} } func (*testAEAD) Open(a, b, c, d []byte) ([]byte, error) { return []byte{}, nil } func (*testAEAD) InAESPackage() bool { return true } // Test the gcmAble interface is detected correctly by the cipher package. func TestGCMAble(t *testing.T) { b := cipher.Block(&testBlock{}) if _, ok := b.(gcmAble); !ok { t.Fatalf("testBlock does not implement the gcmAble interface") } aead, err := cipher.NewGCM(b) if err != nil { t.Fatalf("%v", err) } if _, ok := aead.(testInterface); !ok { t.Fatalf("cipher.NewGCM did not use gcmAble interface") } } // testBlockMode implements the cipher.BlockMode interface. type testBlockMode struct{} func (*testBlockMode) BlockSize() int { return 0 } func (*testBlockMode) CryptBlocks(a, b []byte) {} func (*testBlockMode) InAESPackage() bool { return true } // Test the cbcEncAble interface is detected correctly by the cipher package. func TestCBCEncAble(t *testing.T) { b := cipher.Block(&testBlock{}) if _, ok := b.(cbcEncAble); !ok { t.Fatalf("testBlock does not implement the cbcEncAble interface") } bm := cipher.NewCBCEncrypter(b, []byte{}) if _, ok := bm.(testInterface); !ok { t.Fatalf("cipher.NewCBCEncrypter did not use cbcEncAble interface") } } // Test the cbcDecAble interface is detected correctly by the cipher package. func TestCBCDecAble(t *testing.T) { b := cipher.Block(&testBlock{}) if _, ok := b.(cbcDecAble); !ok { t.Fatalf("testBlock does not implement the cbcDecAble interface") } bm := cipher.NewCBCDecrypter(b, []byte{}) if _, ok := bm.(testInterface); !ok { t.Fatalf("cipher.NewCBCDecrypter did not use cbcDecAble interface") } } // testStream implements the cipher.Stream interface. type testStream struct{} func (*testStream) XORKeyStream(a, b []byte) {} func (*testStream) InAESPackage() bool { return true } // Test the ctrAble interface is detected correctly by the cipher package. func TestCTRAble(t *testing.T) { b := cipher.Block(&testBlock{}) if _, ok := b.(ctrAble); !ok { t.Fatalf("testBlock does not implement the ctrAble interface") } s := cipher.NewCTR(b, []byte{}) if _, ok := s.(testInterface); !ok { t.Fatalf("cipher.NewCTR did not use ctrAble interface") } }