1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:27:43 +00:00

LibCrypto: Add ability to rewrite current tag kind

This is used for IMPLICIT tags where the expected kind is overriden
by the encoding instructions.
This commit is contained in:
stelar7 2023-04-03 18:53:29 +02:00 committed by Ali Mohammad Pur
parent 8273fc230c
commit b1d80b35af

View file

@ -58,6 +58,25 @@ public:
ValueType value;
};
ErrorOr<void> rewrite_tag(Kind kind)
{
if (m_stack.is_empty())
return Error::from_string_view("Nothing on stack to rewrite"sv);
if (eof())
return Error::from_string_view("Stream is empty"sv);
if (m_current_tag.has_value()) {
m_current_tag->kind = kind;
return {};
}
auto tag = TRY(read_tag());
m_current_tag = tag;
m_current_tag->kind = kind;
return {};
}
ErrorOr<void> drop()
{
if (m_stack.is_empty())