File indexing completed on 2025-01-18 10:12:39
0001 #ifndef crypto_aead_aes256gcm_H
0002 #define crypto_aead_aes256gcm_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include <stddef.h>
0025 #include "export.h"
0026
0027 #ifdef __cplusplus
0028 # ifdef __GNUC__
0029 # pragma GCC diagnostic ignored "-Wlong-long"
0030 # endif
0031 extern "C" {
0032 #endif
0033
0034 SODIUM_EXPORT
0035 int crypto_aead_aes256gcm_is_available(void);
0036
0037 #define crypto_aead_aes256gcm_KEYBYTES 32U
0038 SODIUM_EXPORT
0039 size_t crypto_aead_aes256gcm_keybytes(void);
0040
0041 #define crypto_aead_aes256gcm_NSECBYTES 0U
0042 SODIUM_EXPORT
0043 size_t crypto_aead_aes256gcm_nsecbytes(void);
0044
0045 #define crypto_aead_aes256gcm_NPUBBYTES 12U
0046 SODIUM_EXPORT
0047 size_t crypto_aead_aes256gcm_npubbytes(void);
0048
0049 #define crypto_aead_aes256gcm_ABYTES 16U
0050 SODIUM_EXPORT
0051 size_t crypto_aead_aes256gcm_abytes(void);
0052
0053 #define crypto_aead_aes256gcm_MESSAGEBYTES_MAX \
0054 SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aes256gcm_ABYTES, \
0055 (16ULL * ((1ULL << 32) - 2ULL)))
0056 SODIUM_EXPORT
0057 size_t crypto_aead_aes256gcm_messagebytes_max(void);
0058
0059 typedef struct CRYPTO_ALIGN(16) crypto_aead_aes256gcm_state_ {
0060 unsigned char opaque[512];
0061 } crypto_aead_aes256gcm_state;
0062
0063 SODIUM_EXPORT
0064 size_t crypto_aead_aes256gcm_statebytes(void);
0065
0066 SODIUM_EXPORT
0067 int crypto_aead_aes256gcm_encrypt(unsigned char *c,
0068 unsigned long long *clen_p,
0069 const unsigned char *m,
0070 unsigned long long mlen,
0071 const unsigned char *ad,
0072 unsigned long long adlen,
0073 const unsigned char *nsec,
0074 const unsigned char *npub,
0075 const unsigned char *k)
0076 __attribute__ ((nonnull(1, 8, 9)));
0077
0078 SODIUM_EXPORT
0079 int crypto_aead_aes256gcm_decrypt(unsigned char *m,
0080 unsigned long long *mlen_p,
0081 unsigned char *nsec,
0082 const unsigned char *c,
0083 unsigned long long clen,
0084 const unsigned char *ad,
0085 unsigned long long adlen,
0086 const unsigned char *npub,
0087 const unsigned char *k)
0088 __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
0089
0090 SODIUM_EXPORT
0091 int crypto_aead_aes256gcm_encrypt_detached(unsigned char *c,
0092 unsigned char *mac,
0093 unsigned long long *maclen_p,
0094 const unsigned char *m,
0095 unsigned long long mlen,
0096 const unsigned char *ad,
0097 unsigned long long adlen,
0098 const unsigned char *nsec,
0099 const unsigned char *npub,
0100 const unsigned char *k)
0101 __attribute__ ((nonnull(1, 2, 9, 10)));
0102
0103 SODIUM_EXPORT
0104 int crypto_aead_aes256gcm_decrypt_detached(unsigned char *m,
0105 unsigned char *nsec,
0106 const unsigned char *c,
0107 unsigned long long clen,
0108 const unsigned char *mac,
0109 const unsigned char *ad,
0110 unsigned long long adlen,
0111 const unsigned char *npub,
0112 const unsigned char *k)
0113 __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
0114
0115
0116
0117 SODIUM_EXPORT
0118 int crypto_aead_aes256gcm_beforenm(crypto_aead_aes256gcm_state *ctx_,
0119 const unsigned char *k)
0120 __attribute__ ((nonnull));
0121
0122 SODIUM_EXPORT
0123 int crypto_aead_aes256gcm_encrypt_afternm(unsigned char *c,
0124 unsigned long long *clen_p,
0125 const unsigned char *m,
0126 unsigned long long mlen,
0127 const unsigned char *ad,
0128 unsigned long long adlen,
0129 const unsigned char *nsec,
0130 const unsigned char *npub,
0131 const crypto_aead_aes256gcm_state *ctx_)
0132 __attribute__ ((nonnull(1, 8, 9)));
0133
0134 SODIUM_EXPORT
0135 int crypto_aead_aes256gcm_decrypt_afternm(unsigned char *m,
0136 unsigned long long *mlen_p,
0137 unsigned char *nsec,
0138 const unsigned char *c,
0139 unsigned long long clen,
0140 const unsigned char *ad,
0141 unsigned long long adlen,
0142 const unsigned char *npub,
0143 const crypto_aead_aes256gcm_state *ctx_)
0144 __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
0145
0146 SODIUM_EXPORT
0147 int crypto_aead_aes256gcm_encrypt_detached_afternm(unsigned char *c,
0148 unsigned char *mac,
0149 unsigned long long *maclen_p,
0150 const unsigned char *m,
0151 unsigned long long mlen,
0152 const unsigned char *ad,
0153 unsigned long long adlen,
0154 const unsigned char *nsec,
0155 const unsigned char *npub,
0156 const crypto_aead_aes256gcm_state *ctx_)
0157 __attribute__ ((nonnull(1, 2, 9, 10)));
0158
0159 SODIUM_EXPORT
0160 int crypto_aead_aes256gcm_decrypt_detached_afternm(unsigned char *m,
0161 unsigned char *nsec,
0162 const unsigned char *c,
0163 unsigned long long clen,
0164 const unsigned char *mac,
0165 const unsigned char *ad,
0166 unsigned long long adlen,
0167 const unsigned char *npub,
0168 const crypto_aead_aes256gcm_state *ctx_)
0169 __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
0170
0171 SODIUM_EXPORT
0172 void crypto_aead_aes256gcm_keygen(unsigned char k[crypto_aead_aes256gcm_KEYBYTES])
0173 __attribute__ ((nonnull));
0174
0175 #ifdef __cplusplus
0176 }
0177 #endif
0178
0179 #endif