summaryrefslogtreecommitdiff
path: root/nacl/crypto_box/curve25519xsalsa20poly1305/ref/box.c
diff options
context:
space:
mode:
Diffstat (limited to 'nacl/crypto_box/curve25519xsalsa20poly1305/ref/box.c')
-rw-r--r--nacl/crypto_box/curve25519xsalsa20poly1305/ref/box.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/nacl/crypto_box/curve25519xsalsa20poly1305/ref/box.c b/nacl/crypto_box/curve25519xsalsa20poly1305/ref/box.c
new file mode 100644
index 00000000..81ff72e2
--- /dev/null
+++ b/nacl/crypto_box/curve25519xsalsa20poly1305/ref/box.c
@@ -0,0 +1,27 @@
1#include "crypto_box.h"
2
3int crypto_box(
4 unsigned char *c,
5 const unsigned char *m,unsigned long long mlen,
6 const unsigned char *n,
7 const unsigned char *pk,
8 const unsigned char *sk
9)
10{
11 unsigned char k[crypto_box_BEFORENMBYTES];
12 crypto_box_beforenm(k,pk,sk);
13 return crypto_box_afternm(c,m,mlen,n,k);
14}
15
16int crypto_box_open(
17 unsigned char *m,
18 const unsigned char *c,unsigned long long clen,
19 const unsigned char *n,
20 const unsigned char *pk,
21 const unsigned char *sk
22)
23{
24 unsigned char k[crypto_box_BEFORENMBYTES];
25 crypto_box_beforenm(k,pk,sk);
26 return crypto_box_open_afternm(m,c,clen,n,k);
27}