27 #ifndef WOLF_CRYPT_ED25519_H 28 #define WOLF_CRYPT_ED25519_H 34 #include <wolfssl/wolfcrypt/fe_operations.h> 35 #include <wolfssl/wolfcrypt/ge_operations.h> 39 #ifdef WOLFSSL_ASYNC_CRYPT 40 #include <wolfssl/wolfcrypt/async.h> 58 #define ED25519_KEY_SIZE 32 59 #define ED25519_SIG_SIZE 64 61 #define ED25519_PUB_KEY_SIZE 32 63 #define ED25519_PRV_KEY_SIZE (ED25519_PUB_KEY_SIZE+ED25519_KEY_SIZE) 72 #ifndef WC_ED25519KEY_TYPE_DEFINED 74 #define WC_ED25519KEY_TYPE_DEFINED 79 byte p[ED25519_PUB_KEY_SIZE];
80 byte k[ED25519_PRV_KEY_SIZE];
81 #ifdef FREESCALE_LTC_ECC 83 byte pointX[ED25519_KEY_SIZE];
84 byte pointY[ED25519_KEY_SIZE];
87 #ifdef WOLFSSL_ASYNC_CRYPT 88 WC_ASYNC_DEV asyncDev;
94 int wc_ed25519_make_public(
ed25519_key* key,
unsigned char* pubKey,
102 int wc_ed25519ctx_sign_msg(
const byte* in, word32 inLen, byte* out,
104 const byte* context, byte contextLen);
106 int wc_ed25519ph_sign_hash(
const byte* hash, word32 hashLen, byte* out,
108 const byte* context, byte contextLen);
110 int wc_ed25519ph_sign_msg(
const byte* in, word32 inLen, byte* out,
111 word32 *outLen,
ed25519_key* key,
const byte* context,
117 int wc_ed25519ctx_verify_msg(
const byte* sig, word32 sigLen,
const byte* msg,
119 const byte* context, byte contextLen);
121 int wc_ed25519ph_verify_hash(
const byte* sig, word32 sigLen,
const byte* hash,
123 const byte* context, byte contextLen);
125 int wc_ed25519ph_verify_msg(
const byte* sig, word32 sigLen,
const byte* msg,
127 const byte* context, byte contextLen);
135 int wc_ed25519_import_private_only(
const byte* priv, word32 privSz,
148 byte* priv, word32 *privSz,
149 byte* pub, word32 *pubSz);
WOLFSSL_API int wc_ed25519_verify_msg(const byte *sig, word32 siglen, const byte *msg, word32 msglen, int *stat, ed25519_key *key)
This function verifies the ed25519 signature of a message to ensure authenticity. It returns the answ...
Definition: ed25519.c:439
WOLFSSL_API int wc_ed25519_import_public(const byte *in, word32 inLen, ed25519_key *key)
This function imports a public ed25519_key pair from a buffer containing the public key...
Definition: ed25519.c:572
WOLFSSL_API int wc_ed25519_sign_msg(const byte *in, word32 inlen, byte *out, word32 *outlen, ed25519_key *key)
This function signs a message digest using an ed25519_key object to guarantee authenticity.
Definition: ed25519.c:263
WOLFSSL_API int wc_ed25519_priv_size(ed25519_key *key)
Returns the private key size (secret + public) in bytes.
Definition: ed25519.c:787
WOLFSSL_API int wc_ed25519_export_private_only(ed25519_key *key, byte *out, word32 *outLen)
This function exports only the private key from an ed25519_key structure. It stores the private key i...
Definition: ed25519.c:699
WOLFSSL_API int wc_ed25519_export_private(ed25519_key *key, byte *out, word32 *outLen)
Export the private key, including public part.
Definition: ed25519.c:722
WOLFSSL_API int wc_ed25519_pub_size(ed25519_key *key)
Returns the compressed key size in bytes (public key).
Definition: ed25519.c:796
WOLFSSL_API int wc_ed25519_import_private_key(const byte *priv, word32 privSz, const byte *pub, word32 pubSz, ed25519_key *key)
This function imports a public/private ed25519 key pair from a pair of buffers. This function will ha...
Definition: ed25519.c:663
WOLFSSL_API int wc_ed25519_init(ed25519_key *key)
This function initializes an ed25519_key object for future use with message verification.
Definition: ed25519.c:513
WOLFSSL_API int wc_ed25519_make_key(WC_RNG *rng, int keysize, ed25519_key *key)
This function generates a new ed25519_key and stores it in key.
Definition: ed25519.c:94
WOLFSSL_API int wc_ed25519_export_public(ed25519_key *, byte *out, word32 *outLen)
This function exports the private key from an ed25519_key structure. It stores the public key in the ...
Definition: ed25519.c:545
WOLFSSL_API void wc_ed25519_free(ed25519_key *key)
This function frees an ed25519 object after it has been used.
Definition: ed25519.c:529
WOLFSSL_API int wc_ed25519_sig_size(ed25519_key *key)
This function returns the size of an ed25519 signature (64 in bytes).
Definition: ed25519.c:805
WOLFSSL_API int wc_ed25519_export_key(ed25519_key *key, byte *priv, word32 *privSz, byte *pub, word32 *pubSz)
Export full private key and public key.
Definition: ed25519.c:742
WOLFSSL_API int wc_ed25519_size(ed25519_key *key)
This function returns the key size of an ed25519_key structure, or 32 bytes.
Definition: ed25519.c:778