lib/crypto/x86/curve25519.h
Source file repositories/reference/linux-study-clean/lib/crypto/x86/curve25519.h
File Facts
- System
- Linux kernel
- Corpus path
lib/crypto/x86/curve25519.h- Extension
.h- Size
- 58029 bytes
- Lines
- 1614
- Domain
- Kernel Services
- Bucket
- lib
- Inferred role
- Kernel Services: implementation source
- Status
- source implementation candidate
Why This File Exists
Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
Dependency Surface
linux/types.hlinux/jump_label.hlinux/kernel.hasm/cpufeature.hasm/processor.h
Detected Declarations
function Copyrightfunction gte_maskfunction carryfunction faddfunction fsubfunction fmulfunction fmul2function fmul_scalarfunction cswap2function fsqrfunction fsqr2function point_add_and_doublefunction point_doublefunction montgomery_ladderfunction fsquare_timesfunction finvfunction store_felemfunction encode_pointfunction curve25519_ever64function curve25519_ever64_basefunction curve25519_archfunction curve25519_base_archfunction curve25519_mod_init_arch
Annotated Snippet
while (j < (const int[]){ 64, 64, 64, 63 }[i]) {
u64 bit = (key[i] >> j) & 1;
k = (64 * i + j - 3);
swap = swap ^ bit;
cswap2(swap, xz1, xz2);
swap = bit;
fsub(b, x1, z1);
fadd(a, x1, z1);
fmul(c, &table_ladder[4 * k], b, ef);
fsub(b, a, c);
fadd(a, a, c);
fsqr2(ab, ab, efgh);
fmul2(xz1, xz2, ab, efgh);
++j;
}
j = 0;
}
point_double(xz1, abcd, efgh);
point_double(xz1, abcd, efgh);
point_double(xz1, abcd, efgh);
encode_point(out, xz1);
memzero_explicit(tmp, sizeof(tmp));
}
static __ro_after_init DEFINE_STATIC_KEY_FALSE(curve25519_use_bmi2_adx);
static void curve25519_arch(u8 mypublic[CURVE25519_KEY_SIZE],
const u8 secret[CURVE25519_KEY_SIZE],
const u8 basepoint[CURVE25519_KEY_SIZE])
{
if (static_branch_likely(&curve25519_use_bmi2_adx))
curve25519_ever64(mypublic, secret, basepoint);
else
curve25519_generic(mypublic, secret, basepoint);
}
static void curve25519_base_arch(u8 pub[CURVE25519_KEY_SIZE],
const u8 secret[CURVE25519_KEY_SIZE])
{
if (static_branch_likely(&curve25519_use_bmi2_adx))
curve25519_ever64_base(pub, secret);
else
curve25519_generic(pub, secret, curve25519_base_point);
}
#define curve25519_mod_init_arch curve25519_mod_init_arch
static void curve25519_mod_init_arch(void)
{
if (boot_cpu_has(X86_FEATURE_BMI2) && boot_cpu_has(X86_FEATURE_ADX))
static_branch_enable(&curve25519_use_bmi2_adx);
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/jump_label.h`, `linux/kernel.h`, `asm/cpufeature.h`, `asm/processor.h`.
- Detected declarations: `function Copyright`, `function gte_mask`, `function carry`, `function fadd`, `function fsub`, `function fmul`, `function fmul2`, `function fmul_scalar`, `function cswap2`, `function fsqr`.
- Atlas domain: Kernel Services / lib.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.