Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
signet::forge::crypto::detail::aes Namespace Reference

Functions

constexpr uint8_t xtime (uint8_t a)
 Multiply by x (i.e., by 2) in GF(2^8).
 
constexpr uint8_t gf_mul (uint8_t a, uint8_t b)
 Multiply two elements in GF(2^8) using the Russian peasant algorithm.
 
void sub_word (uint8_t word[4])
 Apply S-box to each byte of a 4-byte word.
 
void rot_word (uint8_t word[4])
 Rotate a 4-byte word left by one byte: [a,b,c,d] -> [b,c,d,a].
 
void secure_zero (void *ptr, size_t len)
 Securely zero memory that held key material (CWE-244, NIST SP 800-38D §8.3).
 
bool has_hardware_aes () noexcept
 Check if CPU supports AES-NI (x86) or ARMv8-CE AES (ARM).
 

Function Documentation

◆ gf_mul()

constexpr uint8_t signet::forge::crypto::detail::aes::gf_mul ( uint8_t  a,
uint8_t  b 
)
inlineconstexpr

Multiply two elements in GF(2^8) using the Russian peasant algorithm.

Constant-time: arithmetic masking instead of branches (CWE-208). This is used for MixColumns and InvMixColumns (FIPS-197 §5.1.3/§5.3.3).

Definition at line 165 of file aes_core.hpp.

◆ has_hardware_aes()

bool signet::forge::crypto::detail::aes::has_hardware_aes ( )
inlinenoexcept

Check if CPU supports AES-NI (x86) or ARMv8-CE AES (ARM).

Returns true if hardware AES acceleration is available. Currently used for diagnostics only — T-table path is always used (Gap C-5).

Definition at line 217 of file aes_core.hpp.

◆ rot_word()

void signet::forge::crypto::detail::aes::rot_word ( uint8_t  word[4])
inline

Rotate a 4-byte word left by one byte: [a,b,c,d] -> [b,c,d,a].

Definition at line 189 of file aes_core.hpp.

◆ secure_zero()

void signet::forge::crypto::detail::aes::secure_zero ( void *  ptr,
size_t  len 
)
inline

Securely zero memory that held key material (CWE-244, NIST SP 800-38D §8.3).

Uses volatile write + compiler barrier to prevent dead-store elimination. This is the approach used by libsodium and BoringSSL — portable across all compilers and platforms without relying on non-standard APIs.

Note
CWE-244: clearing of heap memory containing sensitive information.

Definition at line 203 of file aes_core.hpp.

◆ sub_word()

void signet::forge::crypto::detail::aes::sub_word ( uint8_t  word[4])
inline

Apply S-box to each byte of a 4-byte word.

Definition at line 181 of file aes_core.hpp.

◆ xtime()

constexpr uint8_t signet::forge::crypto::detail::aes::xtime ( uint8_t  a)
inlineconstexpr

Multiply by x (i.e., by 2) in GF(2^8).

This is the "xtime" operation. If the high bit is set, XOR with 0x1b after shifting (reduction mod 0x11b).

Definition at line 158 of file aes_core.hpp.