Back to the files list
ECSDSA (Elliptic Curve-based Schnorr Digital Signature Algorithm).
More...
|
cx_err_t | cx_ecschnorr_sign_no_throw (const cx_ecfp_private_key_t *pvkey, uint32_t mode, cx_md_t hashID, const uint8_t *msg, size_t msg_len, uint8_t *sig, size_t *sig_len) |
| Signs a digest message according to the given mode. More...
|
static int | cx_ecschnorr_sign (const cx_ecfp_private_key_t *pvkey, int mode, cx_md_t hashID, const unsigned char *msg, unsigned int msg_len, unsigned char *sig, size_t sig_len, unsigned int *info) |
| Signs a digest message according to the given mode. More...
|
bool | cx_ecschnorr_verify (const cx_ecfp_public_key_t *pukey, uint32_t mode, cx_md_t hashID, const uint8_t *msg, size_t msg_len, const uint8_t *sig, size_t sig_len) |
| Verifies a digest message signature according to the given mode. More...
|
Detailed Description
ECSDSA (Elliptic Curve-based Schnorr Digital Signature Algorithm).
Schnorr signature algorithm is a non-standard alternative to ECDSA. Several implementations of Schnorr signature algorithm are supported here.
cx_ecschnorr_sign()
static int cx_ecschnorr_sign |
( |
const cx_ecfp_private_key_t * |
pvkey, |
|
int |
mode, |
|
cx_md_t |
hashID, |
|
const unsigned char * |
msg, |
|
unsigned int |
msg_len, |
|
unsigned char * |
sig, |
|
size_t |
sig_len, |
|
unsigned int * |
info |
) |
|
Signs a digest message according to the given mode.
This function throws an exception if the computation doesn't succeed.
- Warning
- It is recommended to use cx_ecschnorr_sign_no_throw rather than this function.
- Parameters
-
[in] | pvkey | Pointer to the private key initialized with cx_ecfp_init_private_key_no_throw beforehand. |
[in] | mode | Mode. Supported flag:
- CX_ECSCHNORR_XY
- CX_ECSCHNORR_ISO14888_X
- CX_ECSCHNORR_BSI03111
- CX_ECSCHNORR_LIBSECP
- CX_ECSCHNORR_Z
- CX_ECSCHNORR_BIP0340
|
[in] | hashID | Message digest algorithm identifier. This parameter is mandatory when using the CX_RND_RFC6979 pseudorandom number generator. |
[in] | msg | Input data to sign. |
[in] | msg_len | Length of input data. |
[out] | sig | ECSchnorr signature encoded in TLV: 30 || L || 02 || Lr || r || 02 || Ls || s. This parameter holds the auxiliary random data when CX_ECSCHNORR_BIP0340 is used. |
[in] | sig_len | Length of the signature. |
[in] | info | Additional information. This parameter is not used. |
- Returns
- Length of the signature.
- Exceptions
-
CX_EC_INVALID_CURVE |
CX_INVALID_PARAMETER |
CX_NOT_UNLOCKED |
CX_INVALID_PARAMETER_SIZE |
CX_NOT_LOCKED |
CX_MEMORY_FULL |
CX_EC_INVALID_POINT |
CX_EC_INFINITE_POINT |
CX_INVALID_PARAMETER_VALUE |
cx_ecschnorr_sign_no_throw()
Signs a digest message according to the given mode.
- Parameters
-
[in] | pvkey | Pointer to the private key initialized with cx_ecfp_init_private_key_no_throw beforehand. |
[in] | mode | Mode. Supported flag:
- CX_ECSCHNORR_XY
- CX_ECSCHNORR_ISO14888_X
- CX_ECSCHNORR_BSI03111
- CX_ECSCHNORR_LIBSECP
- CX_ECSCHNORR_Z
- CX_ECSCHNORR_BIP0340
|
[in] | hashID | Message digest algorithm identifier. This parameter is mandatory when using the CX_RND_RFC6979 pseudorandom number generator. |
[in] | msg | Input data to sign. |
[in] | msg_len | Length of input data. |
[out] | sig | ECSchnorr signature encoded in TLV: 30 || L || 02 || Lr || r || 02 || Ls || s. This parameter holds the auxiliary random data when CX_ECSCHNORR_BIP0340 is used. |
[in] | sig_len | Length of the signature. |
- Returns
- Error code:
- CX_OK on success
- CX_EC_INVALID_CURVE
- CX_INVALID_PARAMETER
- CX_NOT_UNLOCKED
- CX_INVALID_PARAMETER_SIZE
- CX_NOT_LOCKED
- CX_MEMORY_FULL
- CX_EC_INVALID_POINT
- CX_EC_INFINITE_POINT
- CX_INVALID_PARAMETER_VALUE
cx_ecschnorr_verify()
bool cx_ecschnorr_verify |
( |
const cx_ecfp_public_key_t * |
pukey, |
|
uint32_t |
mode, |
|
cx_md_t |
hashID, |
|
const uint8_t * |
msg, |
|
size_t |
msg_len, |
|
const uint8_t * |
sig, |
|
size_t |
sig_len |
) |
Verifies a digest message signature according to the given mode.
- Parameters
-
[in] | pukey | Pointer to the public key initialized with cx_ecfp_init_private_key_no_throw beforehand. |
[in] | mode | Mode. Supported flag:
- CX_ECSCHNORR_XY
- CX_ECSCHNORR_ISO14888_X
- CX_ECSCHNORR_BSI03111
- CX_ECSCHNORR_LIBSECP
- CX_ECSCHNORR_Z
- CX_ECSCHNORR_BIP0340
|
[in] | hashID | Message digest algorithm identifier used to compute the input data. |
[in] | msg | Signed input data to verify the signature. |
[in] | msg_len | Length of the input data. |
[in] | sig | ECSchnorr signature to verify encoded in TLV: 30 || L || 02 || Lr || r || 02 || Ls || s |
[in] | sig_len | Length of the signature. |
- Returns
- 1 if signature is verified, 0 otherwise.
Back to the files list