MCPcopy Create free account
hub / github.com/LUX-Core/lux / Initialize

Method Initialize

src/cryptopp/eccrypto.cpp:442–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

440}
441
442template <class EC> void DL_GroupParameters_EC<EC>::Initialize(const OID &oid)
443{
444 const EcRecommendedParameters<EllipticCurve> *begin, *end;
445 GetRecommendedParameters(begin, end);
446 const EcRecommendedParameters<EllipticCurve> *it = std::lower_bound(begin, end, oid, OIDLessThan());
447 if (it == end || it->oid != oid)
448 throw UnknownOID();
449
450 const EcRecommendedParameters<EllipticCurve> &param = *it;
451 m_oid = oid;
452 member_ptr<EllipticCurve> ec(param.NewEC());
453 this->m_groupPrecomputation.SetCurve(*ec);
454
455 StringSource ssG(param.g, true, new HexDecoder);
456 Element G;
457 bool result = GetCurve().DecodePoint(G, ssG, (size_t)ssG.MaxRetrievable());
458 this->SetSubgroupGenerator(G);
459
460 // TODO: this fails in practice. Should it throw?
461 CRYPTOPP_UNUSED(result); CRYPTOPP_ASSERT(result);
462
463 StringSource ssN(param.n, true, new HexDecoder);
464 m_n.Decode(ssN, (size_t)ssN.MaxRetrievable());
465 m_k = param.h;
466}
467
468template <class EC>
469bool DL_GroupParameters_EC<EC>::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const

Callers

nothing calls this directly

Calls 9

GetRecommendedParametersFunction · 0.85
OIDLessThanClass · 0.85
UnknownOIDFunction · 0.85
SetSubgroupGeneratorMethod · 0.80
NewECMethod · 0.45
SetCurveMethod · 0.45
DecodePointMethod · 0.45
MaxRetrievableMethod · 0.45
DecodeMethod · 0.45

Tested by

no test coverage detected