Skip to content

libclamav: Use OpenSSL' BN instead tomfastmath.#840

Merged
val-ms merged 2 commits intoCisco-Talos:mainfrom
sebastianas:openssl_BN
Mar 29, 2023
Merged

libclamav: Use OpenSSL' BN instead tomfastmath.#840
val-ms merged 2 commits intoCisco-Talos:mainfrom
sebastianas:openssl_BN

Conversation

@sebastianas
Copy link
Contributor

Use OpenSSL's big number/ multiprecision integer arithmetics
functionality to replace tomfastmath.

This is a first shot at doing just this. Further improvement could be
use more RSA-signature verification from OpenSSL in crtmgr_rsa_verify()
and less self parsing.
_padding_check_PKCS1_type_1() has been borrowed from OpenSSL to make
further replacements easier.

This would make the tomfastmath pull obsolete ;)

@sebastianas
Copy link
Contributor Author

ping

Copy link
Contributor

@val-ms val-ms left a comment

Choose a reason for hiding this comment

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

After building, I had some trouble with running freshclam. It seems to get stuck when verifying the databases. On the command line it looks liek this where it hangs:

❯ ./install/bin/freshclam
ClamAV update process started at Tue Mar  7 17:58:41 2023
daily database available for download (remote version: 26834)
Time:    0.2s, ETA:    0.0s [========================>]   57.99MiB/57.99MiB
Testing database: '/home/micah/workspace/clamav-micah/build/install/share/clamav/tmp.c190d1c762/clamav-54297508c3c0d83118e51220f7f23312.tmp-daily.cvd' ...

and in a debugger, I found it was stuck here:
image

I haven't put too much time into trying to figure out why it hangs.

@sebastianas
Copy link
Contributor Author

sebastianas commented Mar 10, 2023 via email

@sebastianas sebastianas requested a review from val-ms March 10, 2023 22:22
Copy link
Contributor

@val-ms val-ms left a comment

Choose a reason for hiding this comment

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

Thank you so much for the update. All of the changes you made look good minus one request regarding the .clang-format file.

In testing, I found 2 things:

  1. our internal test pipelines didn't realize the centos 7 x64/x86 builds failed and was instead failing the tests because clamav was not installed (I will fix) 😅
  2. the centos 7 x64/x86 builds failed because BN_bn2binpad is not available for the older openssl version. If it's possible to use BN_bn2bin instead it would be ideal to keep supporting openssl 1.0.2 / centos 7 for a little while longer.

@val-ms
Copy link
Contributor

val-ms commented Mar 23, 2023

Sorry looks like I also just introduced a merge conflict with a different PR merge.

Use OpenSSL's big number/ multiprecision integer arithmetics
functionality to replace tomfastmath.

This is a first shot at doing just this. Further improvement could be
use more RSA-signature verification from OpenSSL in crtmgr_rsa_verify()
and less self parsing.
_padding_check_PKCS1_type_1() has been borrowed from OpenSSL to make
further replacments easier.

Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
Now that the tomfastmath library is no longer used, remove it from the
tree.

Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
@sebastianas
Copy link
Contributor Author

sebastianas commented Mar 23, 2023 via email

Copy link
Contributor

@val-ms val-ms left a comment

Choose a reason for hiding this comment

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

I re-read everything and re-tested and re-ran through Jenkins. Everything looks really good to me. Thank you very much @sebastianas for all of the effort you put into this.

@val-ms val-ms merged commit 6efb77d into Cisco-Talos:main Mar 29, 2023
@sebastianas sebastianas deleted the openssl_BN branch June 27, 2024 19:47
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.

2 participants