pub unsafe extern "C" fn Hacl_P256_validate_public_key(
    public_key: *mut u8
) -> bool
Expand description

Public key validation.

The function returns true if a public key is valid and false otherwise.

The argument public_key points to 64 bytes of valid memory, i.e., uint8_t[64].

The public key (x || y) is valid (with respect to SP 800-56A): • the public key is not the “point at infinity”, represented as O. • the affine x and y coordinates of the point represented by the public key are in the range [0, p – 1] where p is the prime defining the finite field. • y^2 = x^3 + ax + b where a and b are the coefficients of the curve equation. The last extract is taken from: https://neilmadden.blog/2017/05/17/so-how-do-you-validate-nist-ecdh-public-keys/