My Project
Loading...
Searching...
No Matches
ecc.h
1
52WOLFSSL_API
53int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key);
54
113WOLFSSL_API
114int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id);
115
149WOLFSSL_API
150int wc_ecc_check_key(ecc_key* key);
151
224WOLFSSL_API
225int wc_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, byte* out,
226 word32* outlen);
227
270WOLFSSL_API
271int wc_ecc_shared_secret_ex(ecc_key* private_key, ecc_point* point,
272 byte* out, word32 *outlen);
273
339WOLFSSL_API
340int wc_ecc_sign_hash(const byte* in, word32 inlen, byte* out, word32 *outlen,
341 WC_RNG* rng, ecc_key* key);
342
408WOLFSSL_API
409int wc_ecc_sign_hash_ex(const byte* in, word32 inlen, WC_RNG* rng,
410 ecc_key* key, mp_int *r, mp_int *s);
411
476WOLFSSL_API
477int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
478 word32 hashlen, int* stat, ecc_key* key);
479
515WOLFSSL_API
516int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
517 word32 hashlen, int* stat, ecc_key* key);
518
539WOLFSSL_API
540int wc_ecc_init(ecc_key* key);
541
560WOLFSSL_API
561int wc_ecc_free(ecc_key* key);
562
585WOLFSSL_API
586void wc_ecc_fp_free(void);
587
619WOLFSSL_API
620int wc_ecc_is_valid_idx(int n);
621
647WOLFSSL_API
649
675WOLFSSL_API
677
708WOLFSSL_API
710
751WOLFSSL_API
753
792WOLFSSL_API
794
826WOLFSSL_API
828 mp_int* a, mp_int* modulus, int map);
829
892WOLFSSL_API
893int wc_ecc_export_x963(ecc_key*, byte* out, word32* outLen);
894
963WOLFSSL_API
964int wc_ecc_export_x963_ex(ecc_key*, byte* out, word32* outLen, int compressed);
965
1026WOLFSSL_API
1027int wc_ecc_import_x963(const byte* in, word32 inLen, ecc_key* key);
1028
1095WOLFSSL_API
1096int wc_ecc_import_private_key(const byte* priv, word32 privSz, const byte* pub,
1097 word32 pubSz, ecc_key* key);
1098
1161WOLFSSL_API
1162int wc_ecc_rs_to_sig(const char* r, const char* s, byte* out, word32* outlen);
1163
1226WOLFSSL_API
1227int wc_ecc_import_raw(ecc_key* key, const char* qx, const char* qy,
1228 const char* d, const char* curveName);
1229
1289WOLFSSL_API
1290int wc_ecc_export_private_only(ecc_key* key, byte* out, word32* outLen);
1291
1321WOLFSSL_API
1322int wc_ecc_export_point_der(const int curve_idx, ecc_point* point,
1323 byte* out, word32* outLen);
1324
1353WOLFSSL_API
1354int wc_ecc_import_point_der(byte* in, word32 inLen, const int curve_idx,
1355 ecc_point* point);
1356
1381WOLFSSL_API
1382int wc_ecc_size(ecc_key* key);
1383
1407WOLFSSL_API
1408int wc_ecc_sig_size_calc(int sz);
1409
1410
1440WOLFSSL_API
1441int wc_ecc_sig_size(ecc_key* key);
1442
1443
1473WOLFSSL_API
1474ecEncCtx* wc_ecc_ctx_new(int flags, WC_RNG* rng);
1475
1499WOLFSSL_API
1500void wc_ecc_ctx_free(ecEncCtx*);
1501
1530WOLFSSL_API
1531int wc_ecc_ctx_reset(ecEncCtx*, WC_RNG*); /* reset for use again w/o alloc/free */
1532
1564WOLFSSL_API
1565const byte* wc_ecc_ctx_get_own_salt(ecEncCtx*);
1566
1602WOLFSSL_API
1603int wc_ecc_ctx_set_peer_salt(ecEncCtx*, const byte* salt);
1604
1633WOLFSSL_API
1634int wc_ecc_ctx_set_info(ecEncCtx*, const byte* info, int sz);
1635
1693WOLFSSL_API
1694int wc_ecc_encrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
1695 word32 msgSz, byte* out, word32* outSz, ecEncCtx* ctx);
1696
1755WOLFSSL_API
1756int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
1757 word32 msgSz, byte* out, word32* outSz, ecEncCtx* ctx);
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.
Definition ecc.c:4126
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.
Definition ecc.c:4749
WOLFSSL_API int wc_ecc_cmp_point(ecc_point *a, ecc_point *b)
Compare the value of a point with another one.
Definition ecc.c:3119
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 inf...
Definition ecc.c:9718
WOLFSSL_API int wc_ecc_copy_point(ecc_point *p, ecc_point *r)
Copy the value of one point to another one.
Definition ecc.c:3092
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 ...
Definition ecc.c:10064
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.
Definition ecc.c:3887
WOLFSSL_API void wc_ecc_del_point(ecc_point *p)
Free an ECC point from memory.
Definition ecc.c:3082
WOLFSSL_API int wc_ecc_is_valid_idx(int n)
Checks if an ECC idx is valid.
Definition ecc.c:3145
WOLFSSL_API int wc_ecc_export_point_der(const int curve_idx, ecc_point *point, byte *out, word32 *outLen)
Export point to der.
Definition ecc.c:6479
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.
Definition ecc.c:3815
WOLFSSL_API ecc_point * wc_ecc_new_point(void)
Allocate a new ECC point.
Definition ecc.c:3060
WOLFSSL_API int wc_ecc_ctx_set_peer_salt(ecEncCtx *, const byte *salt)
This function sets the peer salt of an ecEncCtx object.
Definition ecc.c:9732
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....
Definition ecc.c:7352
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....
Definition ecc.c:7570
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 thro...
Definition ecc.c:5704
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.
Definition ecc.c:9813
WOLFSSL_API int wc_ecc_check_key(ecc_key *key)
Perform sanity checks on ecc key validity.
Definition ecc.c:7022
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...
Definition ecc.c:8016
WOLFSSL_API int wc_ecc_size(ecc_key *key)
This function returns the key size of an ecc_key structure in octets.
Definition ecc.c:8007
WOLFSSL_API int wc_ecc_init(ecc_key *key)
This function initializes an ecc_key object for future use with message verification or key negotiati...
Definition ecc.c:4495
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 ex...
Definition ecc.c:9845
WOLFSSL_API int wc_ecc_import_point_der(byte *in, word32 inLen, const int curve_idx, ecc_point *point)
Import point from der format.
Definition ecc.c:6456
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.
Definition ecc.c:7976
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....
Definition ecc.c:3533
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 th...
Definition ecc.c:7420
WOLFSSL_API void wc_ecc_ctx_free(ecEncCtx *)
This function frees the ecEncCtx object used for encrypting and decrypting messages.
Definition ecc.c:9852
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.
Definition ecc.c:4848
WOLFSSL_API int wc_ecc_free(ecc_key *key)
This function frees an ecc_key object after it has been used.
Definition ecc.c:5312
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 ec...
Definition ecc.c:9687
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.
Definition ecc.c:3014
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.
Definition ecc.c:4426
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....
Definition ecc.c:9620
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....
Definition ecc.c:6690
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....
Definition ecc.c:6610
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...
Definition ecc.c:8033
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 o...
Definition ecc.c:9895
Definition random.h:153
Definition ecc.h:357
Definition ecc.h:332
Definition integer.h:200