mbedtls_ecp_check_pubkey() function
This function checks that a point is a valid public key on this curve. It only checks that the point is non-zero, has valid coordinates and lies on the curve. It does not verify that it is indeed a multiple of \p G. This additional check is computationally more expensive, is not required by standards, and should not be necessary if the group used has a small cofactor. In particular, it is useless for the NIST groups which all have a cofactor of 1.
Arguments
grp
The ECP group the point should belong to. This must be initialized and have group parameters set, for example through mbedtls_ecp_group_load().
pt
The point to check. This must be initialized.
Return value
\c 0 if the point is a valid public key. #MBEDTLS_ERR_ECP_INVALID_KEY if the point is not a valid public key for the given curve. Another negative error code on other kinds of failure.
Notes
This function uses bare components rather than an ::mbedtls_ecp_keypair structure, to ease use with other structures, such as ::mbedtls_ecdh_context or ::mbedtls_ecdsa_context.