crypto: make constant naming scheme consistent
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
cef7ac9ef9
commit
646d7a5c78
|
@ -10,7 +10,7 @@ typedef unsigned int u32;
|
|||
typedef unsigned char u8;
|
||||
typedef u32 __le32;
|
||||
|
||||
enum { CURVE25519_POINT_SIZE = 32 };
|
||||
enum { CURVE25519_KEY_SIZE = 32 };
|
||||
|
||||
#ifndef __always_inline
|
||||
#define __always_inline __inline __attribute__((__always_inline__))
|
||||
|
@ -37,7 +37,7 @@ enum { CURVE25519_POINT_SIZE = 32 };
|
|||
/* We don't even attempt to deal with this in javascript. */
|
||||
#define memzero_explicit(a, b)
|
||||
|
||||
static __always_inline void normalize_secret(u8 secret[CURVE25519_POINT_SIZE])
|
||||
static __always_inline void normalize_secret(u8 secret[CURVE25519_KEY_SIZE])
|
||||
{
|
||||
secret[0] &= 248;
|
||||
secret[31] &= 127;
|
||||
|
|
|
@ -58,14 +58,14 @@ static noinline void memzero_explicit(void *s, size_t count)
|
|||
#include "../crypto/zinc/curve25519/curve25519-fiat32.h"
|
||||
#endif
|
||||
|
||||
void curve25519_generate_public(uint8_t pub[static CURVE25519_POINT_SIZE], const uint8_t secret[static CURVE25519_POINT_SIZE])
|
||||
void curve25519_generate_public(uint8_t pub[static CURVE25519_KEY_SIZE], const uint8_t secret[static CURVE25519_KEY_SIZE])
|
||||
{
|
||||
static const uint8_t basepoint[CURVE25519_POINT_SIZE] = { 9 };
|
||||
static const uint8_t basepoint[CURVE25519_KEY_SIZE] = { 9 };
|
||||
|
||||
curve25519(pub, secret, basepoint);
|
||||
}
|
||||
|
||||
void curve25519(uint8_t mypublic[static CURVE25519_POINT_SIZE], const uint8_t secret[static CURVE25519_POINT_SIZE], const uint8_t basepoint[static CURVE25519_POINT_SIZE])
|
||||
void curve25519(uint8_t mypublic[static CURVE25519_KEY_SIZE], const uint8_t secret[static CURVE25519_KEY_SIZE], const uint8_t basepoint[static CURVE25519_KEY_SIZE])
|
||||
{
|
||||
curve25519_generic(mypublic, secret, basepoint);
|
||||
}
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
#include <sys/types.h>
|
||||
|
||||
enum curve25519_lengths {
|
||||
CURVE25519_POINT_SIZE = 32,
|
||||
CURVE25519_KEY_SIZE = 32,
|
||||
};
|
||||
|
||||
void curve25519(uint8_t mypublic[static CURVE25519_POINT_SIZE], const uint8_t secret[static CURVE25519_POINT_SIZE], const uint8_t basepoint[static CURVE25519_POINT_SIZE]);
|
||||
void curve25519_generate_public(uint8_t pub[static CURVE25519_POINT_SIZE], const uint8_t secret[static CURVE25519_POINT_SIZE]);
|
||||
static inline void curve25519_normalize_secret(uint8_t secret[static CURVE25519_POINT_SIZE])
|
||||
void curve25519(uint8_t mypublic[static CURVE25519_KEY_SIZE], const uint8_t secret[static CURVE25519_KEY_SIZE], const uint8_t basepoint[static CURVE25519_KEY_SIZE]);
|
||||
void curve25519_generate_public(uint8_t pub[static CURVE25519_KEY_SIZE], const uint8_t secret[static CURVE25519_KEY_SIZE]);
|
||||
static inline void curve25519_normalize_secret(uint8_t secret[static CURVE25519_KEY_SIZE])
|
||||
{
|
||||
secret[0] &= 248;
|
||||
secret[31] &= 127;
|
||||
|
|
Reference in New Issue