mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-23 20:15:19 -07:00
parent
52b979ddc0
commit
00b454d1f1
@ -4,7 +4,6 @@
|
||||
#include "crypto_scalarmult_curve25519.h"
|
||||
|
||||
#define crypto_scalarmult crypto_scalarmult_curve25519
|
||||
#define crypto_scalarmult_raw crypto_scalarmult_curve25519_raw
|
||||
#define crypto_scalarmult_base crypto_scalarmult_curve25519_base
|
||||
#define crypto_scalarmult_BYTES crypto_scalarmult_curve25519_BYTES
|
||||
#define crypto_scalarmult_SCALARBYTES crypto_scalarmult_curve25519_SCALARBYTES
|
||||
|
@ -248,23 +248,13 @@ int crypto_scalarmult(unsigned char *q,
|
||||
const unsigned char *n,
|
||||
const unsigned char *p)
|
||||
{
|
||||
unsigned int work[96];
|
||||
unsigned char e[32];
|
||||
unsigned int i;
|
||||
for (i = 0;i < 32;++i) e[i] = n[i];
|
||||
e[0] &= 248;
|
||||
e[31] &= 127;
|
||||
e[31] |= 64;
|
||||
return crypto_scalarmult_raw(q, e, p);
|
||||
}
|
||||
|
||||
int crypto_scalarmult_raw(unsigned char *q,
|
||||
const unsigned char *n,
|
||||
const unsigned char *p)
|
||||
{
|
||||
unsigned int work[96];
|
||||
unsigned char e[32];
|
||||
unsigned int i;
|
||||
for (i = 0;i < 32;++i) e[i] = n[i];
|
||||
for (i = 0;i < 32;++i) work[i] = p[i];
|
||||
mainloop(work,e);
|
||||
recip(work + 32,work + 32);
|
||||
@ -272,4 +262,4 @@ int crypto_scalarmult_raw(unsigned char *q,
|
||||
freeze(work + 64);
|
||||
for (i = 0;i < 32;++i) q[i] = work[64 + i];
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -8,14 +8,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
extern int crypto_scalarmult_curve25519_ref(unsigned char *,const unsigned char *,const unsigned char *);
|
||||
extern int crypto_scalarmult_curve25519_ref_raw(unsigned char *,const unsigned char *, const unsigned char *);
|
||||
extern int crypto_scalarmult_curve25519_ref_base(unsigned char *,const unsigned char *);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define crypto_scalarmult_curve25519 crypto_scalarmult_curve25519_ref
|
||||
#define crypto_scalarmult_curve25519_raw crypto_scalarmult_curve25519_ref_raw
|
||||
#define crypto_scalarmult_curve25519_base crypto_scalarmult_curve25519_ref_base
|
||||
#define crypto_scalarmult_curve25519_BYTES crypto_scalarmult_curve25519_ref_BYTES
|
||||
#define crypto_scalarmult_curve25519_SCALARBYTES crypto_scalarmult_curve25519_ref_SCALARBYTES
|
||||
|
Loading…
Reference in New Issue
Block a user