Commit 5da2389f by Ferdinand Bachmann Committed by Sebastian Renner

new ascon

parent 0f49c046
#define CRYPTO_KEYBYTES 16
#define CRYPTO_NSECBYTES 0
#define CRYPTO_NPUBBYTES 16
#define CRYPTO_ABYTES 16
#define CRYPTO_NOOVERLAP 1
#include "api.h"
int ascon_core(unsigned char * outptr,
const unsigned char * inptr, unsigned int inlen,
const unsigned char * adptr, unsigned int adlen,
const unsigned char * nptr, const unsigned char * kptr,
unsigned char mode);
#include "ascon.h"
int crypto_aead_decrypt(unsigned char* m, unsigned long long* mlen,
unsigned char* nsec, const unsigned char* c,
unsigned long long clen, const unsigned char* ad,
unsigned long long adlen, const unsigned char* npub,
const unsigned char* k) {
if (clen < CRYPTO_ABYTES) {
*mlen = 0;
return -1;
}
*mlen = clen - CRYPTO_ABYTES;
(void)nsec;
return ascon_core(m, c, *mlen, ad, adlen, npub, k, -1);
}
#include "ascon.h"
int crypto_aead_encrypt(unsigned char* c, unsigned long long* clen,
const unsigned char* m, unsigned long long mlen,
const unsigned char* ad, unsigned long long adlen,
const unsigned char* nsec, const unsigned char* npub,
const unsigned char* k) {
*clen = mlen + CRYPTO_ABYTES;
(void)nsec;
return ascon_core(c, m, mlen, ad, adlen, npub, k, 1);
}
#define CRYPTO_KEYBYTES 16
#define CRYPTO_NSECBYTES 0
#define CRYPTO_NPUBBYTES 16
#define CRYPTO_ABYTES 16
#define CRYPTO_NOOVERLAP 1
#include "api.h"
int ascon_core(unsigned char * outptr,
const unsigned char * inptr, unsigned int inlen,
const unsigned char * adptr, unsigned int adlen,
const unsigned char * nptr, const unsigned char * kptr,
unsigned char mode);
#include "ascon.h"
int crypto_aead_decrypt(unsigned char* m, unsigned long long* mlen,
unsigned char* nsec, const unsigned char* c,
unsigned long long clen, const unsigned char* ad,
unsigned long long adlen, const unsigned char* npub,
const unsigned char* k) {
if (clen < CRYPTO_ABYTES) {
*mlen = 0;
return -1;
}
*mlen = clen - CRYPTO_ABYTES;
(void)nsec;
return ascon_core(m, c, *mlen, ad, adlen, npub, k, -1);
}
#include "ascon.h"
int crypto_aead_encrypt(unsigned char* c, unsigned long long* clen,
const unsigned char* m, unsigned long long mlen,
const unsigned char* ad, unsigned long long adlen,
const unsigned char* nsec, const unsigned char* npub,
const unsigned char* k) {
*clen = mlen + CRYPTO_ABYTES;
(void)nsec;
return ascon_core(c, m, mlen, ad, adlen, npub, k, 1);
}
#define CRYPTO_KEYBYTES 20
#define CRYPTO_NSECBYTES 0
#define CRYPTO_NPUBBYTES 16
#define CRYPTO_ABYTES 16
#define CRYPTO_NOOVERLAP 1
#include "api.h"
int ascon_core(unsigned char * outptr,
const unsigned char * inptr, unsigned int inlen,
const unsigned char * adptr, unsigned int adlen,
const unsigned char * nptr, const unsigned char * kptr,
unsigned char mode);
#include "ascon.h"
int crypto_aead_decrypt(unsigned char* m, unsigned long long* mlen,
unsigned char* nsec, const unsigned char* c,
unsigned long long clen, const unsigned char* ad,
unsigned long long adlen, const unsigned char* npub,
const unsigned char* k) {
if (clen < CRYPTO_ABYTES) {
*mlen = 0;
return -1;
}
*mlen = clen - CRYPTO_ABYTES;
(void)nsec;
return ascon_core(m, c, *mlen, ad, adlen, npub, k, -1);
}
#include "ascon.h"
int crypto_aead_encrypt(unsigned char* c, unsigned long long* clen,
const unsigned char* m, unsigned long long mlen,
const unsigned char* ad, unsigned long long adlen,
const unsigned char* nsec, const unsigned char* npub,
const unsigned char* k) {
*clen = mlen + CRYPTO_ABYTES;
(void)nsec;
return ascon_core(c, m, mlen, ad, adlen, npub, k, 1);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment