diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-02 09:53:34 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-02 09:53:34 -0400 |
commit | e2967396ac73cb7410787886cdaf072a184ffc49 (patch) | |
tree | 527a74d25a4a0705fc641994fd35bfab22662034 /nacl/crypto_box/curve25519xsalsa20poly1305/ref/before.c | |
parent | 8928c817df345f29aa0b194743595aa11bd6a8ba (diff) |
Added NaCl crypto library.
Diffstat (limited to 'nacl/crypto_box/curve25519xsalsa20poly1305/ref/before.c')
-rw-r--r-- | nacl/crypto_box/curve25519xsalsa20poly1305/ref/before.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/nacl/crypto_box/curve25519xsalsa20poly1305/ref/before.c b/nacl/crypto_box/curve25519xsalsa20poly1305/ref/before.c new file mode 100644 index 00000000..279bb12a --- /dev/null +++ b/nacl/crypto_box/curve25519xsalsa20poly1305/ref/before.c | |||
@@ -0,0 +1,17 @@ | |||
1 | #include "crypto_core_hsalsa20.h" | ||
2 | #include "crypto_scalarmult_curve25519.h" | ||
3 | #include "crypto_box.h" | ||
4 | |||
5 | static const unsigned char sigma[16] = "expand 32-byte k"; | ||
6 | static const unsigned char n[16] = {0}; | ||
7 | |||
8 | int crypto_box_beforenm( | ||
9 | unsigned char *k, | ||
10 | const unsigned char *pk, | ||
11 | const unsigned char *sk | ||
12 | ) | ||
13 | { | ||
14 | unsigned char s[32]; | ||
15 | crypto_scalarmult_curve25519(s,sk,pk); | ||
16 | return crypto_core_hsalsa20(k,n,s,sigma); | ||
17 | } | ||