mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Add function wrappers around macros, for crypto_auth and crypto_box
This commit is contained in:
@@ -1,6 +1,24 @@
|
||||
|
||||
#include "crypto_auth.h"
|
||||
|
||||
size_t
|
||||
crypto_auth_bytes(void)
|
||||
{
|
||||
return crypto_auth_BYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_auth_keybytes(void)
|
||||
{
|
||||
return crypto_auth_KEYBYTES;
|
||||
}
|
||||
|
||||
const char *
|
||||
crypto_auth_primitive(void)
|
||||
{
|
||||
return crypto_auth_PRIMITIVE;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_auth(unsigned char *out, const unsigned char *in,
|
||||
unsigned long long inlen, const unsigned char *k)
|
||||
|
||||
@@ -1,6 +1,54 @@
|
||||
|
||||
#include "crypto_box.h"
|
||||
|
||||
size_t
|
||||
crypto_box_publickeybytes(void)
|
||||
{
|
||||
return crypto_box_PUBLICKEYBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_box_secretkeybytes(void)
|
||||
{
|
||||
return crypto_box_SECRETKEYBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_box_beforenmbytes(void)
|
||||
{
|
||||
return crypto_box_BEFORENMBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_box_noncebytes(void)
|
||||
{
|
||||
return crypto_box_NONCEBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_box_zerobytes(void)
|
||||
{
|
||||
return crypto_box_ZEROBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_box_boxzerobytes(void)
|
||||
{
|
||||
return crypto_box_BOXZEROBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_box_macbytes(void)
|
||||
{
|
||||
return crypto_box_MACBYTES;
|
||||
}
|
||||
|
||||
const char *
|
||||
crypto_box_primitive(void)
|
||||
{
|
||||
return crypto_box_PRIMITIVE;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_box_keypair(unsigned char *pk, unsigned char *sk)
|
||||
{
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
#ifndef crypto_auth_H
|
||||
#define crypto_auth_H
|
||||
|
||||
#include "crypto_auth_hmacsha512256.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES
|
||||
#define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES
|
||||
#define crypto_auth_PRIMITIVE "hmacsha512256"
|
||||
#include "crypto_auth_hmacsha512256.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES
|
||||
size_t crypto_auth_bytes(void);
|
||||
|
||||
#define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES
|
||||
size_t crypto_auth_keybytes(void);
|
||||
|
||||
#define crypto_auth_PRIMITIVE "hmacsha512256"
|
||||
const char *crypto_auth_primitive(void);
|
||||
|
||||
int crypto_auth(unsigned char *out, const unsigned char *in,
|
||||
unsigned long long inlen, const unsigned char *k);
|
||||
|
||||
|
||||
@@ -1,16 +1,37 @@
|
||||
#ifndef crypto_box_H
|
||||
#define crypto_box_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "crypto_box_curve25519xsalsa20poly1305.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
|
||||
size_t crypto_box_publickeybytes(void);
|
||||
|
||||
#define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES
|
||||
size_t crypto_box_secretkeybytes(void);
|
||||
|
||||
#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES
|
||||
size_t crypto_box_beforenmbytes(void);
|
||||
|
||||
#define crypto_box_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_NONCEBYTES
|
||||
size_t crypto_box_noncebytes(void);
|
||||
|
||||
#define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES
|
||||
size_t crypto_box_zerobytes(void);
|
||||
|
||||
#define crypto_box_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES
|
||||
size_t crypto_box_boxzerobytes(void);
|
||||
|
||||
#define crypto_box_MACBYTES crypto_box_curve25519xsalsa20poly1305_MACBYTES
|
||||
size_t crypto_box_macbytes(void);
|
||||
|
||||
#define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305"
|
||||
const char *crypto_box_primitive(void);
|
||||
|
||||
int crypto_box_keypair(unsigned char *pk, unsigned char *sk);
|
||||
|
||||
@@ -33,4 +54,8 @@ int crypto_box_open(unsigned char *m, const unsigned char *c,
|
||||
unsigned long long clen, const unsigned char *n,
|
||||
const unsigned char *pk, const unsigned char *sk);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user