Make ASN.1 decoder m_values protected

pull/640/head
Jeffrey Walton 2018-04-03 17:32:56 -04:00
parent 9888d22d4b
commit c27d3a9442
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
3 changed files with 18 additions and 11 deletions

23
asn.h
View File

@ -201,6 +201,15 @@ public:
/// </pre>
void BERDecodeAndCheck(BufferedTransformation &bt) const;
const std::vector<word32>& GetValues() const {
return m_values;
}
protected:
friend bool operator==(const OID &lhs, const OID &rhs);
friend bool operator!=(const OID &lhs, const OID &rhs);
friend bool operator<(const OID &lhs, const OID &rhs);
std::vector<word32> m_values;
private:
@ -213,6 +222,7 @@ class EncodedObjectFilter : public Filter
{
public:
enum Flag {PUT_OBJECTS=1, PUT_MESSANGE_END_AFTER_EACH_OBJECT=2, PUT_MESSANGE_END_AFTER_ALL_OBJECTS=4, PUT_MESSANGE_SERIES_END_AFTER_ALL_OBJECTS=8};
enum State {IDENTIFIER, LENGTH, BODY, TAIL, ALL_DONE} m_state;
virtual ~EncodedObjectFilter() {}
@ -233,13 +243,11 @@ public:
private:
BufferedTransformation & CurrentTarget();
word32 m_flags;
unsigned int m_nObjects, m_nCurrentObject, m_level;
std::vector<unsigned int> m_positions;
ByteQueue m_queue;
enum State {IDENTIFIER, LENGTH, BODY, TAIL, ALL_DONE} m_state;
byte m_id;
std::vector<unsigned int> m_positions;
lword m_lengthRemaining;
word32 m_nObjects, m_nCurrentObject, m_level, m_flags;
byte m_id;
};
/// \brief BER General Decoder
@ -265,8 +273,8 @@ public:
protected:
BufferedTransformation &m_inQueue;
bool m_finished, m_definiteLength;
lword m_length;
bool m_finished, m_definiteLength;
private:
void Init(byte asnTag);
@ -294,9 +302,8 @@ public:
private:
BufferedTransformation &m_outQueue;
bool m_finished;
byte m_asnTag;
bool m_finished;
};
/// \brief BER Sequence Decoder

View File

@ -485,7 +485,7 @@ bool DL_GroupParameters_EC<EC>::GetVoidValue(const char *name, const std::type_i
{
if (strcmp(name, Name::GroupOID()) == 0)
{
if (m_oid.m_values.empty())
if (m_oid.GetValues().empty())
return false;
this->ThrowIfTypeMismatch(name, typeid(OID), valueType);
@ -563,7 +563,7 @@ void DL_GroupParameters_EC<EC>::BERDecode(BufferedTransformation &bt)
template <class EC>
void DL_GroupParameters_EC<EC>::DEREncode(BufferedTransformation &bt) const
{
if (m_encodeAsOID && !m_oid.m_values.empty())
if (m_encodeAsOID && !m_oid.GetValues().empty())
m_oid.DEREncode(bt);
else
{

View File

@ -883,7 +883,7 @@ bool ValidateECP()
std::cout << "Testing SEC 2, NIST, and Brainpool recommended curves..." << std::endl;
OID oid;
while (!(oid = DL_GroupParameters_EC<ECP>::GetNextRecommendedParametersOID(oid)).m_values.empty())
while (!(oid = DL_GroupParameters_EC<ECP>::GetNextRecommendedParametersOID(oid)).GetValues().empty())
{
DL_GroupParameters_EC<ECP> params(oid);
bool fail = !params.Validate(GlobalRNG(), 2);