
|
My Project
|
Functions | |
| WOLFSSL_API int | wc_ecc_make_key (WC_RNG *rng, int keysize, ecc_key *key) |
| This function generates a new ecc_key and stores it in key. | |
| WOLFSSL_API int | wc_ecc_make_key_ex (WC_RNG *rng, int keysize, ecc_key *key, int curve_id) |
| This function generates a new ecc_key and stores it in key. | |
| WOLFSSL_API int | wc_ecc_check_key (ecc_key *key) |
| Perform sanity checks on ecc key validity. | |
| WOLFSSL_API int | wc_ecc_shared_secret (ecc_key *private_key, ecc_key *public_key, byte *out, word32 *outlen) |
| This function generates a new secret key using a local private key and a received public key. It stores this shared secret key in the buffer out and updates outlen to hold the number of bytes written to the output buffer. | |
| WOLFSSL_API int | wc_ecc_shared_secret_ex (ecc_key *private_key, ecc_point *point, byte *out, word32 *outlen) |
| Create an ECC shared secret between private key and public point. | |
| WOLFSSL_API int | wc_ecc_sign_hash (const byte *in, word32 inlen, byte *out, word32 *outlen, WC_RNG *rng, ecc_key *key) |
| This function signs a message digest using an ecc_key object to guarantee authenticity. | |
| WOLFSSL_API int | wc_ecc_sign_hash_ex (const byte *in, word32 inlen, WC_RNG *rng, ecc_key *key, mp_int *r, mp_int *s) |
| Sign a message digest. | |
| WOLFSSL_API int | wc_ecc_verify_hash (const byte *sig, word32 siglen, const byte *hash, word32 hashlen, int *stat, ecc_key *key) |
| This function verifies the ECC signature of a hash to ensure authenticity. It returns the answer through stat, with 1 corresponding to a valid signature, and 0 corresponding to an invalid signature. | |
| WOLFSSL_API int | wc_ecc_init (ecc_key *key) |
| This function initializes an ecc_key object for future use with message verification or key negotiation. | |
| WOLFSSL_API int | wc_ecc_free (ecc_key *key) |
| This function frees an ecc_key object after it has been used. | |
| WOLFSSL_API void | wc_ecc_fp_free (void) |
| This function frees the fixed-point cache, which can be used with ecc to speed up computation times. To use this functionality, FP_ECC (fixed-point ecc), should be defined. | |
| WOLFSSL_API int | wc_ecc_is_valid_idx (int n) |
| Checks if an ECC idx is valid. | |
| WOLFSSL_API ecc_point * | wc_ecc_new_point (void) |
| Allocate a new ECC point. | |
| WOLFSSL_API void | wc_ecc_del_point (ecc_point *p) |
| Free an ECC point from memory. | |
| WOLFSSL_API int | wc_ecc_copy_point (ecc_point *p, ecc_point *r) |
| Copy the value of one point to another one. | |
| WOLFSSL_API int | wc_ecc_cmp_point (ecc_point *a, ecc_point *b) |
| Compare the value of a point with another one. | |
| WOLFSSL_API int | wc_ecc_point_is_at_infinity (ecc_point *p) |
| Checks if a point is at infinity. Returns 1 if point is at infinity, 0 if not, < 0 on error. | |
| WOLFSSL_API int | wc_ecc_mulmod (mp_int *k, ecc_point *G, ecc_point *R, mp_int *a, mp_int *modulus, int map) |
| Perform ECC Fixed Point multiplication. | |
| WOLFSSL_API int | wc_ecc_export_x963 (ecc_key *, byte *out, word32 *outLen) |
| This function exports the ECC key from the ecc_key structure, storing the result in out. The key will be stored in ANSI X9.63 format. It stores the bytes written to the output buffer in outLen. | |
| WOLFSSL_API int | wc_ecc_export_x963_ex (ecc_key *, byte *out, word32 *outLen, int compressed) |
| This function exports the ECC key from the ecc_key structure, storing the result in out. The key will be stored in ANSI X9.63 format. It stores the bytes written to the output buffer in outLen. This function allows the additional option of compressing the certificate through the compressed parameter. When this parameter is true, the key will be stored in ANSI X9.63 compressed format. | |
| WOLFSSL_API int | wc_ecc_import_x963 (const byte *in, word32 inLen, ecc_key *key) |
| This function imports a public ECC key from a buffer containing the key stored in ANSI X9.63 format. This function will handle both compressed and uncompressed keys, as long as compressed keys are enabled at compile time through the HAVE_COMP_KEY option. | |
| WOLFSSL_API int | wc_ecc_rs_to_sig (const char *r, const char *s, byte *out, word32 *outlen) |
| This function converts the R and S portions of an ECC signature into a DER-encoded ECDSA signature. This function also stores the length written to the output buffer, out, in outlen. | |
| WOLFSSL_API int | wc_ecc_import_raw (ecc_key *key, const char *qx, const char *qy, const char *d, const char *curveName) |
| This function fills an ecc_key structure with the raw components of an ECC signature. | |
| WOLFSSL_API int | wc_ecc_export_private_only (ecc_key *key, byte *out, word32 *outLen) |
| This function exports only the private key from an ecc_key structure. It stores the private key in the buffer out, and sets the bytes written to this buffer in outLen. | |
| WOLFSSL_API int | wc_ecc_export_point_der (const int curve_idx, ecc_point *point, byte *out, word32 *outLen) |
| Export point to der. | |
| WOLFSSL_API int | wc_ecc_import_point_der (byte *in, word32 inLen, const int curve_idx, ecc_point *point) |
| Import point from der format. | |
| WOLFSSL_API int | wc_ecc_size (ecc_key *key) |
| This function returns the key size of an ecc_key structure in octets. | |
| WOLFSSL_API int | wc_ecc_sig_size_calc (int sz) |
| This function returns the worst case size for an ECC signature, given by: (keySz * 2) + SIG_HEADER_SZ + ECC_MAX_PAD_SZ. The actual signature size can be computed with wc_ecc_sign_hash. | |
| WOLFSSL_API int | wc_ecc_sig_size (ecc_key *key) |
| This function returns the worst case size for an ECC signature, given by: (keySz * 2) + SIG_HEADER_SZ + ECC_MAX_PAD_SZ. The actual signature size can be computed with wc_ecc_sign_hash. | |
| WOLFSSL_API ecEncCtx * | wc_ecc_ctx_new (int flags, WC_RNG *rng) |
| This function allocates and initializes space for a new ECC context object to allow secure message exchange with ECC. | |
| WOLFSSL_API void | wc_ecc_ctx_free (ecEncCtx *) |
| This function frees the ecEncCtx object used for encrypting and decrypting messages. | |
| WOLFSSL_API int | wc_ecc_ctx_reset (ecEncCtx *, WC_RNG *) |
| This function resets an ecEncCtx structure to avoid having to free and allocate a new context object. | |
| WOLFSSL_API const byte * | wc_ecc_ctx_get_own_salt (ecEncCtx *) |
| This function returns the salt of an ecEncCtx object. This function should only be called when the ecEncCtx's state is ecSRV_INIT or ecCLI_INIT. | |
| WOLFSSL_API int | wc_ecc_ctx_set_peer_salt (ecEncCtx *, const byte *salt) |
| This function sets the peer salt of an ecEncCtx object. | |
| WOLFSSL_API int | wc_ecc_ctx_set_info (ecEncCtx *, const byte *info, int sz) |
| This function can optionally be called before or after wc_ecc_ctx_set_peer_salt. It sets optional information for an ecEncCtx object. | |
| WOLFSSL_API int | wc_ecc_encrypt (ecc_key *privKey, ecc_key *pubKey, const byte *msg, word32 msgSz, byte *out, word32 *outSz, ecEncCtx *ctx) |
| This function encrypts the given input message from msg to out. This function takes an optional ctx object as parameter. When supplied, encryption proceeds based on the ecEncCtx's encAlgo, kdfAlgo, and macAlgo. If ctx is not supplied, processing completes with the default algorithms, ecAES_128_CBC, ecHKDF_SHA256 and ecHMAC_SHA256. This function requires that the messages are padded according to the encryption type specified by ctx. | |
| WOLFSSL_API int | wc_ecc_decrypt (ecc_key *privKey, ecc_key *pubKey, const byte *msg, word32 msgSz, byte *out, word32 *outSz, ecEncCtx *ctx) |
| This function decrypts the ciphertext from msg to out. This function takes an optional ctx object as parameter. When supplied, encryption proceeds based on the ecEncCtx's encAlgo, kdfAlgo, and macAlgo. If ctx is not supplied, processing completes with the default algorithms, ecAES_128_CBC, ecHKDF_SHA256 and ecHMAC_SHA256. This function requires that the messages are padded according to the encryption type specified by ctx. | |
| WOLFSSL_API int wc_ecc_check_key | ( | ecc_key * | key | ) |
Perform sanity checks on ecc key validity.
| key | Pointer to key to check. |
Example
Compare the value of a point with another one.
| a | First point to compare. |
| b | Second point to compare. |
Example
Compare the value of a point with an other one a The point to compare b The other point to compare
return MP_EQ if equal, MP_LT/MP_GT if not, < 0 in case of error
Copy the value of one point to another one.
| p | The point to copy. |
| r | The created point. |
Example
Copy the value of a point to an other one p The point to copy r The created point
| WOLFSSL_API void wc_ecc_ctx_free | ( | ecEncCtx * | ctx | ) |
This function frees the ecEncCtx object used for encrypting and decrypting messages.
| ctx | pointer to the ecEncCtx object to free |
Example
| WOLFSSL_API const byte * wc_ecc_ctx_get_own_salt | ( | ecEncCtx * | ctx | ) |
This function returns the salt of an ecEncCtx object. This function should only be called when the ecEncCtx's state is ecSRV_INIT or ecCLI_INIT.
| ctx | pointer to the ecEncCtx object from which to get the salt |
Example
| WOLFSSL_API ecEncCtx * wc_ecc_ctx_new | ( | int | flags, |
| WC_RNG * | rng ) |
This function allocates and initializes space for a new ECC context object to allow secure message exchange with ECC.
| flags | indicate whether this is a server or client context Options are: REQ_RESP_CLIENT, and REQ_RESP_SERVER |
| rng | pointer to a RNG object with which to generate a salt |
Example
| WOLFSSL_API int wc_ecc_ctx_reset | ( | ecEncCtx * | ctx, |
| WC_RNG * | rng ) |
This function resets an ecEncCtx structure to avoid having to free and allocate a new context object.
| ctx | pointer to the ecEncCtx object to reset |
| rng | pointer to an RNG object with which to generate a new salt |
Example
| WOLFSSL_API int wc_ecc_ctx_set_info | ( | ecEncCtx * | ctx, |
| const byte * | info, | ||
| int | sz ) |
This function can optionally be called before or after wc_ecc_ctx_set_peer_salt. It sets optional information for an ecEncCtx object.
| ctx | pointer to the ecEncCtx for which to set the info |
| info | pointer to a buffer containing the info to set |
| sz | size of the info buffer |
Example
| WOLFSSL_API int wc_ecc_ctx_set_peer_salt | ( | ecEncCtx * | ctx, |
| const byte * | salt ) |
This function sets the peer salt of an ecEncCtx object.
| ctx | pointer to the ecEncCtx for which to set the salt |
| salt | pointer to the peer's salt |
Example
| WOLFSSL_API int wc_ecc_decrypt | ( | ecc_key * | privKey, |
| ecc_key * | pubKey, | ||
| const byte * | msg, | ||
| word32 | msgSz, | ||
| byte * | out, | ||
| word32 * | outSz, | ||
| ecEncCtx * | ctx ) |
This function decrypts the ciphertext from msg to out. This function takes an optional ctx object as parameter. When supplied, encryption proceeds based on the ecEncCtx's encAlgo, kdfAlgo, and macAlgo. If ctx is not supplied, processing completes with the default algorithms, ecAES_128_CBC, ecHKDF_SHA256 and ecHMAC_SHA256. This function requires that the messages are padded according to the encryption type specified by ctx.
| privKey | pointer to the ecc_key object containing the private key to use for decryption |
| pubKey | pointer to the ecc_key object containing the public key of the peer with whom one wishes to communicate |
| msg | pointer to the buffer holding the ciphertext to decrypt |
| msgSz | size of the buffer to decrypt |
| out | pointer to the buffer in which to store the decrypted plaintext |
| outSz | pointer to a word32 object containing the available size in the out buffer. Upon successfully decrypting the ciphertext, holds the number of bytes written to the output buffer |
| ctx | Optional: pointer to an ecEncCtx object specifying different decryption algorithms to use |
Example
| WOLFSSL_API void wc_ecc_del_point | ( | ecc_point * | p | ) |
Free an ECC point from memory.
| p | The point to free. |
Example
Free an ECC point from memory p The point to free
| WOLFSSL_API int wc_ecc_encrypt | ( | ecc_key * | privKey, |
| ecc_key * | pubKey, | ||
| const byte * | msg, | ||
| word32 | msgSz, | ||
| byte * | out, | ||
| word32 * | outSz, | ||
| ecEncCtx * | ctx ) |
This function encrypts the given input message from msg to out. This function takes an optional ctx object as parameter. When supplied, encryption proceeds based on the ecEncCtx's encAlgo, kdfAlgo, and macAlgo. If ctx is not supplied, processing completes with the default algorithms, ecAES_128_CBC, ecHKDF_SHA256 and ecHMAC_SHA256. This function requires that the messages are padded according to the encryption type specified by ctx.
| privKey | pointer to the ecc_key object containing the private key to use for encryption |
| pubKey | pointer to the ecc_key object containing the public key of the peer with whom one wishes to communicate |
| msg | pointer to the buffer holding the message to encrypt |
| msgSz | size of the buffer to encrypt |
| out | pointer to the buffer in which to store the encrypted ciphertext |
| outSz | pointer to a word32 object containing the available size in the out buffer. Upon successfully encrypting the message, holds the number of bytes written to the output buffer |
| ctx | Optional: pointer to an ecEncCtx object specifying different encryption algorithms to use |
Example
| WOLFSSL_API int wc_ecc_export_point_der | ( | const int | curve_idx, |
| ecc_point * | point, | ||
| byte * | out, | ||
| word32 * | outLen ) |
Export point to der.
| curve_idx | Index of the curve used from ecc_sets. |
| point | Point to export to der. |
| out | Destination for the output. |
| outLen | Maxsize allowed for output, destination for final size of output |
Example
| WOLFSSL_API int wc_ecc_export_private_only | ( | ecc_key * | key, |
| byte * | out, | ||
| word32 * | outLen ) |
This function exports only the private key from an ecc_key structure. It stores the private key in the buffer out, and sets the bytes written to this buffer in outLen.
| key | pointer to an ecc_key structure from which to export the private key |
| out | pointer to the buffer in which to store the private key |
| outLen | pointer to a word32 object with the size available in out. Set with the number of bytes written to out after successfully exporting the private key |
Example
| WOLFSSL_API int wc_ecc_export_x963 | ( | ecc_key * | key, |
| byte * | out, | ||
| word32 * | outLen ) |
This function exports the ECC key from the ecc_key structure, storing the result in out. The key will be stored in ANSI X9.63 format. It stores the bytes written to the output buffer in outLen.
| key | pointer to the ecc_key object to export |
| out | pointer to the buffer in which to store the ANSI X9.63 formatted key |
| outLen | size of the output buffer. On successfully storing the key, will hold the bytes written to the output buffer |
Example
| WOLFSSL_API int wc_ecc_export_x963_ex | ( | ecc_key * | key, |
| byte * | out, | ||
| word32 * | outLen, | ||
| int | compressed ) |
This function exports the ECC key from the ecc_key structure, storing the result in out. The key will be stored in ANSI X9.63 format. It stores the bytes written to the output buffer in outLen. This function allows the additional option of compressing the certificate through the compressed parameter. When this parameter is true, the key will be stored in ANSI X9.63 compressed format.
| key | pointer to the ecc_key object to export |
| out | pointer to the buffer in which to store the ANSI X9.63 formatted key |
| outLen | size of the output buffer. On successfully storing the key, will hold the bytes written to the output buffer |
| compressed | indicator of whether to store the key in compressed format. 1==compressed, 0==uncompressed |
Example
| WOLFSSL_API void wc_ecc_fp_free | ( | void | ) |
This function frees the fixed-point cache, which can be used with ecc to speed up computation times. To use this functionality, FP_ECC (fixed-point ecc), should be defined.
| none | No parameters. |
Example
Free the Fixed Point cache
| WOLFSSL_API int wc_ecc_free | ( | ecc_key * | key | ) |
This function frees an ecc_key object after it has been used.
| key | pointer to the ecc_key object to free |
Example
Free an ECC key from memory key The key you wish to free
| WOLFSSL_API int wc_ecc_import_point_der | ( | byte * | in, |
| word32 | inLen, | ||
| const int | curve_idx, | ||
| ecc_point * | point ) |
Import point from der format.
| in | der buffer to import point from. |
| inLen | Length of der buffer. |
| curve_idx | Index of curve. |
| point | Destination for point. |
Example
| WOLFSSL_API int wc_ecc_import_raw | ( | ecc_key * | key, |
| const char * | qx, | ||
| const char * | qy, | ||
| const char * | d, | ||
| const char * | curveName ) |
This function fills an ecc_key structure with the raw components of an ECC signature.
| key | pointer to an ecc_key structure to fill |
| qx | pointer to a buffer containing the x component of the base point as an ASCII hex string |
| qy | pointer to a buffer containing the y component of the base point as an ASCII hex string |
| d | pointer to a buffer containing the private key as an ASCII hex string |
| curveName | pointer to a string containing the ECC curve name, as found in ecc_sets |
Example
Import raw ECC key key The destination ecc_key structure qx x component of the public key, as ASCII hex string qy y component of the public key, as ASCII hex string d private key, as ASCII hex string, optional if importing public key only curveName ECC curve name, from ecc_sets[] return MP_OKAY on success
| WOLFSSL_API int wc_ecc_import_x963 | ( | const byte * | in, |
| word32 | inLen, | ||
| ecc_key * | key ) |
This function imports a public ECC key from a buffer containing the key stored in ANSI X9.63 format. This function will handle both compressed and uncompressed keys, as long as compressed keys are enabled at compile time through the HAVE_COMP_KEY option.
| in | pointer to the buffer containing the ANSI x9.63 formatted ECC key |
| inLen | length of the input buffer |
| key | pointer to the ecc_key object in which to store the imported key |
Example
| WOLFSSL_API int wc_ecc_init | ( | ecc_key * | key | ) |
This function initializes an ecc_key object for future use with message verification or key negotiation.
| key | pointer to the ecc_key object to initialize |
Example
| WOLFSSL_API int wc_ecc_is_valid_idx | ( | int | n | ) |
Checks if an ECC idx is valid.
| n | The idx number to check. |
Example
Returns whether an ECC idx is valid or not n The idx number to check return 1 if valid, 0 if not
This function generates a new ecc_key and stores it in key.
| rng | pointer to an initialized RNG object with which to generate the key |
| keysize | desired length for the ecc_key |
| key | pointer to the ecc_key for which to generate a key |
Example
Make a new ECC key rng An active RNG state keysize The keysize for the new key (in octets from 20 to 65 bytes) key [out] Destination of the newly created key return MP_OKAY if successful, upon error all allocated memory will be freed
This function generates a new ecc_key and stores it in key.
| key | Pointer to store the created key. |
| keysize | size of key to be created in bytes, set based on curveId |
| rng | Rng to be used in key creation |
| curve_id | Curve to use for key |
Example
| WOLFSSL_API int wc_ecc_mulmod | ( | mp_int * | k, |
| ecc_point * | G, | ||
| ecc_point * | R, | ||
| mp_int * | a, | ||
| mp_int * | modulus, | ||
| int | map ) |
Perform ECC Fixed Point multiplication.
| k | The multiplicand. |
| G | Base point to multiply. |
| R | Destination of product. |
| modulus | The modulus for the curve. |
| map | If non-zero maps the point back to affine coordinates, otherwise it's left in jacobian-montgomery form. |
Example
ECC Fixed Point mulmod global k The multiplicand G Base point to multiply R [out] Destination of product a ECC curve parameter a modulus The modulus for the curve map [boolean] If non-zero maps the point back to affine coordinates, otherwise it's left in jacobian-montgomery form return MP_OKAY if successful
| WOLFSSL_API ecc_point * wc_ecc_new_point | ( | void | ) |
Allocate a new ECC point.
| none | No parameters. |
Example
Allocate a new ECC point return A newly allocated point or NULL on error
| WOLFSSL_API int wc_ecc_point_is_at_infinity | ( | ecc_point * | p | ) |
Checks if a point is at infinity. Returns 1 if point is at infinity, 0 if not, < 0 on error.
| p | The point to check. |
Example
| WOLFSSL_API int wc_ecc_rs_to_sig | ( | const char * | r, |
| const char * | s, | ||
| byte * | out, | ||
| word32 * | outlen ) |
This function converts the R and S portions of an ECC signature into a DER-encoded ECDSA signature. This function also stores the length written to the output buffer, out, in outlen.
| r | pointer to the buffer containing the R portion of the signature as a string |
| s | pointer to the buffer containing the S portion of the signature as a string |
| out | pointer to the buffer in which to store the DER-encoded ECDSA signature |
| outlen | length of the output buffer available. Will store the bytes written to the buffer after successfully converting the signature to ECDSA format |
Example
Convert ECC R,S to signature r R component of signature s S component of signature out DER-encoded ECDSA signature outlen [in/out] output buffer size, output signature size return MP_OKAY on success
| WOLFSSL_API int wc_ecc_shared_secret | ( | ecc_key * | private_key, |
| ecc_key * | public_key, | ||
| byte * | out, | ||
| word32 * | outlen ) |
This function generates a new secret key using a local private key and a received public key. It stores this shared secret key in the buffer out and updates outlen to hold the number of bytes written to the output buffer.
| private_key | pointer to the ecc_key structure containing the local private key |
| public_key | pointer to the ecc_key structure containing the received public key |
| out | pointer to an output buffer in which to store the generated shared secret key |
| outlen | pointer to the word32 object containing the length of the output buffer. Will be overwritten with the length written to the output buffer upon successfully generating a shared secret key |
Example
Create an ECC shared secret between two keys private_key The private ECC key (heap hint based off of private key) public_key The public key out [out] Destination of the shared secret Conforms to EC-DH from ANSI X9.63 outlen [in/out] The max size and resulting size of the shared secret return MP_OKAY if successful
| WOLFSSL_API int wc_ecc_shared_secret_ex | ( | ecc_key * | private_key, |
| ecc_point * | point, | ||
| byte * | out, | ||
| word32 * | outlen ) |
Create an ECC shared secret between private key and public point.
| private_key | The private ECC key. |
| point | The point to use (public key). |
| out | Output destination of the shared secret. Conforms to EC-DH from ANSI X9.63. |
| outlen | Input the max size and output the resulting size of the shared secret. |
Example
Create an ECC shared secret between private key and public point private_key The private ECC key (heap hint based on private key) point The point to use (public key) out [out] Destination of the shared secret Conforms to EC-DH from ANSI X9.63 outlen [in/out] The max size and resulting size of the shared secret return MP_OKAY if successful
| WOLFSSL_API int wc_ecc_sig_size | ( | ecc_key * | key | ) |
This function returns the worst case size for an ECC signature, given by: (keySz * 2) + SIG_HEADER_SZ + ECC_MAX_PAD_SZ. The actual signature size can be computed with wc_ecc_sign_hash.
| key | pointer to an ecc_key structure for which to get the signature size |
Example
| WOLFSSL_API int wc_ecc_sig_size_calc | ( | int | sz | ) |
This function returns the worst case size for an ECC signature, given by: (keySz * 2) + SIG_HEADER_SZ + ECC_MAX_PAD_SZ. The actual signature size can be computed with wc_ecc_sign_hash.
| key | size |
Example
| WOLFSSL_API int wc_ecc_sign_hash | ( | const byte * | in, |
| word32 | inlen, | ||
| byte * | out, | ||
| word32 * | outlen, | ||
| WC_RNG * | rng, | ||
| ecc_key * | key ) |
This function signs a message digest using an ecc_key object to guarantee authenticity.
| in | pointer to the buffer containing the message hash to sign |
| inlen | length of the message hash to sign |
| out | buffer in which to store the generated signature |
| outlen | max length of the output buffer. Will store the bytes written to out upon successfully generating a message signature |
| key | pointer to a private ECC key with which to generate the signature |
Example
Sign a message digest in The message digest to sign inlen The length of the digest out [out] The destination for the signature outlen [in/out] The max size and resulting size of the signature key A private ECC key return MP_OKAY if successful
| int wc_ecc_sign_hash_ex | ( | const byte * | in, |
| word32 | inlen, | ||
| WC_RNG * | rng, | ||
| ecc_key * | key, | ||
| mp_int * | r, | ||
| mp_int * | s ) |
Sign a message digest.
| in | The message digest to sign. |
| inlen | The length of the digest. |
| rng | Pointer to WC_RNG struct. |
| key | A private ECC key. |
| r | The destination for r component of the signature. |
| s | The destination for s component of the signature. |
Example
Sign a message digest in The message digest to sign inlen The length of the digest key A private ECC key r [out] The destination for r component of the signature s [out] The destination for s component of the signature return MP_OKAY if successful
| WOLFSSL_API int wc_ecc_size | ( | ecc_key * | key | ) |
This function returns the key size of an ecc_key structure in octets.
| key | pointer to an ecc_key structure for which to get the key size |
Example
| WOLFSSL_API int wc_ecc_verify_hash | ( | const byte * | sig, |
| word32 | siglen, | ||
| const byte * | hash, | ||
| word32 | hashlen, | ||
| int * | res, | ||
| ecc_key * | key ) |
This function verifies the ECC signature of a hash to ensure authenticity. It returns the answer through stat, with 1 corresponding to a valid signature, and 0 corresponding to an invalid signature.
| sig | pointer to the buffer containing the signature to verify |
| siglen | length of the signature to verify |
| hash | pointer to the buffer containing the hash of the message verified |
| hashlen | length of the hash of the message verified |
| stat | pointer to the result of the verification. 1 indicates the message was successfully verified |
| key | pointer to a public ECC key with which to verify the signature |
Example
Verify an ECC signature sig The signature to verify siglen The length of the signature (octets) hash The hash (message digest) that was signed hashlen The length of the hash (octets) res Result of signature, 1==valid, 0==invalid key The corresponding public ECC key return MP_OKAY if successful (even if the signature is not valid)