lcx_eddsa.h Previous Back to the files list EDDSA (Edwards Curve Digital Signature Algorithm) More... Functions cx_err_t cx_eddsa_sign_no_throw (const cx_ecfp_private_key_t *pvkey, cx_md_t hashID, const uint8_t *hash, size_t hash_len, uint8_t *sig, size_t sig_len) Signs a message digest. More... static int cx_eddsa_sign (const cx_ecfp_private_key_t *pvkey, int mode, cx_md_t hashID, const unsigned char *hash, unsigned int hash_len, const unsigned char *ctx, unsigned int ctx_len, unsigned char *sig, unsigned int sig_len, unsigned int *info) Signs a message digest. More... bool cx_eddsa_verify_no_throw (const cx_ecfp_public_key_t *pukey, cx_md_t hashID, const uint8_t *hash, size_t hash_len, const uint8_t *sig, size_t sig_len) Verifies a signature. More... static int cx_eddsa_verify (const cx_ecfp_public_key_t *pukey, int mode, cx_md_t hashID, const unsigned char *hash, unsigned int hash_len, const unsigned char *ctx, unsigned int ctx_len, const unsigned char *sig, unsigned int sig_len) Verifies a signature. More... void cx_encode_coord (uint8_t *coord, int len, int sign) Encodes the curve point coordinates. More... int cx_decode_coord (uint8_t *coord, int len) Decodes the curve point coordinates. More... Detailed Description EDDSA (Edwards Curve Digital Signature Algorithm) EDDSA is a digital signature scheme relying on Edwards curves, especially Ed25519 and Ed448. Refer to RFC8032 for more details. Function Documentation cx_decode_coord() int cx_decode_coord ( uint8_t * coord, int len ) Decodes the curve point coordinates. Parameters [in,out]coordA pointer to the point encoded coordinates. [in]lenLength of the encoded coordinates. ReturnsSign of the x-coordinate. cx_eddsa_sign() static int cx_eddsa_sign ( const cx_ecfp_private_key_t * pvkey, int mode, cx_md_t hashID, const unsigned char * hash, unsigned int hash_len, const unsigned char * ctx, unsigned int ctx_len, unsigned char * sig, unsigned int sig_len, unsigned int * info ) Signs a message digest. The signature is done according to the EDDSA specification RFC8032 . This function throws an exception if the computation doesn't succeed. WarningIt is recommended to use cx_eddsa_sign_no_throw rather than this function. Parameters [in]pvkeyPrivate key. This shall be initialized with cx_ecfp_init_private_key_no_throw. [in]modeMode. This parameter is not used. [in]hashIDMessage digest agorithm identifier. Algorithms supported: SHA512 SHA3 Keccak [in]hashPointer to the message digest. [in]hash_lenLength of the digest. [in]ctxPointer to the context. This parameter is not used. [in]ctx_lenLength of ctx. This parameter is not used. [out]sigBuffer where to store the signature. [in]sig_lenLength of the signature. [in]infoAdditional information. This parameter is not used. ReturnsLength of the signature. Exceptions CX_EC_INVALID_CURVE CX_INVALID_PARAMETER INVALID_PARAMETER CX_NOT_UNLOCKED CX_INVALID_PARAMETER_SIZE CX_MEMORY_FULL CX_NOT_LOCKED CX_INVALID_PARAMETER_SIZE CX_EC_INVALID_POINT CX_EC_INFINITE_POINT CX_INTERNAL_ERROR CX_INVALID_PARAMETER_VALUE cx_eddsa_sign_no_throw() cx_err_t cx_eddsa_sign_no_throw ( const cx_ecfp_private_key_t * pvkey, cx_md_t hashID, const uint8_t * hash, size_t hash_len, uint8_t * sig, size_t sig_len ) Signs a message digest. The signature is done according to the EDDSA specification RFC8032 . Parameters [in]pvkeyPrivate key. This shall be initialized with cx_ecfp_init_private_key_no_throw. [in]hashIDMessage digest agorithm identifier. Algorithms supported: SHA512 SHA3 Keccak [in]hashPointer to the message digest. [in]hash_lenLength of the digest. [out]sigBuffer where to store the signature. [in]sig_lenLength of the signature. ReturnsError code: CX_OK on success CX_EC_INVALID_CURVE CX_INVALID_PARAMETER INVALID_PARAMETER CX_NOT_UNLOCKED CX_INVALID_PARAMETER_SIZE CX_MEMORY_FULL CX_NOT_LOCKED CX_INVALID_PARAMETER_SIZE CX_EC_INVALID_POINT CX_EC_INFINITE_POINT CX_INTERNAL_ERROR CX_INVALID_PARAMETER_VALUE cx_eddsa_verify() static int cx_eddsa_verify ( const cx_ecfp_public_key_t * pukey, int mode, cx_md_t hashID, const unsigned char * hash, unsigned int hash_len, const unsigned char * ctx, unsigned int ctx_len, const unsigned char * sig, unsigned int sig_len ) Verifies a signature. The verification is done according to the specification RFC8032 . This function throws an exception if the computation doesn't succeed. Parameters [in]pukeyPublic key. THis shall be initialized with cx_ecfp_init_public_key_no_throw. [in]modeMode. This parameter is not used. [in]hashIDMessage digest agorithm identifier. Algorithms supported: SHA512 SHA3 Keccak [in]hashPointer to the message digest. [in]hash_lenLength of the digest. [in]ctxPointer to the context. This parameter is not used. [in]ctx_lenLength of the context. This parameter is not used. [out]sigPointer to the signature. [in]sig_lenLength of the signature. Returns1 if the signature is verified, otherwise 0. cx_eddsa_verify_no_throw() bool cx_eddsa_verify_no_throw ( const cx_ecfp_public_key_t * pukey, cx_md_t hashID, const uint8_t * hash, size_t hash_len, const uint8_t * sig, size_t sig_len ) Verifies a signature. The verification is done according to the specification RFC8032 . Parameters [in]pukeyPublic key. This shall be initialized with cx_ecfp_init_public_key_no_throw. [in]hashIDMessage digest agorithm identifier. Algorithms supported: SHA512 SHA3 Keccak [in]hashPointer to the message digest. [in]hash_lenLength of the digest. [out]sigPointer to the signature. [in]sig_lenLength of the signature. Returns1 if the signature is verified, otherwise 0. cx_encode_coord() void cx_encode_coord ( uint8_t * coord, int len, int sign ) Encodes the curve point coordinates. Parameters [in,out]coordA pointer to the point coordinates in the form x|y. [in]lenLength of the coordinates. [in]signSign of the x-coordinate. Previous Back to the files list Did you find this page helpful? How would you improve this page for developers? I am a developer. Contributors will be chosen randomly to receive rewards. Check this box to send your email and participate. Ledger collects your email address to send you rewards for your contribution to improve the Developer Portal documentation. Learn more about how we manage your data and your rights. By providing your email address, you consent that Ledger may contact you for rewards delivery purposes. If you are part of the randomly selected contributors, we will send you an email to ask for your physical address and if necessary, ask you for additional information on the suggestion you made. Your information will only be available to Ledger and will be retained for no longer than 90 days. It may be transferred to non-European countries that ensure an adequate level of protection or under the standard contractual clauses adopted by the EU Commission. Please note that you may withdraw your consent at any time, access your data and request their rectification or deletion. You may also request the limitation of the processing of your data. To exercise your rights or for any question on the processing of your data, please contact LEDGER’s Data Protection Officer here. If nevertheless you believe LEDGER did not adequately address your concerns and mishandled your data, you may lodge a complaint with the personal data protection authority of your country.