Topic: Code runs successfully in v5.6.6-stable but fails in v5.8.2-stable

Hello,

I'm working on wolfSSL in an academic setting. This is part of a larger code base that is using wolfSSL + SGX.

Context: My main code base (currently private) was throwing errors on the SGX part when I added code to validate a certificate chain and a signature. For example, `error: unknown type name ‘time_t’`. In order to track down the issue, to see if this is a problem with my code or with wolfSSL, I was trying to create a separate MWE with only this block of code (to run outside SGX, i.e. with normal wolfSSL).

Current problem: This smaller chunk of code is not throwing errors when compiling, but the output is different depending on the wolfSSL version in use:
- With v5.6.6-stable it works as expected (the output is all zeros).
- With v5.8.2-stable, however, the code errors out when trying to load the first certificate.

The code fails in function

wolfSSL_X509_load_certificate_buffer

(L162) with the error ASN_PARSE_E.

I've placed the code in a git repo:
https://github.com/andrade/iamstuck/tre … ain-verify

In addition, the README has the output of the code when run with 5.6.6 (same version as in Ubuntu repositories) and with 5.8.2, which is the latest stable version.

Any idea on what is wrong?

Regards,
Daniel

Share

Re: Code runs successfully in v5.6.6-stable but fails in v5.8.2-stable

Hello Daniel,

Thanks for contacting us and for the in-depth report.

I see that your certificate has a serial number of zero.  We've recently introduced a change which causes wolfSSL to error out if a certificate has a serial number of zero.  Please try defining WOLFSSL_ASN_ALLOW_0_SERIAL while building wolfSSL and let me know if it helps.  You will need to add it to your CFLAGS in the configure step: CFLAGS='-DWOLFSSL_ASN_ALLOW_0_SERIAL' ./configure ...

If you continue to see issues, please enable debug logging by running wolfSSL_Debugging_ON() at the start of your program.

Thanks,
Kareem

Share

Re: Code runs successfully in v5.6.6-stable but fails in v5.8.2-stable

Hello,

Thank you for the workaround, Kareem, that works.

I've also tried creating a new set of certificates with positive serial numbers and can now run the code successfully without the

CFLAGS='-DWOLFSSL_ASN_ALLOW_0_SERIAL'

.

Thank you,
Daniel

Share