summaryrefslogtreecommitdiff
path: root/nacl/crypto_scalarmult/wrapper-mult.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'nacl/crypto_scalarmult/wrapper-mult.cpp')
-rw-r--r--nacl/crypto_scalarmult/wrapper-mult.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/nacl/crypto_scalarmult/wrapper-mult.cpp b/nacl/crypto_scalarmult/wrapper-mult.cpp
new file mode 100644
index 00000000..fc693cf0
--- /dev/null
+++ b/nacl/crypto_scalarmult/wrapper-mult.cpp
@@ -0,0 +1,12 @@
1#include <string>
2using std::string;
3#include "crypto_scalarmult.h"
4
5string crypto_scalarmult(const string &n,const string &p)
6{
7 unsigned char q[crypto_scalarmult_BYTES];
8 if (n.size() != crypto_scalarmult_SCALARBYTES) throw "incorrect scalar length";
9 if (p.size() != crypto_scalarmult_BYTES) throw "incorrect element length";
10 crypto_scalarmult(q,(const unsigned char *) n.c_str(),(const unsigned char *) p.c_str());
11 return string((char *) q,sizeof q);
12}