tls_p256.h 835 B

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