}
static gboolean
-rspamd_cryptobox_auth_final (void *auth_ctx, rspamd_sig_t sig)
+rspamd_cryptobox_auth_final (void *auth_ctx, rspamd_mac_t sig)
{
if (G_LIKELY (!use_openssl)) {
poly1305_finish (auth_ctx, sig);
EVP_CIPHER_CTX *s = auth_ctx;
g_assert (EVP_CIPHER_CTX_ctrl (s, EVP_CTRL_GCM_GET_TAG,
- sizeof (rspamd_sig_t), sig) == 1);
+ sizeof (rspamd_mac_t), sig) == 1);
return TRUE;
#endif
}
static gboolean
-rspamd_cryptobox_auth_verify_final (void *auth_ctx, const rspamd_sig_t sig)
+rspamd_cryptobox_auth_verify_final (void *auth_ctx, const rspamd_mac_t sig)
{
if (G_LIKELY (!use_openssl)) {
- rspamd_sig_t mac;
+ rspamd_mac_t mac;
poly1305_finish (auth_ctx, mac);
void rspamd_cryptobox_encrypt_nm_inplace (guchar *data, gsize len,
const rspamd_nonce_t nonce,
const rspamd_nm_t nm,
- rspamd_sig_t sig)
+ rspamd_mac_t sig)
{
gsize r;
void *enc_ctx, *auth_ctx;
rspamd_cryptobox_encryptv_nm_inplace (struct rspamd_cryptobox_segment *segments,
gsize cnt,
const rspamd_nonce_t nonce,
- const rspamd_nm_t nm, rspamd_sig_t sig)
+ const rspamd_nm_t nm, rspamd_mac_t sig)
{
struct rspamd_cryptobox_segment *cur = segments, *start_seg = segments;
guchar outbuf[CHACHA_BLOCKBYTES * 16];
gboolean
rspamd_cryptobox_decrypt_nm_inplace (guchar *data, gsize len,
- const rspamd_nonce_t nonce, const rspamd_nm_t nm, const rspamd_sig_t sig)
+ const rspamd_nonce_t nonce, const rspamd_nm_t nm, const rspamd_mac_t sig)
{
gsize r = 0;
gboolean ret = TRUE;
gboolean
rspamd_cryptobox_decrypt_inplace (guchar *data, gsize len,
const rspamd_nonce_t nonce,
- const rspamd_pk_t pk, const rspamd_sk_t sk, const rspamd_sig_t sig)
+ const rspamd_pk_t pk, const rspamd_sk_t sk, const rspamd_mac_t sig)
{
guchar nm[rspamd_cryptobox_MAX_NMBYTES];
gboolean ret;
void
rspamd_cryptobox_encrypt_inplace (guchar *data, gsize len,
const rspamd_nonce_t nonce,
- const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_sig_t sig)
+ const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_mac_t sig)
{
guchar nm[rspamd_cryptobox_MAX_NMBYTES];
rspamd_cryptobox_encryptv_inplace (struct rspamd_cryptobox_segment *segments,
gsize cnt,
const rspamd_nonce_t nonce,
- const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_sig_t sig)
+ const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_mac_t sig)
{
guchar nm[rspamd_cryptobox_MAX_NMBYTES];
#define rspamd_cryptobox_HASHBYTES 64
#define rspamd_cryptobox_HASHKEYBYTES 64
#define rspamd_cryptobox_HASHSTATEBYTES 256
+#define rspamd_cryptobox_MAX_SIGSKBYTES 64
+#define rspamd_cryptobox_MAX_SIGPKBYTES 32
+#define rspamd_cryptobox_MAX_SIGBYTES 64
#define CPUID_AVX2 0x1
#define CPUID_AVX 0x2
typedef guchar rspamd_pk_t[rspamd_cryptobox_MAX_PKBYTES];
typedef guchar rspamd_sk_t[rspamd_cryptobox_MAX_SKBYTES];
-typedef guchar rspamd_sig_t[rspamd_cryptobox_MAX_MACBYTES];
+typedef guchar rspamd_mac_t[rspamd_cryptobox_MAX_MACBYTES];
typedef guchar rspamd_nm_t[rspamd_cryptobox_MAX_NMBYTES];
typedef guchar rspamd_nonce_t[rspamd_cryptobox_MAX_NONCEBYTES];
typedef guchar rspamd_sipkey_t[rspamd_cryptobox_SIPKEYBYTES];
*/
void rspamd_cryptobox_encrypt_inplace (guchar *data, gsize len,
const rspamd_nonce_t nonce,
- const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_sig_t sig);
+ const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_mac_t sig);
/**
* Encrypt segments of data inplace adding signature to sig afterwards
void rspamd_cryptobox_encryptv_inplace (struct rspamd_cryptobox_segment *segments,
gsize cnt,
const rspamd_nonce_t nonce,
- const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_sig_t sig);
+ const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_mac_t sig);
/**
*/
gboolean rspamd_cryptobox_decrypt_inplace (guchar *data, gsize len,
const rspamd_nonce_t nonce,
- const rspamd_pk_t pk, const rspamd_sk_t sk, const rspamd_sig_t sig);
+ const rspamd_pk_t pk, const rspamd_sk_t sk, const rspamd_mac_t sig);
/**
* Encrypt segments of data inplace adding signature to sig afterwards
*/
void rspamd_cryptobox_encrypt_nm_inplace (guchar *data, gsize len,
const rspamd_nonce_t nonce,
- const rspamd_nm_t nm, rspamd_sig_t sig);
+ const rspamd_nm_t nm, rspamd_mac_t sig);
/**
* Encrypt segments of data inplace adding signature to sig afterwards
void rspamd_cryptobox_encryptv_nm_inplace (struct rspamd_cryptobox_segment *segments,
gsize cnt,
const rspamd_nonce_t nonce,
- const rspamd_nm_t nm, rspamd_sig_t sig);
+ const rspamd_nm_t nm, rspamd_mac_t sig);
/**
*/
gboolean rspamd_cryptobox_decrypt_nm_inplace (guchar *data, gsize len,
const rspamd_nonce_t nonce,
- const rspamd_nm_t nm, const rspamd_sig_t sig);
+ const rspamd_nm_t nm, const rspamd_mac_t sig);
/**
* Generate shared secret from local sk and remote pk
static void
check_result (const rspamd_nm_t key, const rspamd_nonce_t nonce,
- const rspamd_sig_t mac, guchar *begin, guchar *end)
+ const rspamd_mac_t mac, guchar *begin, guchar *end)
{
guint64 *t = (guint64 *)begin;
guchar *begin, *end;
rspamd_nm_t key;
rspamd_nonce_t nonce;
- rspamd_sig_t mac;
+ rspamd_mac_t mac;
struct rspamd_cryptobox_segment *seg;
double t1, t2;
gint i, cnt, ms;