Botan 3.14.1
Crypto and TLS for C&
ed25519_internal.h
Go to the documentation of this file.
1/*
2* Ed25519
3* (C) 2017 Ribose Inc
4*
5* Based on the public domain code from SUPERCOP ref10 by
6* Peter Schwabe, Daniel J. Bernstein, Niels Duif, Tanja Lange, Bo-Yin Yang
7*
8* Botan is released under the Simplified BSD License (see license.txt)
9*/
10
11#ifndef BOTAN_ED25519_INT_H_
12#define BOTAN_ED25519_INT_H_
13
14#include <botan/internal/ed25519_scalar.h>
15#include <span>
16
17namespace Botan {
18
19/**
20* Compute the Ed25519 point [scalar]B and write its encoding to out
21*/
22void ed25519_basepoint_mul(std::span<uint8_t, 32> out, const Ed25519_Scalar& scalar);
23
24/**
25* Compute the Ed25519 point [scalar]B and write the Montgomery u-coordinate
26* of its image on Curve25519 to out, in the X25519 encoding.
27*
28* Since the Ed25519 base point maps to the X25519 base point u = 9, this is
29* the X25519 public key for scalar (which must already be reduced mod l;
30* reducing does not change the result since B has order l). This uses the
31* fixed-base tables and is several times faster than the Montgomery ladder.
32*/
33void ed25519_basepoint_mul_to_x25519(std::span<uint8_t, 32> out, const Ed25519_Scalar& scalar);
34
35bool ed25519_check_signature(std::span<const uint8_t, 32> pk,
36 const Ed25519_Scalar& h,
37 const uint8_t r[32],
38 const Ed25519_Scalar& s);
39
40/**
41* Check that this is a valid public key point encoding: it must decode,
42* must not be the identity or the point of order 2, and must lie within
43* the prime order subgroup
44*/
45bool ed25519_valid_public_key_point(std::span<const uint8_t, 32> pk);
46
47} // namespace Botan
48
49#endif
void ed25519_basepoint_mul_to_x25519(std::span< uint8_t, 32 > out, const Ed25519_Scalar &scalar)
bool ed25519_valid_public_key_point(std::span< const uint8_t, 32 > pk)
bool ed25519_check_signature(std::span< const uint8_t, 32 > pk, const Ed25519_Scalar &h, const uint8_t r[32], const Ed25519_Scalar &s)
void ed25519_basepoint_mul(std::span< uint8_t, 32 > out, const Ed25519_Scalar &scalar)