Expand description
NIST P-384 Elliptic Curve Primitives
This module implements the NIST P-384 elliptic curve operations in constant time. The curve equation is y² = x³ - 3x + b over the prime field F_p where:
- p = 2^384 - 2^128 - 2^96 + 2^32 - 1 (NIST P-384 prime)
- The curve order n = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973
All operations are implemented to be constant-time to prevent timing attacks. The implementation uses:
- Barrett reduction for field arithmetic
- Jacobian projective coordinates for efficient point operations
- Binary scalar multiplication with constant-time point selection
Structs§
- Field
Element - P-384 field element representing values in F_p
- Point
- P-384 elliptic curve point in affine coordinates (x, y)
- Scalar
- P-384 scalar value for use in elliptic curve operations
Enums§
- Point
Format - Format of a serialized elliptic curve point
Constants§
- P384_
FIELD_ ELEMENT_ SIZE - Size of a P-384 field element in bytes (48 bytes = 384 bits)
- P384_
KEM_ SHARED_ SECRET_ KDF_ OUTPUT_ SIZE - Size of the KDF output for P-384 ECDH-KEM shared secret derivation
- P384_
POINT_ COMPRESSED_ SIZE - Size of a compressed P-384 point in bytes: format byte (0x02/0x03) + x-coordinate
- P384_
POINT_ UNCOMPRESSED_ SIZE - Size of an uncompressed P-384 point in bytes: format byte (0x04) + x-coordinate + y-coordinate
- P384_
SCALAR_ SIZE - Size of a P-384 scalar in bytes (48 bytes = 384 bits)
Functions§
- base_
point_ g - Get the standard base point G of the P-384 curve
- generate_
keypair - Generate a cryptographically secure ECDH keypair
- kdf_
hkdf_ sha384_ for_ ecdh_ kem - Key derivation function for ECDH shared secret using HKDF-SHA384
- scalar_
mult - General scalar multiplication: compute scalar * point
- scalar_
mult_ base_ g - Scalar multiplication with the base point: scalar * G