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:
parent
8273fc230c
commit
b1d80b35af
1 changed files with 19 additions and 0 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue