inst_aes.bend checks
raw source on the hub · import bend-osdev-crypto@0.1.0.0/inst_aes.bend as Inst_aes
AES as a block cipher: cipher-modes' AES-128 and AES-256 (FIPS 197; encryption from bend-collections, decryption in cipher-modes), with its key schedule's decryption round keys computed once (CmAes.prepare). The instance: ~X.CmAesKey, ~M.CmBlock, ~16n, ~CrAes.key, ~X.CmAes.encrypt, ~X.CmAes.decrypt, ~CrBlk128.of_octets, ~CrBlk128.to_octets, ~CrBlk128.xor and, for a mode that only encrypts (CTR, CMAC, CCM), the same with ~CrAes.key_enc in place of ~CrAes.key, which skips the decryption round keys. This is the only file of the package that imports cipher-modes' aes.bend, and so bend-collections.
6 imports
import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B import bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend as M import bend-osdev-cipher-modes@0.1.0.0/aes.bend as X import ./crypto.bend as Cr import ./inst_cm.bend as CM
Definitions
def CrAes.key source · line 21 · raw
@o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> Result<&2, &2, 0x01313a4f070f7ffd2bd276fcd2143eda/crypto.CrError, 0xf4b936e0e6b2608080d2f02bb3ce9abe/aes.CmAesKey>
a 16- or 32-byte key (AES-128 or AES-256), with its decryption round keys; CrBadKeyLength for any other length
def CrAes.key_enc source · line 27 · raw
@o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> Result<&2, &2, 0x01313a4f070f7ffd2bd276fcd2143eda/crypto.CrError, 0xf4b936e0e6b2608080d2f02bb3ce9abe/aes.CmAesKey>
the same without the decryption round keys, for uses that only encrypt (CTR, CMAC, CCM): a key made this way still decrypts, deriving those round keys again for every block