From 9177909d03533fc18e4c23ba0971a999edd53fc2 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 19 Jan 2013 16:44:08 -0800 Subject: [PATCH] Remove C++ wrappers --- src/libnacl/crypto_auth/wrapper-auth.cpp | 11 ---- src/libnacl/crypto_auth/wrapper-verify.cpp | 14 ---- src/libnacl/crypto_box/wrapper-box.cpp | 24 ------- src/libnacl/crypto_box/wrapper-keypair.cpp | 12 ---- src/libnacl/crypto_box/wrapper-open.cpp | 27 -------- src/libnacl/crypto_core/wrapper-empty.cpp | 0 src/libnacl/crypto_hash/wrapper-hash.cpp | 10 --- .../crypto_hashblocks/wrapper-empty.cpp | 0 .../crypto_onetimeauth/wrapper-auth.cpp | 11 ---- .../crypto_onetimeauth/wrapper-verify.cpp | 14 ---- .../crypto_scalarmult/wrapper-base.cpp | 11 ---- .../crypto_scalarmult/wrapper-mult.cpp | 12 ---- src/libnacl/crypto_secretbox/wrapper-box.cpp | 19 ------ src/libnacl/crypto_secretbox/wrapper-open.cpp | 22 ------- src/libnacl/crypto_sign/wrapper-keypair.cpp | 12 ---- src/libnacl/crypto_sign/wrapper-sign-open.cpp | 24 ------- src/libnacl/crypto_sign/wrapper-sign.cpp | 22 ------- src/libnacl/crypto_stream/wrapper-stream.cpp | 12 ---- src/libnacl/crypto_stream/wrapper-xor.cpp | 17 ----- src/libnacl/crypto_verify/wrapper-empty.cpp | 0 src/libnacl/dist-files | 45 ------------- src/libnacl/okcompilers/lib.cpp | 19 ------ src/libnacl/okcompilers/main.cpp | 22 ------- src/libnacl/okcompilers/test5.cpp | 22 ------- src/libnacl/tests/auth4.cpp | 44 ------------- src/libnacl/tests/auth6.cpp | 46 ------------- src/libnacl/tests/box3.cpp | 60 ----------------- src/libnacl/tests/box4.cpp | 66 ------------------- src/libnacl/tests/box5.cpp | 30 --------- src/libnacl/tests/box6.cpp | 43 ------------ src/libnacl/tests/hash2.cpp | 18 ----- src/libnacl/tests/hash4.cpp | 18 ----- src/libnacl/tests/onetimeauth5.cpp | 46 ------------- src/libnacl/tests/onetimeauth6.cpp | 50 -------------- src/libnacl/tests/onetimeauth8.cpp | 46 ------------- src/libnacl/tests/scalarmult3.cpp | 31 --------- src/libnacl/tests/scalarmult4.cpp | 31 --------- src/libnacl/tests/scalarmult7.cpp | 32 --------- src/libnacl/tests/secretbox3.cpp | 52 --------------- src/libnacl/tests/secretbox4.cpp | 54 --------------- src/libnacl/tests/secretbox5.cpp | 29 -------- src/libnacl/tests/secretbox6.cpp | 42 ------------ src/libnacl/tests/stream5.cpp | 29 -------- src/libnacl/tests/stream6.cpp | 27 -------- src/libnacl/tests/stream7.cpp | 30 --------- src/libnacl/tests/stream8.cpp | 56 ---------------- 46 files changed, 1262 deletions(-) delete mode 100644 src/libnacl/crypto_auth/wrapper-auth.cpp delete mode 100644 src/libnacl/crypto_auth/wrapper-verify.cpp delete mode 100644 src/libnacl/crypto_box/wrapper-box.cpp delete mode 100644 src/libnacl/crypto_box/wrapper-keypair.cpp delete mode 100644 src/libnacl/crypto_box/wrapper-open.cpp delete mode 100644 src/libnacl/crypto_core/wrapper-empty.cpp delete mode 100644 src/libnacl/crypto_hash/wrapper-hash.cpp delete mode 100644 src/libnacl/crypto_hashblocks/wrapper-empty.cpp delete mode 100644 src/libnacl/crypto_onetimeauth/wrapper-auth.cpp delete mode 100644 src/libnacl/crypto_onetimeauth/wrapper-verify.cpp delete mode 100644 src/libnacl/crypto_scalarmult/wrapper-base.cpp delete mode 100644 src/libnacl/crypto_scalarmult/wrapper-mult.cpp delete mode 100644 src/libnacl/crypto_secretbox/wrapper-box.cpp delete mode 100644 src/libnacl/crypto_secretbox/wrapper-open.cpp delete mode 100644 src/libnacl/crypto_sign/wrapper-keypair.cpp delete mode 100644 src/libnacl/crypto_sign/wrapper-sign-open.cpp delete mode 100644 src/libnacl/crypto_sign/wrapper-sign.cpp delete mode 100644 src/libnacl/crypto_stream/wrapper-stream.cpp delete mode 100644 src/libnacl/crypto_stream/wrapper-xor.cpp delete mode 100644 src/libnacl/crypto_verify/wrapper-empty.cpp delete mode 100644 src/libnacl/okcompilers/lib.cpp delete mode 100644 src/libnacl/okcompilers/main.cpp delete mode 100644 src/libnacl/okcompilers/test5.cpp delete mode 100644 src/libnacl/tests/auth4.cpp delete mode 100644 src/libnacl/tests/auth6.cpp delete mode 100644 src/libnacl/tests/box3.cpp delete mode 100644 src/libnacl/tests/box4.cpp delete mode 100644 src/libnacl/tests/box5.cpp delete mode 100644 src/libnacl/tests/box6.cpp delete mode 100644 src/libnacl/tests/hash2.cpp delete mode 100644 src/libnacl/tests/hash4.cpp delete mode 100644 src/libnacl/tests/onetimeauth5.cpp delete mode 100644 src/libnacl/tests/onetimeauth6.cpp delete mode 100644 src/libnacl/tests/onetimeauth8.cpp delete mode 100644 src/libnacl/tests/scalarmult3.cpp delete mode 100644 src/libnacl/tests/scalarmult4.cpp delete mode 100644 src/libnacl/tests/scalarmult7.cpp delete mode 100644 src/libnacl/tests/secretbox3.cpp delete mode 100644 src/libnacl/tests/secretbox4.cpp delete mode 100644 src/libnacl/tests/secretbox5.cpp delete mode 100644 src/libnacl/tests/secretbox6.cpp delete mode 100644 src/libnacl/tests/stream5.cpp delete mode 100644 src/libnacl/tests/stream6.cpp delete mode 100644 src/libnacl/tests/stream7.cpp delete mode 100644 src/libnacl/tests/stream8.cpp diff --git a/src/libnacl/crypto_auth/wrapper-auth.cpp b/src/libnacl/crypto_auth/wrapper-auth.cpp deleted file mode 100644 index 2108aa31..00000000 --- a/src/libnacl/crypto_auth/wrapper-auth.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -using std::string; -#include "crypto_auth.h" - -string crypto_auth(const string &m,const string &k) -{ - if (k.size() != crypto_auth_KEYBYTES) throw "incorrect key length"; - unsigned char a[crypto_auth_BYTES]; - crypto_auth(a,(const unsigned char *) m.c_str(),m.size(),(const unsigned char *) k.c_str()); - return string((char *) a,crypto_auth_BYTES); -} diff --git a/src/libnacl/crypto_auth/wrapper-verify.cpp b/src/libnacl/crypto_auth/wrapper-verify.cpp deleted file mode 100644 index 57e25a26..00000000 --- a/src/libnacl/crypto_auth/wrapper-verify.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -using std::string; -#include "crypto_auth.h" - -void crypto_auth_verify(const string &a,const string &m,const string &k) -{ - if (k.size() != crypto_auth_KEYBYTES) throw "incorrect key length"; - if (a.size() != crypto_auth_BYTES) throw "incorrect authenticator length"; - if (crypto_auth_verify( - (const unsigned char *) a.c_str(), - (const unsigned char *) m.c_str(),m.size(), - (const unsigned char *) k.c_str()) == 0) return; - throw "invalid authenticator"; -} diff --git a/src/libnacl/crypto_box/wrapper-box.cpp b/src/libnacl/crypto_box/wrapper-box.cpp deleted file mode 100644 index f0429295..00000000 --- a/src/libnacl/crypto_box/wrapper-box.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -using std::string; -#include "crypto_box.h" - -string crypto_box(const string &m,const string &n,const string &pk,const string &sk) -{ - if (pk.size() != crypto_box_PUBLICKEYBYTES) throw "incorrect public-key length"; - if (sk.size() != crypto_box_SECRETKEYBYTES) throw "incorrect secret-key length"; - if (n.size() != crypto_box_NONCEBYTES) throw "incorrect nonce length"; - size_t mlen = m.size() + crypto_box_ZEROBYTES; - unsigned char mpad[mlen]; - for (int i = 0;i < crypto_box_ZEROBYTES;++i) mpad[i] = 0; - for (int i = crypto_box_ZEROBYTES;i < mlen;++i) mpad[i] = m[i - crypto_box_ZEROBYTES]; - unsigned char cpad[mlen]; - crypto_box(cpad,mpad,mlen, - (const unsigned char *) n.c_str(), - (const unsigned char *) pk.c_str(), - (const unsigned char *) sk.c_str() - ); - return string( - (char *) cpad + crypto_box_BOXZEROBYTES, - mlen - crypto_box_BOXZEROBYTES - ); -} diff --git a/src/libnacl/crypto_box/wrapper-keypair.cpp b/src/libnacl/crypto_box/wrapper-keypair.cpp deleted file mode 100644 index b59f92d9..00000000 --- a/src/libnacl/crypto_box/wrapper-keypair.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -using std::string; -#include "crypto_box.h" - -string crypto_box_keypair(string *sk_string) -{ - unsigned char pk[crypto_box_PUBLICKEYBYTES]; - unsigned char sk[crypto_box_SECRETKEYBYTES]; - crypto_box_keypair(pk,sk); - *sk_string = string((char *) sk,sizeof sk); - return string((char *) pk,sizeof pk); -} diff --git a/src/libnacl/crypto_box/wrapper-open.cpp b/src/libnacl/crypto_box/wrapper-open.cpp deleted file mode 100644 index 67663a21..00000000 --- a/src/libnacl/crypto_box/wrapper-open.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -using std::string; -#include "crypto_box.h" - -string crypto_box_open(const string &c,const string &n,const string &pk,const string &sk) -{ - if (pk.size() != crypto_box_PUBLICKEYBYTES) throw "incorrect public-key length"; - if (sk.size() != crypto_box_SECRETKEYBYTES) throw "incorrect secret-key length"; - if (n.size() != crypto_box_NONCEBYTES) throw "incorrect nonce length"; - size_t clen = c.size() + crypto_box_BOXZEROBYTES; - unsigned char cpad[clen]; - for (int i = 0;i < crypto_box_BOXZEROBYTES;++i) cpad[i] = 0; - for (int i = crypto_box_BOXZEROBYTES;i < clen;++i) cpad[i] = c[i - crypto_box_BOXZEROBYTES]; - unsigned char mpad[clen]; - if (crypto_box_open(mpad,cpad,clen, - (const unsigned char *) n.c_str(), - (const unsigned char *) pk.c_str(), - (const unsigned char *) sk.c_str() - ) != 0) - throw "ciphertext fails verification"; - if (clen < crypto_box_ZEROBYTES) - throw "ciphertext too short"; // should have been caught by _open - return string( - (char *) mpad + crypto_box_ZEROBYTES, - clen - crypto_box_ZEROBYTES - ); -} diff --git a/src/libnacl/crypto_core/wrapper-empty.cpp b/src/libnacl/crypto_core/wrapper-empty.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_hash/wrapper-hash.cpp b/src/libnacl/crypto_hash/wrapper-hash.cpp deleted file mode 100644 index 4c0fb590..00000000 --- a/src/libnacl/crypto_hash/wrapper-hash.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -using std::string; -#include "crypto_hash.h" - -string crypto_hash(const string &m) -{ - unsigned char h[crypto_hash_BYTES]; - crypto_hash(h,(const unsigned char *) m.c_str(),m.size()); - return string((char *) h,sizeof h); -} diff --git a/src/libnacl/crypto_hashblocks/wrapper-empty.cpp b/src/libnacl/crypto_hashblocks/wrapper-empty.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/crypto_onetimeauth/wrapper-auth.cpp b/src/libnacl/crypto_onetimeauth/wrapper-auth.cpp deleted file mode 100644 index f4279607..00000000 --- a/src/libnacl/crypto_onetimeauth/wrapper-auth.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -using std::string; -#include "crypto_onetimeauth.h" - -string crypto_onetimeauth(const string &m,const string &k) -{ - if (k.size() != crypto_onetimeauth_KEYBYTES) throw "incorrect key length"; - unsigned char a[crypto_onetimeauth_BYTES]; - crypto_onetimeauth(a,(const unsigned char *) m.c_str(),m.size(),(const unsigned char *) k.c_str()); - return string((char *) a,crypto_onetimeauth_BYTES); -} diff --git a/src/libnacl/crypto_onetimeauth/wrapper-verify.cpp b/src/libnacl/crypto_onetimeauth/wrapper-verify.cpp deleted file mode 100644 index 248239ee..00000000 --- a/src/libnacl/crypto_onetimeauth/wrapper-verify.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -using std::string; -#include "crypto_onetimeauth.h" - -void crypto_onetimeauth_verify(const string &a,const string &m,const string &k) -{ - if (k.size() != crypto_onetimeauth_KEYBYTES) throw "incorrect key length"; - if (a.size() != crypto_onetimeauth_BYTES) throw "incorrect authenticator length"; - if (crypto_onetimeauth_verify( - (const unsigned char *) a.c_str(), - (const unsigned char *) m.c_str(),m.size(), - (const unsigned char *) k.c_str()) == 0) return; - throw "invalid authenticator"; -} diff --git a/src/libnacl/crypto_scalarmult/wrapper-base.cpp b/src/libnacl/crypto_scalarmult/wrapper-base.cpp deleted file mode 100644 index f71ce19a..00000000 --- a/src/libnacl/crypto_scalarmult/wrapper-base.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -using std::string; -#include "crypto_scalarmult.h" - -string crypto_scalarmult_base(const string &n) -{ - unsigned char q[crypto_scalarmult_BYTES]; - if (n.size() != crypto_scalarmult_SCALARBYTES) throw "incorrect scalar length"; - crypto_scalarmult_base(q,(const unsigned char *) n.c_str()); - return string((char *) q,sizeof q); -} diff --git a/src/libnacl/crypto_scalarmult/wrapper-mult.cpp b/src/libnacl/crypto_scalarmult/wrapper-mult.cpp deleted file mode 100644 index fc693cf0..00000000 --- a/src/libnacl/crypto_scalarmult/wrapper-mult.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -using std::string; -#include "crypto_scalarmult.h" - -string crypto_scalarmult(const string &n,const string &p) -{ - unsigned char q[crypto_scalarmult_BYTES]; - if (n.size() != crypto_scalarmult_SCALARBYTES) throw "incorrect scalar length"; - if (p.size() != crypto_scalarmult_BYTES) throw "incorrect element length"; - crypto_scalarmult(q,(const unsigned char *) n.c_str(),(const unsigned char *) p.c_str()); - return string((char *) q,sizeof q); -} diff --git a/src/libnacl/crypto_secretbox/wrapper-box.cpp b/src/libnacl/crypto_secretbox/wrapper-box.cpp deleted file mode 100644 index fb8b1784..00000000 --- a/src/libnacl/crypto_secretbox/wrapper-box.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -using std::string; -#include "crypto_secretbox.h" - -string crypto_secretbox(const string &m,const string &n,const string &k) -{ - if (k.size() != crypto_secretbox_KEYBYTES) throw "incorrect key length"; - if (n.size() != crypto_secretbox_NONCEBYTES) throw "incorrect nonce length"; - size_t mlen = m.size() + crypto_secretbox_ZEROBYTES; - unsigned char mpad[mlen]; - for (int i = 0;i < crypto_secretbox_ZEROBYTES;++i) mpad[i] = 0; - for (int i = crypto_secretbox_ZEROBYTES;i < mlen;++i) mpad[i] = m[i - crypto_secretbox_ZEROBYTES]; - unsigned char cpad[mlen]; - crypto_secretbox(cpad,mpad,mlen,(const unsigned char *) n.c_str(),(const unsigned char *) k.c_str()); - return string( - (char *) cpad + crypto_secretbox_BOXZEROBYTES, - mlen - crypto_secretbox_BOXZEROBYTES - ); -} diff --git a/src/libnacl/crypto_secretbox/wrapper-open.cpp b/src/libnacl/crypto_secretbox/wrapper-open.cpp deleted file mode 100644 index 07989813..00000000 --- a/src/libnacl/crypto_secretbox/wrapper-open.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -using std::string; -#include "crypto_secretbox.h" - -string crypto_secretbox_open(const string &c,const string &n,const string &k) -{ - if (k.size() != crypto_secretbox_KEYBYTES) throw "incorrect key length"; - if (n.size() != crypto_secretbox_NONCEBYTES) throw "incorrect nonce length"; - size_t clen = c.size() + crypto_secretbox_BOXZEROBYTES; - unsigned char cpad[clen]; - for (int i = 0;i < crypto_secretbox_BOXZEROBYTES;++i) cpad[i] = 0; - for (int i = crypto_secretbox_BOXZEROBYTES;i < clen;++i) cpad[i] = c[i - crypto_secretbox_BOXZEROBYTES]; - unsigned char mpad[clen]; - if (crypto_secretbox_open(mpad,cpad,clen,(const unsigned char *) n.c_str(),(const unsigned char *) k.c_str()) != 0) - throw "ciphertext fails verification"; - if (clen < crypto_secretbox_ZEROBYTES) - throw "ciphertext too short"; // should have been caught by _open - return string( - (char *) mpad + crypto_secretbox_ZEROBYTES, - clen - crypto_secretbox_ZEROBYTES - ); -} diff --git a/src/libnacl/crypto_sign/wrapper-keypair.cpp b/src/libnacl/crypto_sign/wrapper-keypair.cpp deleted file mode 100644 index 3687465d..00000000 --- a/src/libnacl/crypto_sign/wrapper-keypair.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -using std::string; -#include "crypto_sign.h" - -string crypto_sign_keypair(string *sk_string) -{ - unsigned char pk[crypto_sign_PUBLICKEYBYTES]; - unsigned char sk[crypto_sign_SECRETKEYBYTES]; - crypto_sign_keypair(pk,sk); - *sk_string = string((char *) sk,sizeof sk); - return string((char *) pk,sizeof pk); -} diff --git a/src/libnacl/crypto_sign/wrapper-sign-open.cpp b/src/libnacl/crypto_sign/wrapper-sign-open.cpp deleted file mode 100644 index 346e9400..00000000 --- a/src/libnacl/crypto_sign/wrapper-sign-open.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -using std::string; -#include "crypto_sign.h" - -string crypto_sign_open(const string &sm_string, const string &pk_string) -{ - if (pk_string.size() != crypto_sign_PUBLICKEYBYTES) throw "incorrect public-key length"; - size_t smlen = sm_string.size(); - unsigned char m[smlen]; - unsigned long long mlen; - for (int i = 0;i < smlen;++i) m[i] = sm_string[i]; - if (crypto_sign_open( - m, - &mlen, - m, - smlen, - (const unsigned char *) pk_string.c_str() - ) != 0) - throw "ciphertext fails verification"; - return string( - (char *) m, - mlen - ); -} diff --git a/src/libnacl/crypto_sign/wrapper-sign.cpp b/src/libnacl/crypto_sign/wrapper-sign.cpp deleted file mode 100644 index e5234ae6..00000000 --- a/src/libnacl/crypto_sign/wrapper-sign.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -using std::string; -#include "crypto_sign.h" - -string crypto_sign(const string &m_string, const string &sk_string) -{ - if (sk_string.size() != crypto_sign_SECRETKEYBYTES) throw "incorrect secret-key length"; - size_t mlen = m_string.size(); - unsigned char sm[mlen+crypto_sign_BYTES]; - unsigned long long smlen; - crypto_sign( - sm, - &smlen, - (const unsigned char *) m_string.data(), - mlen, - (const unsigned char *) sk_string.data() - ); - return string( - (char *) sm, - smlen - ); -} diff --git a/src/libnacl/crypto_stream/wrapper-stream.cpp b/src/libnacl/crypto_stream/wrapper-stream.cpp deleted file mode 100644 index dd10c2f6..00000000 --- a/src/libnacl/crypto_stream/wrapper-stream.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -using std::string; -#include "crypto_stream.h" - -string crypto_stream(size_t clen,const string &n,const string &k) -{ - if (n.size() != crypto_stream_NONCEBYTES) throw "incorrect nonce length"; - if (k.size() != crypto_stream_KEYBYTES) throw "incorrect key length"; - unsigned char c[clen]; - crypto_stream(c,clen,(const unsigned char *) n.c_str(),(const unsigned char *) k.c_str()); - return string((char *) c,clen); -} diff --git a/src/libnacl/crypto_stream/wrapper-xor.cpp b/src/libnacl/crypto_stream/wrapper-xor.cpp deleted file mode 100644 index 8d770d1e..00000000 --- a/src/libnacl/crypto_stream/wrapper-xor.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -using std::string; -#include "crypto_stream.h" - -string crypto_stream_xor(const string &m,const string &n,const string &k) -{ - if (n.size() != crypto_stream_NONCEBYTES) throw "incorrect nonce length"; - if (k.size() != crypto_stream_KEYBYTES) throw "incorrect key length"; - size_t mlen = m.size(); - unsigned char c[mlen]; - crypto_stream_xor(c, - (const unsigned char *) m.c_str(),mlen, - (const unsigned char *) n.c_str(), - (const unsigned char *) k.c_str() - ); - return string((char *) c,mlen); -} diff --git a/src/libnacl/crypto_verify/wrapper-empty.cpp b/src/libnacl/crypto_verify/wrapper-empty.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/src/libnacl/dist-files b/src/libnacl/dist-files index e314a3eb..9cb2eee7 100644 --- a/src/libnacl/dist-files +++ b/src/libnacl/dist-files @@ -65,8 +65,6 @@ ./crypto_auth/hmacsha512256/used ./crypto_auth/measure.c ./crypto_auth/try.c -./crypto_auth/wrapper-auth.cpp -./crypto_auth/wrapper-verify.cpp ./crypto_box/curve25519xsalsa20poly1305/checksum ./crypto_box/curve25519xsalsa20poly1305/ref/after.c ./crypto_box/curve25519xsalsa20poly1305/ref/api.h @@ -77,9 +75,6 @@ ./crypto_box/curve25519xsalsa20poly1305/used ./crypto_box/measure.c ./crypto_box/try.c -./crypto_box/wrapper-box.cpp -./crypto_box/wrapper-keypair.cpp -./crypto_box/wrapper-open.cpp ./crypto_core/hsalsa20/checksum ./crypto_core/hsalsa20/ref/api.h ./crypto_core/hsalsa20/ref/core.c @@ -105,7 +100,6 @@ ./crypto_core/salsa208/ref/implementors ./crypto_core/salsa208/used ./crypto_core/try.c -./crypto_core/wrapper-empty.cpp ./crypto_hash/measure.c ./crypto_hash/sha256/checksum ./crypto_hash/sha256/ref/api.h @@ -119,7 +113,6 @@ ./crypto_hash/sha512/selected ./crypto_hash/sha512/used ./crypto_hash/try.c -./crypto_hash/wrapper-hash.cpp ./crypto_hashblocks/measure.c ./crypto_hashblocks/sha256/checksum ./crypto_hashblocks/sha256/inplace/api.h @@ -139,7 +132,6 @@ ./crypto_hashblocks/sha512/selected ./crypto_hashblocks/sha512/used ./crypto_hashblocks/try.c -./crypto_hashblocks/wrapper-empty.cpp ./crypto_onetimeauth/measure.c ./crypto_onetimeauth/poly1305/53/api.h ./crypto_onetimeauth/poly1305/53/auth.c @@ -159,8 +151,6 @@ ./crypto_onetimeauth/poly1305/x86/constants.s ./crypto_onetimeauth/poly1305/x86/verify.c ./crypto_onetimeauth/try.c -./crypto_onetimeauth/wrapper-auth.cpp -./crypto_onetimeauth/wrapper-verify.cpp ./crypto_scalarmult/curve25519/checksum ./crypto_scalarmult/curve25519/donna_c64/api.h ./crypto_scalarmult/curve25519/donna_c64/base.c @@ -173,12 +163,8 @@ ./crypto_scalarmult/curve25519/used ./crypto_scalarmult/measure.c ./crypto_scalarmult/try.c -./crypto_scalarmult/wrapper-base.cpp -./crypto_scalarmult/wrapper-mult.cpp ./crypto_secretbox/measure.c ./crypto_secretbox/try.c -./crypto_secretbox/wrapper-box.cpp -./crypto_secretbox/wrapper-open.cpp ./crypto_secretbox/xsalsa20poly1305/checksum ./crypto_secretbox/xsalsa20poly1305/ref/api.h ./crypto_secretbox/xsalsa20poly1305/ref/box.c @@ -210,9 +196,6 @@ ./crypto_sign/edwards25519sha512batch/used ./crypto_sign/measure.c ./crypto_sign/try.c -./crypto_sign/wrapper-keypair.cpp -./crypto_sign/wrapper-sign-open.cpp -./crypto_sign/wrapper-sign.cpp ./crypto_stream/aes128ctr/checksum ./crypto_stream/aes128ctr/portable/afternm.c ./crypto_stream/aes128ctr/portable/api.h @@ -247,8 +230,6 @@ ./crypto_stream/salsa208/ref/xor.c ./crypto_stream/salsa208/used ./crypto_stream/try.c -./crypto_stream/wrapper-stream.cpp -./crypto_stream/wrapper-xor.cpp ./crypto_stream/xsalsa20/checksum ./crypto_stream/xsalsa20/ref/api.h ./crypto_stream/xsalsa20/ref/implementors @@ -266,7 +247,6 @@ ./crypto_verify/32/used ./crypto_verify/measure.c ./crypto_verify/try.c -./crypto_verify/wrapper-empty.cpp ./dist-dirs ./dist-files ./do @@ -290,9 +270,7 @@ ./okcompilers/c.in ./okcompilers/do.in ./okcompilers/lib.c -./okcompilers/lib.cpp ./okcompilers/main.c -./okcompilers/main.cpp ./okcompilers/test-okar ./okcompilers/test-okc ./okcompilers/test-okc2 @@ -300,7 +278,6 @@ ./okcompilers/test.c ./okcompilers/test10.c ./okcompilers/test5.c -./okcompilers/test5.cpp ./okcompilers/test6.c ./okcompilers/test9.c ./OPERATIONS @@ -315,23 +292,17 @@ ./tests/auth2.out ./tests/auth3.c ./tests/auth3.out -./tests/auth4.cpp ./tests/auth4.out ./tests/auth5.c ./tests/auth5.out -./tests/auth6.cpp ./tests/auth6.out ./tests/box.c ./tests/box.out ./tests/box2.c ./tests/box2.out -./tests/box3.cpp ./tests/box3.out -./tests/box4.cpp ./tests/box4.out -./tests/box5.cpp ./tests/box5.out -./tests/box6.cpp ./tests/box6.out ./tests/box7.c ./tests/box7.out @@ -351,50 +322,38 @@ ./tests/core6.out ./tests/hash.c ./tests/hash.out -./tests/hash2.cpp ./tests/hash2.out ./tests/hash3.c ./tests/hash3.out -./tests/hash4.cpp ./tests/hash4.out ./tests/Makefile.in ./tests/onetimeauth.c ./tests/onetimeauth.out ./tests/onetimeauth2.c ./tests/onetimeauth2.out -./tests/onetimeauth5.cpp ./tests/onetimeauth5.out -./tests/onetimeauth6.cpp ./tests/onetimeauth6.out ./tests/onetimeauth7.c ./tests/onetimeauth7.out -./tests/onetimeauth8.cpp ./tests/onetimeauth8.out ./tests/scalarmult.c ./tests/scalarmult.out ./tests/scalarmult2.c ./tests/scalarmult2.out -./tests/scalarmult3.cpp ./tests/scalarmult3.out -./tests/scalarmult4.cpp ./tests/scalarmult4.out ./tests/scalarmult5.c ./tests/scalarmult5.out ./tests/scalarmult6.c ./tests/scalarmult6.out -./tests/scalarmult7.cpp ./tests/scalarmult7.out ./tests/secretbox.c ./tests/secretbox.out ./tests/secretbox2.c ./tests/secretbox2.out -./tests/secretbox3.cpp ./tests/secretbox3.out -./tests/secretbox4.cpp ./tests/secretbox4.out -./tests/secretbox5.cpp ./tests/secretbox5.out -./tests/secretbox6.cpp ./tests/secretbox6.out ./tests/secretbox7.c ./tests/secretbox7.out @@ -408,13 +367,9 @@ ./tests/stream3.out ./tests/stream4.c ./tests/stream4.out -./tests/stream5.cpp ./tests/stream5.out -./tests/stream6.cpp ./tests/stream6.out -./tests/stream7.cpp ./tests/stream7.out -./tests/stream8.cpp ./tests/stream8.out ./try-anything.c ./version diff --git a/src/libnacl/okcompilers/lib.cpp b/src/libnacl/okcompilers/lib.cpp deleted file mode 100644 index ea956244..00000000 --- a/src/libnacl/okcompilers/lib.cpp +++ /dev/null @@ -1,19 +0,0 @@ -int not3(int n) -{ - return n != 3; -} - -int bytes(int n) -{ - return (n + 7) / 8; -} - -long long shr32(long long n) -{ - return n >> 32; -} - -double double5(void) -{ - return 5.0; -} diff --git a/src/libnacl/okcompilers/main.cpp b/src/libnacl/okcompilers/main.cpp deleted file mode 100644 index 6255102c..00000000 --- a/src/libnacl/okcompilers/main.cpp +++ /dev/null @@ -1,22 +0,0 @@ -extern "C" { - extern int not3(int); - extern int bytes(int); - extern long long shr32(long long); - extern double double5(void); -} - -int main(int argc,char **argv) -{ - if (not3(3)) return 100; - - /* on ppc32, gcc -mpowerpc64 produces SIGILL for >>32 */ - if (!not3(shr32(1))) return 100; - - /* on pentium 1, gcc -march=pentium2 produces SIGILL for (...+7)/8 */ - if (bytes(not3(1)) != 1) return 100; - - /* on pentium 1, gcc -march=prescott produces SIGILL for double comparison */ - if (double5() < 0) return 100; - - return 0; -} diff --git a/src/libnacl/okcompilers/test5.cpp b/src/libnacl/okcompilers/test5.cpp deleted file mode 100644 index 6255102c..00000000 --- a/src/libnacl/okcompilers/test5.cpp +++ /dev/null @@ -1,22 +0,0 @@ -extern "C" { - extern int not3(int); - extern int bytes(int); - extern long long shr32(long long); - extern double double5(void); -} - -int main(int argc,char **argv) -{ - if (not3(3)) return 100; - - /* on ppc32, gcc -mpowerpc64 produces SIGILL for >>32 */ - if (!not3(shr32(1))) return 100; - - /* on pentium 1, gcc -march=pentium2 produces SIGILL for (...+7)/8 */ - if (bytes(not3(1)) != 1) return 100; - - /* on pentium 1, gcc -march=prescott produces SIGILL for double comparison */ - if (double5() < 0) return 100; - - return 0; -} diff --git a/src/libnacl/tests/auth4.cpp b/src/libnacl/tests/auth4.cpp deleted file mode 100644 index a94837d2..00000000 --- a/src/libnacl/tests/auth4.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* "Test Case AUTH256-4" from RFC 4868 */ - -#include -using std::string; -#include -#include "crypto_auth_hmacsha256.h" - -char key_bytes[32] = { - 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08 -,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10 -,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18 -,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20 -} ; - -char c_bytes[50] = { - 0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd -,0xcd,0xcd -} ; - -char a_bytes[32] = { - 0x37,0x2e,0xfc,0xf9,0xb4,0x0b,0x35,0xc2 -,0x11,0x5b,0x13,0x46,0x90,0x3d,0x2e,0xf4 -,0x2f,0xce,0xd4,0x6f,0x08,0x46,0xe7,0x25 -,0x7b,0xb1,0x56,0xd3,0xd7,0xb3,0x0d,0x3f -} ; - -main() -{ - string key(key_bytes,sizeof key_bytes); - string c(c_bytes,sizeof c_bytes); - string a(a_bytes,sizeof a_bytes); - try { - crypto_auth_hmacsha256_verify(a,c,key); - printf("0\n"); - } catch(const char *s) { - printf("%s\n",s); - } - return 0; -} diff --git a/src/libnacl/tests/auth6.cpp b/src/libnacl/tests/auth6.cpp deleted file mode 100644 index dffb6388..00000000 --- a/src/libnacl/tests/auth6.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include -using std::string; -#include -#include -#include "crypto_auth_hmacsha512256.h" -#include "randombytes.h" - -main() -{ - int clen; - int i; - for (clen = 0;clen < 10000;++clen) { - unsigned char key_bytes[32]; - randombytes(key_bytes,sizeof key_bytes); - string key((char *) key_bytes,sizeof key_bytes); - unsigned char c_bytes[clen]; - randombytes(c_bytes,sizeof c_bytes); - string c((char *) c_bytes,sizeof c_bytes); - string a = crypto_auth_hmacsha512256(c,key); - try { - crypto_auth_hmacsha512256_verify(a,c,key); - } catch(const char *s) { - printf("fail %d %s\n",clen,s); - return 100; - } - if (clen > 0) { - size_t pos = random() % clen; - c.replace(pos,1,1,c[pos] + 1 + (random() % 255)); - try { - crypto_auth_hmacsha512256_verify(a,c,key); - printf("forgery %d\n",clen); - } catch(const char *s) { - ; - } - pos = random() % a.size(); - a.replace(pos,1,1,a[pos] + 1 + (random() % 255)); - try { - crypto_auth_hmacsha512256_verify(a,c,key); - printf("forgery %d\n",clen); - } catch(const char *s) { - ; - } - } - } - return 0; -} diff --git a/src/libnacl/tests/box3.cpp b/src/libnacl/tests/box3.cpp deleted file mode 100644 index db89dd03..00000000 --- a/src/libnacl/tests/box3.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include -using std::string; -#include -#include "crypto_box_curve25519xsalsa20poly1305.h" - -char alicesk_bytes[32] = { - 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d -,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 -,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a -,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a -} ; - -char bobpk_bytes[32] = { - 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 -,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 -,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d -,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f -} ; - -char nonce_bytes[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -char m_bytes[131] = { - 0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 -,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b -,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 -,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc -,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a -,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 -,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 -,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 -,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d -,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 -,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a -,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde -,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd -,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 -,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 -,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 -,0x5e,0x07,0x05 -} ; - -main() -{ - int i; - string m(m_bytes,sizeof m_bytes); - string nonce(nonce_bytes,sizeof nonce_bytes); - string bobpk(bobpk_bytes,sizeof bobpk_bytes); - string alicesk(alicesk_bytes,sizeof alicesk_bytes); - string c = crypto_box_curve25519xsalsa20poly1305(m,nonce,bobpk,alicesk); - for (i = 0;i < c.size();++i) { - printf(",0x%02x",(unsigned int) (unsigned char) c[i]); - if (i % 8 == 7) printf("\n"); - } - printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/box4.cpp b/src/libnacl/tests/box4.cpp deleted file mode 100644 index 7f48fcd6..00000000 --- a/src/libnacl/tests/box4.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include -using std::string; -#include -#include "crypto_box_curve25519xsalsa20poly1305.h" - -char bobsk_bytes[32] = { - 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b -,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6 -,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd -,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb -} ; - -char alicepk_bytes[32] = { - 0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54 -,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a -,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4 -,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a -} ; - -char nonce_bytes[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -char c_bytes[147] = { - 0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 -,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 -,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 -} ; - -main() -{ - int i; - string c(c_bytes,sizeof c_bytes); - string nonce(nonce_bytes,sizeof nonce_bytes); - string alicepk(alicepk_bytes,sizeof alicepk_bytes); - string bobsk(bobsk_bytes,sizeof bobsk_bytes); - try { - string m = crypto_box_curve25519xsalsa20poly1305_open(c,nonce,alicepk,bobsk); - for (i = 0;i < m.size();++i) { - printf(",0x%02x",(unsigned int) (unsigned char) m[i]); - if (i % 8 == 7) printf("\n"); - } - printf("\n"); - } catch(const char *s) { - printf("%s\n",s); - } - return 0; -} diff --git a/src/libnacl/tests/box5.cpp b/src/libnacl/tests/box5.cpp deleted file mode 100644 index 366e2e30..00000000 --- a/src/libnacl/tests/box5.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -using std::string; -#include -#include "crypto_box.h" -#include "randombytes.h" - -main() -{ - int mlen; - for (mlen = 0;mlen < 1000;++mlen) { - string alicesk; - string alicepk = crypto_box_keypair(&alicesk); - string bobsk; - string bobpk = crypto_box_keypair(&bobsk); - unsigned char nbytes[crypto_box_NONCEBYTES]; - randombytes(nbytes,crypto_box_NONCEBYTES); - string n((char *) nbytes,crypto_box_NONCEBYTES); - unsigned char mbytes[mlen]; - randombytes(mbytes,mlen); - string m((char *) mbytes,mlen); - string c = crypto_box(m,n,bobpk,alicesk); - try { - string m2 = crypto_box_open(c,n,alicepk,bobsk); - if (m != m2) printf("bad decryption\n"); - } catch(const char *s) { - printf("%s\n",s); - } - } - return 0; -} diff --git a/src/libnacl/tests/box6.cpp b/src/libnacl/tests/box6.cpp deleted file mode 100644 index bab18105..00000000 --- a/src/libnacl/tests/box6.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -using std::string; -#include -#include -#include "crypto_box.h" -#include "randombytes.h" - -main() -{ - int mlen; - for (mlen = 0;mlen < 1000;++mlen) { - string alicesk; - string alicepk = crypto_box_keypair(&alicesk); - string bobsk; - string bobpk = crypto_box_keypair(&bobsk); - unsigned char nbytes[crypto_box_NONCEBYTES]; - randombytes(nbytes,crypto_box_NONCEBYTES); - string n((char *) nbytes,crypto_box_NONCEBYTES); - unsigned char mbytes[mlen]; - randombytes(mbytes,mlen); - string m((char *) mbytes,mlen); - string c = crypto_box(m,n,bobpk,alicesk); - int caught = 0; - while (caught < 10) { - c.replace(random() % c.size(),1,1,random()); - try { - string m2 = crypto_box_open(c,n,alicepk,bobsk); - if (m != m2) { - printf("forgery\n"); - return 100; - } - } catch(const char *s) { - if (string(s) == string("ciphertext fails verification")) - ++caught; - else { - printf("%s\n",s); - return 111; - } - } - } - } - return 0; -} diff --git a/src/libnacl/tests/hash2.cpp b/src/libnacl/tests/hash2.cpp deleted file mode 100644 index 6594620d..00000000 --- a/src/libnacl/tests/hash2.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -using std::string; -using std::cout; -using std::hex; -#include "crypto_hash.h" - -int main() -{ - string x = "testing\n"; - string h = crypto_hash(x); - for (int i = 0;i < h.size();++i) { - cout << hex << (15 & (int) (h[i] >> 4)); - cout << hex << (15 & (int) h[i]); - } - cout << "\n"; - return 0; -} diff --git a/src/libnacl/tests/hash4.cpp b/src/libnacl/tests/hash4.cpp deleted file mode 100644 index 1d0a3f37..00000000 --- a/src/libnacl/tests/hash4.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -using std::string; -using std::cout; -using std::hex; -#include "crypto_hash_sha512.h" - -int main() -{ - string x = "testing\n"; - string h = crypto_hash_sha512(x); - for (int i = 0;i < h.size();++i) { - cout << hex << (15 & (int) (h[i] >> 4)); - cout << hex << (15 & (int) h[i]); - } - cout << "\n"; - return 0; -} diff --git a/src/libnacl/tests/onetimeauth5.cpp b/src/libnacl/tests/onetimeauth5.cpp deleted file mode 100644 index 884892ac..00000000 --- a/src/libnacl/tests/onetimeauth5.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include -using std::string; -#include -#include "crypto_onetimeauth_poly1305.h" - -char rs_bytes[32] = { - 0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 -,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 -,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 -,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 -} ; - -char c_bytes[131] = { - 0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 -} ; - -unsigned char a[16]; - -main() -{ - int i; - string c(c_bytes,sizeof c_bytes); - string rs(rs_bytes,sizeof rs_bytes); - string a = crypto_onetimeauth_poly1305(c,rs); - for (i = 0;i < a.size();++i) { - printf(",0x%02x",(unsigned int) (unsigned char) a[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/onetimeauth6.cpp b/src/libnacl/tests/onetimeauth6.cpp deleted file mode 100644 index d79d4613..00000000 --- a/src/libnacl/tests/onetimeauth6.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include -using std::string; -#include -#include "crypto_onetimeauth_poly1305.h" - -char rs_bytes[32] = { - 0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 -,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 -,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 -,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 -} ; - -char c_bytes[131] = { - 0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 -} ; - -char a_bytes[16] = { - 0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 -,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 -} ; - -main() -{ - string rs(rs_bytes,sizeof rs_bytes); - string c(c_bytes,sizeof c_bytes); - string a(a_bytes,sizeof a_bytes); - try { - crypto_onetimeauth_poly1305_verify(a,c,rs); - printf("0\n"); - } catch(const char *s) { - printf("%s\n",s); - } - return 0; -} diff --git a/src/libnacl/tests/onetimeauth8.cpp b/src/libnacl/tests/onetimeauth8.cpp deleted file mode 100644 index ce554fb4..00000000 --- a/src/libnacl/tests/onetimeauth8.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include -using std::string; -#include -#include -#include "crypto_onetimeauth_poly1305.h" -#include "randombytes.h" - -main() -{ - int clen; - int i; - for (clen = 0;clen < 10000;++clen) { - unsigned char key_bytes[32]; - randombytes(key_bytes,sizeof key_bytes); - string key((char *) key_bytes,sizeof key_bytes); - unsigned char c_bytes[clen]; - randombytes(c_bytes,sizeof c_bytes); - string c((char *) c_bytes,sizeof c_bytes); - string a = crypto_onetimeauth_poly1305(c,key); - try { - crypto_onetimeauth_poly1305_verify(a,c,key); - } catch(const char *s) { - printf("fail %d %s\n",clen,s); - return 100; - } - if (clen > 0) { - size_t pos = random() % clen; - c.replace(pos,1,1,c[pos] + 1 + (random() % 255)); - try { - crypto_onetimeauth_poly1305_verify(a,c,key); - printf("forgery %d\n",clen); - } catch(const char *s) { - ; - } - pos = random() % a.size(); - a.replace(pos,1,1,a[pos] + 1 + (random() % 255)); - try { - crypto_onetimeauth_poly1305_verify(a,c,key); - printf("forgery %d\n",clen); - } catch(const char *s) { - ; - } - } - } - return 0; -} diff --git a/src/libnacl/tests/scalarmult3.cpp b/src/libnacl/tests/scalarmult3.cpp deleted file mode 100644 index 4e8fef3d..00000000 --- a/src/libnacl/tests/scalarmult3.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -#include -using std::string; -using std::cout; -using std::setfill; -using std::setw; -using std::hex; -#include "crypto_scalarmult_curve25519.h" - -char alicesk_bytes[32] = { - 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d -,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 -,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a -,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a -} ; - -main() -{ - int i; - cout << setfill('0'); - string alicesk(alicesk_bytes,sizeof alicesk_bytes); - string alicepk = crypto_scalarmult_curve25519_base(alicesk); - for (i = 0;i < alicepk.size();++i) { - unsigned char c = alicepk[i]; - if (i > 0) cout << ","; else cout << " "; - cout << "0x" << hex << setw(2) << (unsigned int) c; - if (i % 8 == 7) cout << "\n"; - } - return 0; -} diff --git a/src/libnacl/tests/scalarmult4.cpp b/src/libnacl/tests/scalarmult4.cpp deleted file mode 100644 index 8e4d64e9..00000000 --- a/src/libnacl/tests/scalarmult4.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -#include -using std::string; -using std::cout; -using std::setfill; -using std::setw; -using std::hex; -#include "crypto_scalarmult_curve25519.h" - -char bobsk_bytes[32] = { - 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b -,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6 -,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd -,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb -} ; - -main() -{ - int i; - cout << setfill('0'); - string bobsk(bobsk_bytes,sizeof bobsk_bytes); - string bobpk = crypto_scalarmult_curve25519_base(bobsk); - for (i = 0;i < bobpk.size();++i) { - unsigned char c = bobpk[i]; - if (i > 0) cout << ","; else cout << " "; - cout << "0x" << hex << setw(2) << (unsigned int) c; - if (i % 8 == 7) cout << "\n"; - } - return 0; -} diff --git a/src/libnacl/tests/scalarmult7.cpp b/src/libnacl/tests/scalarmult7.cpp deleted file mode 100644 index 8382d747..00000000 --- a/src/libnacl/tests/scalarmult7.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -using std::string; -#include -#include "crypto_scalarmult_curve25519.h" - -char alicesk_bytes[32] = { - 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d -,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 -,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a -,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a -} ; - -char bobpk_bytes[32] = { - 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 -,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 -,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d -,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f -} ; - -main() -{ - int i; - string alicesk(alicesk_bytes,sizeof alicesk_bytes); - string bobpk(bobpk_bytes,sizeof bobpk_bytes); - string k = crypto_scalarmult_curve25519(alicesk,bobpk); - for (i = 0;i < k.size();++i) { - if (i > 0) printf(","); else printf(" "); - printf("0x%02x",(unsigned int) (unsigned char) k[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/secretbox3.cpp b/src/libnacl/tests/secretbox3.cpp deleted file mode 100644 index 39ca7c53..00000000 --- a/src/libnacl/tests/secretbox3.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include -using std::string; -#include -#include "crypto_secretbox_xsalsa20poly1305.h" - -char firstkey_bytes[32] = { - 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 -,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 -,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 -,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 -} ; - -char nonce_bytes[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -char m_bytes[131] = { - 0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 -,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b -,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 -,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc -,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a -,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 -,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 -,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 -,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d -,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 -,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a -,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde -,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd -,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 -,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 -,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 -,0x5e,0x07,0x05 -} ; - -main() -{ - int i; - string m(m_bytes,sizeof m_bytes); - string nonce(nonce_bytes,sizeof nonce_bytes); - string firstkey(firstkey_bytes,sizeof firstkey_bytes); - string c = crypto_secretbox_xsalsa20poly1305(m,nonce,firstkey); - for (i = 0;i < c.size();++i) { - printf(",0x%02x",(unsigned int) (unsigned char) c[i]); - if (i % 8 == 7) printf("\n"); - } - printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/secretbox4.cpp b/src/libnacl/tests/secretbox4.cpp deleted file mode 100644 index 416e4d9e..00000000 --- a/src/libnacl/tests/secretbox4.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include -using std::string; -#include -#include "crypto_secretbox_xsalsa20poly1305.h" - -char firstkey_bytes[32] = { - 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 -,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 -,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 -,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 -} ; - -char nonce_bytes[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -char c_bytes[147] = { - 0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 -,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 -,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 -,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce -,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 -,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a -,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b -,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 -,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 -,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 -,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a -,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae -,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea -,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda -,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde -,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 -,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 -,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 -,0xe3,0x55,0xa5 -} ; - -main() -{ - int i; - string firstkey(firstkey_bytes,sizeof firstkey_bytes); - string nonce(nonce_bytes,sizeof nonce_bytes); - string c(c_bytes,sizeof c_bytes); - string m = crypto_secretbox_xsalsa20poly1305_open(c,nonce,firstkey); - for (i = 0;i < m.size();++i) { - printf(",0x%02x",(unsigned int) (unsigned char) m[i]); - if (i % 8 == 7) printf("\n"); - } - printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/secretbox5.cpp b/src/libnacl/tests/secretbox5.cpp deleted file mode 100644 index e8cc0eeb..00000000 --- a/src/libnacl/tests/secretbox5.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -using std::string; -#include -#include "crypto_secretbox.h" -#include "randombytes.h" - -main() -{ - int mlen; - for (mlen = 0;mlen < 1000;++mlen) { - unsigned char kbytes[crypto_secretbox_KEYBYTES]; - randombytes(kbytes,crypto_secretbox_KEYBYTES); - string k((char *) kbytes,crypto_secretbox_KEYBYTES); - unsigned char nbytes[crypto_secretbox_NONCEBYTES]; - randombytes(nbytes,crypto_secretbox_NONCEBYTES); - string n((char *) nbytes,crypto_secretbox_NONCEBYTES); - unsigned char mbytes[mlen]; - randombytes(mbytes,mlen); - string m((char *) mbytes,mlen); - string c = crypto_secretbox(m,n,k); - try { - string m2 = crypto_secretbox_open(c,n,k); - if (m != m2) printf("bad decryption\n"); - } catch(const char *s) { - printf("%s\n",s); - } - } - return 0; -} diff --git a/src/libnacl/tests/secretbox6.cpp b/src/libnacl/tests/secretbox6.cpp deleted file mode 100644 index e8274006..00000000 --- a/src/libnacl/tests/secretbox6.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include -using std::string; -#include -#include -#include "crypto_secretbox.h" -#include "randombytes.h" - -main() -{ - int mlen; - for (mlen = 0;mlen < 1000;++mlen) { - unsigned char kbytes[crypto_secretbox_KEYBYTES]; - randombytes(kbytes,crypto_secretbox_KEYBYTES); - string k((char *) kbytes,crypto_secretbox_KEYBYTES); - unsigned char nbytes[crypto_secretbox_NONCEBYTES]; - randombytes(nbytes,crypto_secretbox_NONCEBYTES); - string n((char *) nbytes,crypto_secretbox_NONCEBYTES); - unsigned char mbytes[mlen]; - randombytes(mbytes,mlen); - string m((char *) mbytes,mlen); - string c = crypto_secretbox(m,n,k); - int caught = 0; - while (caught < 10) { - c.replace(random() % c.size(),1,1,random()); - try { - string m2 = crypto_secretbox_open(c,n,k); - if (m != m2) { - printf("forgery\n"); - return 100; - } - } catch(const char *s) { - if (string(s) == string("ciphertext fails verification")) - ++caught; - else { - printf("%s\n",s); - return 111; - } - } - } - } - return 0; -} diff --git a/src/libnacl/tests/stream5.cpp b/src/libnacl/tests/stream5.cpp deleted file mode 100644 index 66f3839b..00000000 --- a/src/libnacl/tests/stream5.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -using std::string; -#include -#include "crypto_stream_xsalsa20.h" -#include "crypto_hash_sha256.h" - -char firstkey_bytes[32] = { - 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 -,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 -,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 -,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 -} ; - -char nonce_bytes[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -main() -{ - int i; - string firstkey(firstkey_bytes,sizeof firstkey_bytes); - string nonce(nonce_bytes,sizeof nonce_bytes); - string output = crypto_stream_xsalsa20(4194304,nonce,firstkey); - string h = crypto_hash_sha256(output); - for (i = 0;i < 32;++i) printf("%02x",(unsigned int) (unsigned char) h[i]); printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/stream6.cpp b/src/libnacl/tests/stream6.cpp deleted file mode 100644 index d9ed61f7..00000000 --- a/src/libnacl/tests/stream6.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -using std::string; -#include -#include "crypto_stream_salsa20.h" -#include "crypto_hash_sha256.h" - -char secondkey_bytes[32] = { - 0xdc,0x90,0x8d,0xda,0x0b,0x93,0x44,0xa9 -,0x53,0x62,0x9b,0x73,0x38,0x20,0x77,0x88 -,0x80,0xf3,0xce,0xb4,0x21,0xbb,0x61,0xb9 -,0x1c,0xbd,0x4c,0x3e,0x66,0x25,0x6c,0xe4 -} ; - -char noncesuffix_bytes[8] = { - 0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -main() -{ - int i; - string secondkey(secondkey_bytes,sizeof secondkey_bytes); - string noncesuffix(noncesuffix_bytes,sizeof noncesuffix_bytes); - string output = crypto_stream_salsa20(4194304,noncesuffix,secondkey); - string h = crypto_hash_sha256(output); - for (i = 0;i < 32;++i) printf("%02x",(unsigned int) (unsigned char) h[i]); printf("\n"); - return 0; -} diff --git a/src/libnacl/tests/stream7.cpp b/src/libnacl/tests/stream7.cpp deleted file mode 100644 index d2f106e5..00000000 --- a/src/libnacl/tests/stream7.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -using std::string; -#include -#include "crypto_stream_xsalsa20.h" - -char firstkey_bytes[32] = { - 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 -,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 -,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 -,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 -} ; - -char nonce_bytes[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -main() -{ - int i; - string firstkey(firstkey_bytes,sizeof firstkey_bytes); - string nonce(nonce_bytes,sizeof nonce_bytes); - string rs = crypto_stream_xsalsa20(32,nonce,firstkey); - for (i = 0;i < rs.size();++i) { - printf(",0x%02x",(unsigned int) (unsigned char) rs[i]); - if (i % 8 == 7) printf("\n"); - } - return 0; -} diff --git a/src/libnacl/tests/stream8.cpp b/src/libnacl/tests/stream8.cpp deleted file mode 100644 index ea95d68f..00000000 --- a/src/libnacl/tests/stream8.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include -using std::string; -#include -#include "crypto_stream_xsalsa20.h" - -char firstkey_bytes[32] = { - 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 -,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 -,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 -,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 -} ; - -char nonce_bytes[24] = { - 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 -,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 -,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 -} ; - -char m_bytes[163] = { - 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -, 0, 0, 0, 0, 0, 0, 0, 0 -,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 -,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b -,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 -,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc -,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a -,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 -,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 -,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 -,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d -,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 -,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a -,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde -,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd -,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 -,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 -,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 -,0x5e,0x07,0x05 -} ; - -main() -{ - int i; - string firstkey(firstkey_bytes,sizeof firstkey_bytes); - string nonce(nonce_bytes,sizeof nonce_bytes); - string m(m_bytes,sizeof m_bytes); - string c = crypto_stream_xsalsa20_xor(m,nonce,firstkey); - for (i = 32;i < c.size();++i) { - printf(",0x%02x",(unsigned int) (unsigned char) c[i]); - if (i % 8 == 7) printf("\n"); - } - printf("\n"); - return 0; -}