/* NIST P-256 (secp256r1) ECDH for the TLS 1.2 client: servers behind older * load balancers offer ECDHE only over P-256/P-384, never X25519. * Montgomery field arithmetic on 8x32-bit limbs, Jacobian points. ECDH * only (certificates are not verified, so there is no ECDSA). Not * constant time. Pure freestanding C with host vectors (make test-crypto). */ #ifndef TLS_P256_H #define TLS_P256_H /* pub = 0x04 || X || Y (uncompressed, 65 bytes) for the private scalar. * Returns 0, -1 for a zero scalar. */ int p256_public(const unsigned char priv[32], unsigned char pub[65]); /* out = X coordinate of priv * peer. Returns -1 when the peer point is not * an uncompressed point on the curve. */ int p256_shared(const unsigned char priv[32], const unsigned char *peer, unsigned int peer_len, unsigned char out[32]); #endif