Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asn1: OER-based copy for asn1c wrapper #219

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions vanetza/asn1/asn1c_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ void* copy(asn_TYPE_descriptor_t& td, const void* original)
ByteBuffer buffer;

asn_enc_rval_t ec;
ec = der_encode(&td, const_cast<void*>(original), write_buffer, &buffer);
ec = oer_encode(&td, const_cast<void*>(original), write_buffer, &buffer);
if (ec.encoded == -1) {
throw std::runtime_error("DER encoding failed");
throw std::runtime_error("OER encoding failed");
}

asn_dec_rval_t dc;
dc = ber_decode(0, &td, &copy, buffer.data(), buffer.size());
dc = oer_decode(0, &td, &copy, buffer.data(), buffer.size());
if (dc.code != RC_OK) {
free(td, copy);
throw std::runtime_error("BER decoding failed");
throw std::runtime_error("OER decoding failed");
}

return copy;
Expand Down
Loading