summaryrefslogtreecommitdiff
path: root/donna_32.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-12-13 14:17:36 -0500
committerJeffrey Walton <noloader@gmail.com>2018-12-13 14:17:36 -0500
commitb19abcde1f11eec119d1fe8741409c0305cdd954 (patch)
tree4eb6a7832d245f9ce022b08b7f189fb633767dc4 /donna_32.cpp
parent560c332f191da678a3bf338938f3e329faaf12c0 (diff)
downloadcryptopp-git-b19abcde1f11eec119d1fe8741409c0305cdd954.tar.gz
Cleanup donna files
Diffstat (limited to 'donna_32.cpp')
-rw-r--r--donna_32.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/donna_32.cpp b/donna_32.cpp
index 45289319..0879fc4a 100644
--- a/donna_32.cpp
+++ b/donna_32.cpp
@@ -42,6 +42,7 @@ typedef word32 bignum25519align16[12];
#define mul32x32_64(a,b) (((word64)(a))*(b))
+const byte basePoint[32] = {9};
const word32 reduce_mask_25 = (1 << 25) - 1;
const word32 reduce_mask_26 = (1 << 26) - 1;
@@ -354,7 +355,7 @@ curve25519_square_times(bignum25519 out, const bignum25519 in, int count) {
/* Take a little-endian, 32-byte number and expand it into polynomial form */
void
-curve25519_expand(bignum25519 out, const unsigned char in[32]) {
+curve25519_expand(bignum25519 out, const byte in[32]) {
word32 x0,x1,x2,x3,x4,x5,x6,x7;
GetBlock<word32, LittleEndian> block(in);
@@ -376,7 +377,7 @@ curve25519_expand(bignum25519 out, const unsigned char in[32]) {
* little-endian, 32-byte array
*/
void
-curve25519_contract(unsigned char out[32], const bignum25519 in) {
+curve25519_contract(byte out[32], const bignum25519 in) {
bignum25519 f;
curve25519_copy(f, in);
@@ -436,10 +437,10 @@ curve25519_contract(unsigned char out[32], const bignum25519 in) {
f[9] <<= 6;
#define F(i, s) \
- out[s+0] |= (unsigned char )(f[i] & 0xff); \
- out[s+1] = (unsigned char )((f[i] >> 8) & 0xff); \
- out[s+2] = (unsigned char )((f[i] >> 16) & 0xff); \
- out[s+3] = (unsigned char )((f[i] >> 24) & 0xff);
+ out[s+0] |= (byte)(f[i] & 0xff); \
+ out[s+1] = (byte)((f[i] >> 8) & 0xff); \
+ out[s+2] = (byte)((f[i] >> 16) & 0xff); \
+ out[s+3] = (byte)((f[i] >> 24) & 0xff);
out[0] = 0;
out[16] = 0;
@@ -475,8 +476,6 @@ int curve25519_CXX(byte sharedKey[32], const byte secretKey[32], const byte othe
int curve25519(byte publicKey[32], const byte secretKey[32])
{
- const byte basePoint[32] = {9};
-
#if (CRYPTOPP_SSE2_INTRIN_AVAILABLE)
if (HasSSE2())
return curve25519_SSE2(publicKey, secretKey, basePoint);