summaryrefslogtreecommitdiff
path: root/libs/libaxolotl/src/curve25519/ed25519/additions/usign_modified.c
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2017-04-22 23:37:33 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2017-04-23 00:19:38 +0300
commit5048672e81f3ee9aa864ef9d736a3d74da051754 (patch)
tree8148405d428027ceab0528cf186a9faf3817b196 /libs/libaxolotl/src/curve25519/ed25519/additions/usign_modified.c
parentdf4c8656be0e85a69a238f3fc3f4d53568c53828 (diff)
libs: libsignal-c: sync with upstream
Diffstat (limited to 'libs/libaxolotl/src/curve25519/ed25519/additions/usign_modified.c')
-rw-r--r--libs/libaxolotl/src/curve25519/ed25519/additions/usign_modified.c62
1 files changed, 0 insertions, 62 deletions
diff --git a/libs/libaxolotl/src/curve25519/ed25519/additions/usign_modified.c b/libs/libaxolotl/src/curve25519/ed25519/additions/usign_modified.c
deleted file mode 100644
index 3bbd871b7a..0000000000
--- a/libs/libaxolotl/src/curve25519/ed25519/additions/usign_modified.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <string.h>
-#include "crypto_sign.h"
-#include "crypto_hash_sha512.h"
-#include "ge.h"
-#include "sc.h"
-#include "zeroize.h"
-#include "crypto_additions.h"
-
-/* NEW: Compare to pristine crypto_sign()
- Uses explicit private key for nonce derivation and as scalar,
- instead of deriving both from a master key.
-*/
-int crypto_usign_modified(
- unsigned char *sm,
- const unsigned char *M,unsigned long Mlen,
- const unsigned char *a,
- const unsigned char *A,
- const unsigned char *random,
- const ge_p3 *Bu,
- const unsigned char *U
-)
-{
- unsigned char r[64];
- unsigned char h[64];
- ge_p3 R, Ru;
- int count=0;
-
- /* r = SHA512(label(3) || a || U || random(64)) */
- sm[0] = 0xFC;
- for (count = 1; count < 32; count++)
- sm[count] = 0xFF;
-
- memmove(sm + 32, a, 32); /* Use privkey directly for nonce derivation */
- memmove(sm + 64, U, 32);
-
- memmove(sm + 96, random, 64); /* Add suffix of random data */
- crypto_hash_sha512(r, sm, 160);
-
- sc_reduce(r);
- ge_scalarmult_base(&R, r);
- ge_scalarmult(&Ru, r, Bu);
-
- /* h = SHA512(label(4) || A || U || R || Ru || M) */
- sm[0] = 0xFB;
- memmove(sm + 32, A, 32);
- memmove(sm + 64, U, 32);
- ge_p3_tobytes(sm+96, &R);
- ge_p3_tobytes(sm+128, &Ru);
- memmove(sm + 160, M, Mlen);
-
- crypto_hash_sha512(h, sm, Mlen + 160);
- sc_reduce(h);
-
- memmove(sm, h, 32); /* Write h */
- sc_muladd(sm + 32, h, a, r); /* Write s */
-
- /* Erase any traces of private scalar or
- nonce left in the stack from sc_muladd. */
- zeroize_stack();
- zeroize(r, 64);
- return 0;
-}