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

Make X509 serial number parsing code compatible with YARA (#954) #955

Merged
merged 2 commits into from
Jun 3, 2021

Conversation

xbabka01
Copy link
Contributor

Issue: #954

return { result.begin(), result.end() };
// https://github.com/VirusTotal/yara/blob/879a6576dd6e544bf9fc7711821029bf842fac54/libyara/modules/pe/pe.c#L1316
ASN1_INTEGER* serial_number_asn1 = X509_get_serialNumber(const_cast<X509*>(cert));
if (serial_number_asn1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a nitpick but would it be possible to rather do early return from the function, than having several tens of lines of codes indented like this? What I mean by that is that instead of

ASN1_INTEGER* serial_number_asn1 = X509_get_serialNumber(const_cast<X509*>(cert));
if (serial_number_asn1) {
    // ...
}

return {};

you'd have

ASN1_INTEGER* serial_number_asn1 = X509_get_serialNumber(const_cast<X509*>(cert));
if (!serial_number_asn1)
    return {};

// ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed as requested

@metthal metthal merged commit e59b138 into avast:master Jun 3, 2021
@metthal
Copy link
Member

metthal commented Jun 3, 2021

I've merged the PR but I guess we'll also need changes to https://github.com/avast/retdec-regression-tests/ because some test will fail because of this change. Once TC runs it, you'll exactly know which one.

metthal added a commit to avast/retdec-regression-tests that referenced this pull request Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants