Botan 3.6.1
Crypto and TLS for C&
x448_internal.h
Go to the documentation of this file.
1/*
2* X448 Internal
3* (C) 2024 Jack Lloyd
4* 2024 Fabian Albert - Rohde & Schwarz Cybersecurity
5*
6* Botan is released under the Simplified BSD License (see license.txt)
7*/
8#ifndef BOTAN_X448_INTERNAL_H_
9#define BOTAN_X448_INTERNAL_H_
10
11#include <botan/secmem.h>
12#include <botan/strong_type.h>
13
14namespace Botan {
15
16constexpr size_t X448_LEN = 56;
17
19
20// Note that we do not use the scalar of x448_scalar.h since the x448 algorithm
21// requires a scalar that is even. When reducing (modulo the group order) the scalar using
22// this class, the computation becomes invalid. Since we do not need to reduce, we
23// simply work on bytes for x448 */
25
26/**
27 * @brief Multiply a scalar with the standard group element (5)
28 *
29 * @param k scalar
30 * @return encoded point
31 */
33
34/**
35 * @brief Multiply a scalar @p k with a point @p u
36 *
37 * @param k scalar
38 * @param u point on curve
39 * @return k * u
40 */
42
43/// Encode a point to a 56 byte vector. RFC 7748 Section 5 (encodeUCoordinate)
45
46/// Decode a point from a byte array. RFC 7748 Section 5 (decodeUCoordinate)
47BOTAN_TEST_API Point448 decode_point(std::span<const uint8_t> p_bytes);
48
49/// Decode a scalar from a byte array. RFC 7748 Section 5 (decodeScalar448)
50BOTAN_TEST_API ScalarX448 decode_scalar(std::span<const uint8_t> scalar_bytes);
51
52} // namespace Botan
53
54#endif // BOTAN_X448_INTERNAL_H_
#define BOTAN_TEST_API
Definition compiler.h:51
secure_vector< uint8_t > encode_point(const Point448 &p)
Encode a point to a 56 byte vector. RFC 7748 Section 5 (encodeUCoordinate)
Point448 x448_basepoint(const ScalarX448 &k)
Multiply a scalar with the base group element (5)
constexpr size_t X448_LEN
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61
Point448 x448(const ScalarX448 &k, const Point448 &u)
Multiply a scalar k with a point u.
Point448 decode_point(std::span< const uint8_t > p_bytes)
Decode a point from a byte array. RFC 7748 Section 5 (decodeUCoordinate)
ScalarX448 decode_scalar(std::span< const uint8_t > scalar_bytes)
Decode a scalar from a byte array. RFC 7748 Section 5 (decodeScalar448)