Botan 3.5.0
Crypto and TLS for C&
ec_h2c.cpp
Go to the documentation of this file.
1/*
2* (C) 2019,2020,2021 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#include <botan/internal/ec_h2c.h>
8
9#include <botan/ec_group.h>
10#include <botan/internal/pcurves.h>
11
12namespace Botan {
13
15 std::string_view hash_fn,
16 std::span<const uint8_t> input,
17 std::span<const uint8_t> domain_sep,
18 bool random_oracle) {
19 if(auto group_id = PCurve::PrimeOrderCurveId::from_oid(group.get_curve_oid())) {
20 if(auto curve = PCurve::PrimeOrderCurve::from_id(*group_id)) {
21 const auto pt = curve->hash_to_curve(hash_fn, input, domain_sep, random_oracle);
22 return group.OS2ECP(pt.to_affine().serialize());
23 }
24 }
25
26 throw Not_Implemented("Hash to curve is not implemented for this curve");
27}
28
29} // namespace Botan
const OID & get_curve_oid() const
Definition ec_group.cpp:611
EC_Point OS2ECP(const uint8_t bits[], size_t len) const
Definition ec_group.cpp:628
static std::shared_ptr< const PrimeOrderCurve > from_id(PrimeOrderCurveId id)
Definition pcurves.cpp:80
auto hash_to_curve_sswu(std::string_view hash, bool random_oracle, std::span< const uint8_t > pw, std::span< const uint8_t > dst) -> typename C::ProjectivePoint