curve25519: replace hacl64 with fiat64
For now, it's faster: hacl64: 109782 cycles per call fiat64: 108984 cycles per call It's quite possible this commit will be reverted with nice changes from INRIA, though. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
bc3f283148
commit
40ae0e0bba
2 changed files with 4 additions and 9 deletions
|
@ -48,7 +48,7 @@ static __always_inline void normalize_secret(u8 secret[CURVE25519_POINT_SIZE])
|
||||||
secret[31] |= 64;
|
secret[31] |= 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "../../../../src/crypto/curve25519-fiat32.h"
|
#include "../../../../src/crypto/curve25519-generic.h"
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void curve25519_generate_public(u8 public[static 32], const u8 private[static 32])
|
EMSCRIPTEN_KEEPALIVE void curve25519_generate_public(u8 public[static 32], const u8 private[static 32])
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0
|
/* SPDX-License-Identifier: GPL-2.0
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016-2017 INRIA and Microsoft Corporation.
|
|
||||||
* Copyright (C) 2015-2016 The fiat-crypto Authors.
|
|
||||||
* Copyright (C) 2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
* Copyright (C) 2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
||||||
*
|
|
||||||
* This is a machine-generated formally verified implementation of curve25519 DH from:
|
|
||||||
* https://github.com/mitls/hacl-star and https://github.com/mit-plv/fiat-crypto
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "curve25519.h"
|
#include "curve25519.h"
|
||||||
|
@ -44,11 +39,11 @@ static noinline void memzero_explicit(void *s, size_t count)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __SIZEOF_INT128__
|
#ifdef __SIZEOF_INT128__
|
||||||
#include "../crypto/curve25519-hacl64.h"
|
#define CONFIG_ARCH_SUPPORTS_INT128
|
||||||
#else
|
|
||||||
#include "../crypto/curve25519-fiat32.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "../crypto/curve25519-generic.h"
|
||||||
|
|
||||||
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_POINT_SIZE], const uint8_t secret[static CURVE25519_POINT_SIZE])
|
||||||
{
|
{
|
||||||
static const uint8_t basepoint[CURVE25519_POINT_SIZE] = { 9 };
|
static const uint8_t basepoint[CURVE25519_POINT_SIZE] = { 9 };
|
||||||
|
|
Loading…
Reference in a new issue