|
SE050 Driver
API reference
|
Classes | |
| struct | Cmac |
| Streaming AES-128-CMAC (RFC 4493) — no concatenated MAC buffer. More... | |
| class | ScopedWipe |
| Wipes a buffer with SecureZero when the scope ends, on every return path. More... | |
Functions | |
| void | SecureZero (void *p, std::size_t len) noexcept |
Overwrite len bytes at p with zeros in a way the compiler cannot drop. | |
| bool | ConstantTimeEqual (const std::uint8_t *a, const std::uint8_t *b, std::size_t len) noexcept |
Compare two byte strings in time that depends only on len, not on where they differ. | |
| void | AddRoundKey (std::uint8_t s[16], const std::uint8_t *rk) |
| void | SubBytes (std::uint8_t s[16]) |
| void | InvSubBytes (std::uint8_t s[16]) |
| void | ShiftRows (std::uint8_t s[16]) |
| void | InvShiftRows (std::uint8_t s[16]) |
| std::uint8_t | Xtime (std::uint8_t x) |
| std::uint8_t | Gmul (std::uint8_t a, std::uint8_t b) |
| void | MixColumns (std::uint8_t s[16]) |
| void | InvMixColumns (std::uint8_t s[16]) |
| void | ExpandKey (const std::uint8_t key[16], std::uint8_t rk[176]) |
| void | Aes128EncryptBlock (const std::uint8_t key[kAes128KeyLen], const std::uint8_t in[16], std::uint8_t out[16]) |
| void | Aes128DecryptBlock (const std::uint8_t key[kAes128KeyLen], const std::uint8_t in[16], std::uint8_t out[16]) |
| void | XorBlock (std::uint8_t *a, const std::uint8_t *b) |
| void | LeftShift1 (std::uint8_t in[16]) |
| void | GenerateSubkeys (const std::uint8_t key[16], std::uint8_t k1[16], std::uint8_t k2[16]) |
| void | Aes128Cmac (const std::uint8_t key[kAes128KeyLen], const std::uint8_t *msg, std::size_t msg_len, std::uint8_t out[kCmacLen]) |
| bool | FillDerivationData (std::uint8_t constant, std::uint16_t bit_len, std::uint8_t counter, const std::uint8_t *context, std::uint16_t context_len, std::uint8_t *out, std::size_t out_cap, std::size_t *out_len) |
| GP Amendment D derivation input (label || 00 || L || i || context). | |
| bool | DeriveSessionKey (const std::uint8_t static_key[kAes128KeyLen], std::uint8_t constant, const std::uint8_t host_challenge[kChallengeLen], const std::uint8_t card_challenge[kChallengeLen], std::uint8_t out_key[kAes128KeyLen]) |
| bool | ComputeCryptogram (const std::uint8_t session_mac_key[kAes128KeyLen], std::uint8_t constant, const std::uint8_t host_challenge[kChallengeLen], const std::uint8_t card_challenge[kChallengeLen], std::uint8_t out8[kCryptogramLen]) |
| bool | Aes128CbcEncrypt (const std::uint8_t key[kAes128KeyLen], const std::uint8_t iv[16], const std::uint8_t *src, std::uint8_t *dst, std::size_t len) |
| bool | Aes128CbcDecrypt (const std::uint8_t key[kAes128KeyLen], const std::uint8_t iv[16], const std::uint8_t *src, std::uint8_t *dst, std::size_t len) |
| bool | IsoPad80 (std::uint8_t *buf, std::size_t *len, std::size_t cap) |
| bool | StaticKeysUsable (const std::uint8_t *enc, std::size_t enc_len, const std::uint8_t *mac, std::size_t mac_len) |
| void | CmacStart (Cmac &c, const std::uint8_t key[kAes128KeyLen]) |
| void | CmacUpdate (Cmac &c, const std::uint8_t *data, std::size_t len) |
| void | CmacFinish (Cmac &c, std::uint8_t out[kCmacLen]) |
| void | CommandIcv (const std::uint8_t senc[kAes128KeyLen], const std::uint8_t counter[16], std::uint8_t icv[16]) |
| Command ICV = AES-ECB(SENC, counter). CBC with IV=0 of one block. | |
| void | ResponseIcv (const std::uint8_t senc[kAes128KeyLen], const std::uint8_t counter[16], std::uint8_t icv[16]) |
| Response ICV: counter with MSB 0x80, then AES-ECB(SENC, ·). | |
| void | IncCommandCounter (std::uint8_t counter[16]) |
| bool | IsoUnpad80 (const std::uint8_t *padded, std::size_t padded_len, std::size_t *plain_len) |
Variables | |
| constexpr std::size_t | kAes128KeyLen = 16U |
| constexpr std::size_t | kCmacLen = 16U |
| constexpr std::size_t | kChallengeLen = 8U |
| constexpr std::size_t | kCryptogramLen = 8U |
| constexpr std::size_t | kLabelLen = 12U |
| constexpr std::uint8_t | kDeriveCardCryptogram = 0x00U |
| constexpr std::uint8_t | kDeriveHostCryptogram = 0x01U |
| constexpr std::uint8_t | kDeriveSenc = 0x04U |
| constexpr std::uint8_t | kDeriveSmac = 0x06U |
| constexpr std::uint8_t | kDeriveSrmac = 0x07U |
| constexpr std::uint8_t | kKdfCounter = 0x01U |
| constexpr std::uint16_t | kLen128Bit = 0x0080U |
| constexpr std::uint16_t | kLen64Bit = 0x0040U |
| constexpr std::uint8_t | kSbox [256] |
| constexpr std::uint8_t | kInvSbox [256] |
| constexpr std::uint8_t | kRcon [10] |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Command ICV = AES-ECB(SENC, counter). CBC with IV=0 of one block.
|
inline |
|
inlinenoexcept |
Compare two byte strings in time that depends only on len, not on where they differ.
Use for MACs and cryptograms: memcmp returns at the first differing byte, which lets an attacker who can time the answer forge a MAC byte by byte.
|
inline |
|
inline |
|
inline |
GP Amendment D derivation input (label || 00 || L || i || context).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Response ICV: counter with MSB 0x80, then AES-ECB(SENC, ·).
|
inlinenoexcept |
Overwrite len bytes at p with zeros in a way the compiler cannot drop.
Stores go through a volatile pointer and a compiler barrier follows, so the wipe survives dead-store elimination even when the buffer is never read again (the explicit_bzero / memset_s pattern). Use it for session keys, round keys, MAC subkeys and key-derived intermediates.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |