abla/crypto/aes/raw

Generated from source.

Source module; follow its importing module's re-export links.

Source: abla/crypto/aes/raw.ab

aesWipe (fun)

trusted fun aesWipe(address: int, size: int): void

Overwrites the writable byte range using volatile stores so the wipe is retained.

aesSoftBlocks (fun)

trusted fun aesSoftBlocks(key: AesKey, encrypt: bool, input: int, output: int, count: int): void

--- Blocks: hardware or software, input and output may be the same memory ------------------

aesBlocks (fun)

trusted fun aesBlocks(key: AesKey, encrypt: bool, input: int, output: int, count: int): void

Encrypts or decrypts the requested complete blocks using the key's selected implementation and valid buffers.

aesHardwareDecrypt (fun)

@target("aes")
@noinline trusted fun aesHardwareDecrypt(key: AesKey, input: int, output: int, count: int): void

Decrypts the requested number of complete blocks using an AES-capable CPU and valid buffers.

aesHardwareEncrypt (fun)

@target("aes")
@noinline trusted fun aesHardwareEncrypt(key: AesKey, input: int, output: int, count: int): void

Encrypts the requested number of complete blocks using an AES-capable CPU and valid buffers.

aesLoad (fun)

@inline trusted fun aesLoad(address: int): secretU32

Returns a secret 32-bit word from readable native storage.

aesLoadBytes (fun)

@inline trusted fun aesLoadBytes(address: int): secretU32

A little-endian word from memory of any alignment (a string's).

aesOrthogonalize (fun)

@inline trusted fun aesOrthogonalize(q: int): void

Turns words of bytes into words of one bit each, and back: its own inverse.

aesGcmLengthValid (fun)

@inline fun aesGcmLengthValid(size: int): bool

NIST SP 800-38D 5.2.1.1: at most 2^39 - 256 bits (2^36 - 32 bytes) of text under one nonce. The 32-bit block counter starts at 2 for the text; past this it wraps to 0 and then 1, the block that masks the tag, so the keystream repeats and the tag mask is given away. Every AES-GCM entry point (aesGcmEncryptWork, aesGcmDecryptWork, aesGcmSealHw, aesGcmOpenWithKey) refuses a text this does not accept.

aesPointer (fun)

@inline trusted fun aesPointer(address: int): i64*

--- Memory: raw words, aligned because this module allocates them --------------------------

aesSoftDecryptCore (fun)

@noinline trusted fun aesSoftDecryptCore(q: int, keys: int, rounds: int): void

Decrypts the valid bitsliced state in place with the supplied round schedule.

aesSoftEncryptCore (fun)

@noinline trusted fun aesSoftEncryptCore(q: int, keys: int, rounds: int): void

Encrypts the valid bitsliced state in place with the supplied round schedule.

aesStore (fun)

@inline trusted fun aesStore(address: int, value: secretU32): void

Stores a secret 32-bit word at a writable native address.

aesStoreBytes (fun)

@inline trusted fun aesStoreBytes(address: int, value: secretU32): void

Stores the secret word as four little-endian bytes, allowing unaligned storage.

aesSoftDecryptBody (fun)

@inline trusted fun aesSoftDecryptBody(q: int, keys: int, rounds: int): void

Runs the inverse AES rounds on a bitsliced state using the expanded keys.

aesSoftEncryptBody (fun)

@inline trusted fun aesSoftEncryptBody(q: int, keys: int, rounds: int): void

Encrypts the two blocks in q, already orthogonalized, under keys: 8 words a round.

aesAddRoundKey (fun)

@inline trusted fun aesAddRoundKey(q: int, key: int): void

XORs the round-key words into the bitsliced AES state.

aesInvMixColumns2 (fun)

@inline trusted fun aesInvMixColumns2(q: int): void

InvMixColumns is MixColumns after adding {04}(s0 + s2) to s0 and s2, and {04}(s1 + s3) to s1 and s3.

aesInvShiftRows (fun)

@inline trusted fun aesInvShiftRows(q: int): void

Applies the inverse AES row permutation to the bitsliced state in place.

aesInvSubBytes (fun)

@inline trusted fun aesInvSubBytes(q: int): void

Applies the inverse AES byte substitution to the bitsliced state in place.

aesMixColumns (fun)

@inline trusted fun aesMixColumns(q: int): void

Applies the AES column mixing step to the bitsliced state in place.

aesShiftRows (fun)

@inline trusted fun aesShiftRows(q: int): void

Applies the AES row permutation to the bitsliced state in place.

aesSubBytes (fun)

@inline trusted fun aesSubBytes(q: int): void

The AES S-box on all 32 bits at once: Boyar and Peralta's 113-gate circuit.

aesInvAffine (fun)

@inline trusted fun aesInvAffine(q: int): void

The inverse S-box: the forward one between two affine maps.

aesSubWord (fun)

trusted fun aesSubWord(q: int, word: secretU32): secretU32

SubWord on one word, through the bitsliced S-box.

AES_SCRATCH_BYTES (val)

val AES_SCRATCH_BYTES

The bytes of scratch at the start of a key-expansion block, before the round keys.

aesDecryptionAt (fun)

@inline fun aesDecryptionAt(schedule: int, rounds: int): int

Where the decryption keys hardware wants lie: after the schedule and the bitsliced keys.

aesExpandSchedule (fun)

@noinline trusted fun aesExpandSchedule(memory: int, source: int, count: int,
    hardware: bool): void

The schedule, the bitsliced round keys and, for hardware rounds, the decryption keys of the key at source.

aesDecryptionKeys (fun)

@target("aes") @noinline trusted fun aesDecryptionKeys(schedule: int, out: int,
    rounds: int): void

The decryption keys: the round keys with InvMixColumns applied to all but the first and the last.

aesHardwareEncryptAt (fun)

@target("aes") @noinline trusted fun aesHardwareEncryptAt(schedule: int, rounds: int,
    input: int, output: int, count: int): void

Encrypts the blocks with the AES instructions, given the round keys at schedule.

aesHardwareDecryptAt (fun)

@target("aes") @noinline trusted fun aesHardwareDecryptAt(keys: int, rounds: int,
    input: int, output: int, count: int): void

Decrypts the blocks with the AES instructions, given the decryption round keys at keys.

aesCtrHardware (fun)

@target("aes") @noinline trusted fun aesCtrHardware(schedule: int, rounds: int, counter: int, scratch: int, input: int, output: int, size: int): void

END AES KEY EXPANSION

aesPaddingBad (fun)

@inline trusted fun aesPaddingBad(address: int): secretU32

--- ECB and CBC --------------------------------------------------------------------------- The padding is checked in a way that doesn't branch on its bytes, though the answer is still an answer: see "padding oracle" in the docs.

ghashHardwareFour (fun)

@target("clmul") @noinline trusted fun ghashHardwareFour(y: int, h: int, powers: int, input: int): void

Four GHASH blocks of input folded into y with the carry-less multiply, using the powers of h at powers.

ghashHardwareMultiply (fun)

@target("clmul") @noinline trusted fun ghashHardwareMultiply(y: int, h: int): void

As ghashSoftMultiply, with carry-less multiply (Gueron and Kounavis's reduction).

ghashSoftMultiplyBody (fun)

@inline trusted fun ghashSoftMultiplyBody(y: int, h: int): void

y = y * h, both 16 big-endian bytes, in GCM's bit order.

aesLoadBig (fun)

@inline trusted fun aesLoadBig(address: int): secretU32

Returns the secret word encoded by four big-endian bytes from readable storage.

aesStoreBig (fun)

@inline trusted fun aesStoreBig(address: int, value: secretU32): void

Stores a secret word as four big-endian bytes at a writable address.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.