cryptotest

package standard library
master (807e01d) Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestAEAD

func TestAEAD(t *testing.T, mAEAD MakeAEAD)

TestAEAD performs a set of tests on cipher.AEAD implementations, checking the documented requirements of NonceSize, Overhead, Seal and Open.

func TestBlock

func TestBlock(t *testing.T, keySize int, mb MakeBlock)

TestBlock performs a set of tests on cipher.Block implementations, checking the documented requirements of BlockSize, Encrypt, and Decrypt.

func TestBlockMode

func TestBlockMode(t *testing.T, block cipher.Block, makeEncrypter, makeDecrypter MakeBlockMode)

TestBlockMode performs a set of tests on cipher.BlockMode implementations, checking the documented requirements of CryptBlocks.

func TestHash

func TestHash(t *testing.T, mh MakeHash)

TestHash performs a set of tests on hash.Hash implementations, checking the documented requirements of Write, Sum, Reset, Size, and BlockSize.

func TestStream

func TestStream(t *testing.T, ms MakeStream)

TestStream performs a set of tests on cipher.Stream implementations, checking the documented requirements of XORKeyStream.

func TestStreamFromBlock

func TestStreamFromBlock(t *testing.T, block cipher.Block, blockMode func(b cipher.Block, iv []byte) cipher.Stream)

TestStreamFromBlock creates a Stream from a cipher.Block used in a cipher.BlockMode. It addresses Issue 68377 by checking for a panic when the BlockMode uses an IV with incorrect length. For a valid IV, it also runs all TestStream tests on the resulting stream.

Types

type MakeAEAD

type MakeAEAD func() (cipher.AEAD, error)

MakeAEAD returns a cipher.AEAD instance.

Multiple calls to MakeAEAD must return equivalent instances, so for example the key must be fixed.

type MakeBlock

type MakeBlock func(key []byte) (cipher.Block, error)

type MakeBlockMode

type MakeBlockMode func(b cipher.Block, iv []byte) cipher.BlockMode

MakeBlockMode returns a cipher.BlockMode instance. It expects len(iv) == b.BlockSize().

type MakeHash

type MakeHash func() hash.Hash

type MakeStream

type MakeStream func() cipher.Stream

MakeStream returns a cipher.Stream instance.

Multiple calls to MakeStream must return equivalent instances, so for example the key and/or IV must be fixed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL