File indexing completed on 2025-01-18 10:12:40
0001 #ifndef crypto_sign_ed25519_H
0002 #define crypto_sign_ed25519_H
0003
0004 #include <stddef.h>
0005 #include "crypto_hash_sha512.h"
0006 #include "export.h"
0007
0008 #ifdef __cplusplus
0009 # ifdef __GNUC__
0010 # pragma GCC diagnostic ignored "-Wlong-long"
0011 # endif
0012 extern "C" {
0013 #endif
0014
0015 typedef struct crypto_sign_ed25519ph_state {
0016 crypto_hash_sha512_state hs;
0017 } crypto_sign_ed25519ph_state;
0018
0019 SODIUM_EXPORT
0020 size_t crypto_sign_ed25519ph_statebytes(void);
0021
0022 #define crypto_sign_ed25519_BYTES 64U
0023 SODIUM_EXPORT
0024 size_t crypto_sign_ed25519_bytes(void);
0025
0026 #define crypto_sign_ed25519_SEEDBYTES 32U
0027 SODIUM_EXPORT
0028 size_t crypto_sign_ed25519_seedbytes(void);
0029
0030 #define crypto_sign_ed25519_PUBLICKEYBYTES 32U
0031 SODIUM_EXPORT
0032 size_t crypto_sign_ed25519_publickeybytes(void);
0033
0034 #define crypto_sign_ed25519_SECRETKEYBYTES (32U + 32U)
0035 SODIUM_EXPORT
0036 size_t crypto_sign_ed25519_secretkeybytes(void);
0037
0038 #define crypto_sign_ed25519_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES)
0039 SODIUM_EXPORT
0040 size_t crypto_sign_ed25519_messagebytes_max(void);
0041
0042 SODIUM_EXPORT
0043 int crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p,
0044 const unsigned char *m, unsigned long long mlen,
0045 const unsigned char *sk)
0046 __attribute__ ((nonnull(1, 5)));
0047
0048 SODIUM_EXPORT
0049 int crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p,
0050 const unsigned char *sm, unsigned long long smlen,
0051 const unsigned char *pk)
0052 __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5)));
0053
0054 SODIUM_EXPORT
0055 int crypto_sign_ed25519_detached(unsigned char *sig,
0056 unsigned long long *siglen_p,
0057 const unsigned char *m,
0058 unsigned long long mlen,
0059 const unsigned char *sk)
0060 __attribute__ ((nonnull(1, 5)));
0061
0062 SODIUM_EXPORT
0063 int crypto_sign_ed25519_verify_detached(const unsigned char *sig,
0064 const unsigned char *m,
0065 unsigned long long mlen,
0066 const unsigned char *pk)
0067 __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
0068
0069 SODIUM_EXPORT
0070 int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk)
0071 __attribute__ ((nonnull));
0072
0073 SODIUM_EXPORT
0074 int crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk,
0075 const unsigned char *seed)
0076 __attribute__ ((nonnull));
0077
0078 SODIUM_EXPORT
0079 int crypto_sign_ed25519_pk_to_curve25519(unsigned char *curve25519_pk,
0080 const unsigned char *ed25519_pk)
0081 __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
0082
0083 SODIUM_EXPORT
0084 int crypto_sign_ed25519_sk_to_curve25519(unsigned char *curve25519_sk,
0085 const unsigned char *ed25519_sk)
0086 __attribute__ ((nonnull));
0087
0088 SODIUM_EXPORT
0089 int crypto_sign_ed25519_sk_to_seed(unsigned char *seed,
0090 const unsigned char *sk)
0091 __attribute__ ((nonnull));
0092
0093 SODIUM_EXPORT
0094 int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk)
0095 __attribute__ ((nonnull));
0096
0097 SODIUM_EXPORT
0098 int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state *state)
0099 __attribute__ ((nonnull));
0100
0101 SODIUM_EXPORT
0102 int crypto_sign_ed25519ph_update(crypto_sign_ed25519ph_state *state,
0103 const unsigned char *m,
0104 unsigned long long mlen)
0105 __attribute__ ((nonnull(1)));
0106
0107 SODIUM_EXPORT
0108 int crypto_sign_ed25519ph_final_create(crypto_sign_ed25519ph_state *state,
0109 unsigned char *sig,
0110 unsigned long long *siglen_p,
0111 const unsigned char *sk)
0112 __attribute__ ((nonnull(1, 2, 4)));
0113
0114 SODIUM_EXPORT
0115 int crypto_sign_ed25519ph_final_verify(crypto_sign_ed25519ph_state *state,
0116 const unsigned char *sig,
0117 const unsigned char *pk)
0118 __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
0119
0120 #ifdef __cplusplus
0121 }
0122 #endif
0123
0124 #endif