aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/shen_ed25519_ref/ref10CommentedCombined/open.c
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2015-08-24 19:34:10 +0200
committerRiccardo Spagni <ric@spagni.net>2015-10-26 18:00:53 +0200
commitbb0c161e7d4bff0e70b59c2f4267da96f34742af (patch)
tree6218bba2ad3cdaa4a8c0be027587db736a2cc946 /src/crypto/shen_ed25519_ref/ref10CommentedCombined/open.c
parentMerge pull request #448 (diff)
downloadmonero-bb0c161e7d4bff0e70b59c2f4267da96f34742af.tar.xz
renamed folder
Diffstat (limited to 'src/crypto/shen_ed25519_ref/ref10CommentedCombined/open.c')
-rw-r--r--src/crypto/shen_ed25519_ref/ref10CommentedCombined/open.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/crypto/shen_ed25519_ref/ref10CommentedCombined/open.c b/src/crypto/shen_ed25519_ref/ref10CommentedCombined/open.c
deleted file mode 100644
index 1ec4cd2bf..000000000
--- a/src/crypto/shen_ed25519_ref/ref10CommentedCombined/open.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <string.h>
-#include "crypto_sign.h"
-#include "crypto_hash_sha512.h"
-#include "crypto_verify_32.h"
-#include "ge.h"
-#include "sc.h"
-
-int crypto_sign_open(
- unsigned char *m,unsigned long long *mlen,
- const unsigned char *sm,unsigned long long smlen,
- const unsigned char *pk
-)
-{
- unsigned char pkcopy[32];
- unsigned char rcopy[32];
- unsigned char scopy[32];
- unsigned char h[64];
- unsigned char rcheck[32];
- ge_p3 A;
- ge_p2 R;
-
- if (smlen < 64) goto badsig;
- if (sm[63] & 224) goto badsig;
- if (ge_frombytes_negate_vartime(&A,pk) != 0) goto badsig;
-
- memmove(pkcopy,pk,32);
- memmove(rcopy,sm,32);
- memmove(scopy,sm + 32,32);
-
- memmove(m,sm,smlen);
- memmove(m + 32,pkcopy,32);
- crypto_hash_sha512(h,m,smlen);
- sc_reduce(h);
-
- ge_double_scalarmult_vartime(&R,h,&A,scopy);
- ge_tobytes(rcheck,&R);
- if (crypto_verify_32(rcheck,rcopy) == 0) {
- memmove(m,m + 64,smlen - 64);
- memset(m + smlen - 64,0,64);
- *mlen = smlen - 64;
- return 0;
- }
-
-badsig:
- *mlen = -1;
- memset(m,0,smlen);
- return -1;
-}