Documentation
¶
Overview ¶
Package common contains code common to many constructions.
Index ¶
- Constants
- func GenerateMasks(rs *random.Source, opts KeyGenerationOpts, ...)
- func MixingBijection(rs *random.Source, size, round, position int) matrix.Matrix
- func NoShift(i int) int
- func ParseBlockSlices(in []byte) (outM [16]table.Block, rest []byte)
- func SerializeBlockMatrix(dst []byte, m [16]table.Block, xor BlockXORTables) int
- func ShiftRows(i int) int
- func UnShiftRows(i int) int
- type BlockMatrix
- type BlockXORTables
- type ByteXORTable
- type ByteXORTables
- type IndependentMasks
- type InvTBox
- type InvTyiTable
- type KeyGenerationOpts
- type MaskType
- type MatchingMasks
- type NibbleXORTable
- type NibbleXORTables
- type SameMasks
- type Surface
- type TBox
- type TyiTable
Constants ¶
View Source
const ( SliceSize = 4096 // = 256*16 SlicesSize = 65536 // = 16*SliceSize )
Variables ¶
This section is empty.
Functions ¶
func GenerateMasks ¶
func GenerateMasks(rs *random.Source, opts KeyGenerationOpts, inputMask, outputMask *matrix.Matrix)
GenerateMasks generates input and output encodings for a white-box AES construction.
func MixingBijection ¶
Generate byte/word mixing bijections. TODO: Ensure that blocks are full-rank.
func SerializeBlockMatrix ¶
func SerializeBlockMatrix(dst []byte, m [16]table.Block, xor BlockXORTables) int
Types ¶
type BlockMatrix ¶
func (BlockMatrix) Get ¶
func (bm BlockMatrix) Get(i byte) (out [16]byte)
type BlockXORTables ¶
type ByteXORTable ¶
type ByteXORTable struct{}
Computes the XOR of two bytes.
func (ByteXORTable) Get ¶
func (bxt ByteXORTable) Get(i [2]byte) (out byte)
type ByteXORTables ¶
type ByteXORTables [16][15]table.DoubleToByte // [byte-wise position][gate number]
func BlockByteXORTables ¶
func BlockByteXORTables(SliceEncoding, XOREncoding func(int, int) encoding.Byte, RoundEncoding func(int) encoding.Byte) (out ByteXORTables)
Generate the XOR Tables for squashing the result of a BlockMatrix.
func ParseBlockByteMatrix ¶
func ParseBlockByteMatrix(in []byte) (outM [16]table.Block, outXOR ByteXORTables, rest []byte)
func ParseByteXORTables ¶
func ParseByteXORTables(in []byte) (bxts ByteXORTables, rest []byte)
func (ByteXORTables) Serialize ¶
func (bxts ByteXORTables) Serialize() []byte
func (ByteXORTables) SquashBlocks ¶
func (bxts ByteXORTables) SquashBlocks(blocks [16][16]byte, dst []byte)
type IndependentMasks ¶
type IndependentMasks struct {
Input, Output MaskType
}
IndependentMasks generates the input and output masks independently of each other.
type InvTyiTable ¶
type InvTyiTable uint
func (InvTyiTable) Get ¶
func (tyi InvTyiTable) Get(i byte) (out [4]byte)
type KeyGenerationOpts ¶
type KeyGenerationOpts interface{}
type MatchingMasks ¶
type MatchingMasks struct{}
MatchingMasks implies a randomly generated input mask and the inverse mask on the output.
type NibbleXORTable ¶
type NibbleXORTable struct{}
Computes the XOR of two nibbles.
func (NibbleXORTable) Get ¶
func (nxt NibbleXORTable) Get(i byte) (out byte)
type NibbleXORTables ¶
func BlockNibbleXORTables ¶
func BlockNibbleXORTables(SliceEncoding, XOREncoding func(int, int) encoding.Nibble, RoundEncoding func(int) encoding.Nibble) (out NibbleXORTables)
Generate the XOR Tables for squashing the result of a BlockMatrix.
func ParseBlockNibbleMatrix ¶
func ParseBlockNibbleMatrix(in []byte) (outM [16]table.Block, outXOR NibbleXORTables, rest []byte)
func ParseNibbleXORTables ¶
func ParseNibbleXORTables(in []byte) (nxts NibbleXORTables, rest []byte)
func (NibbleXORTables) Serialize ¶
func (nxts NibbleXORTables) Serialize() []byte
func (NibbleXORTables) SquashBlocks ¶
func (nxts NibbleXORTables) SquashBlocks(blocks [16][16]byte, dst []byte)
type SameMasks ¶
type SameMasks MaskType
SameMasks puts the exact same mask on the input and output of the white-box.
Click to show internal directories.
Click to hide internal directories.