-
Notifications
You must be signed in to change notification settings - Fork 835
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
On 32-bit platform, ocsp.test to www.google.com may fail? #7929
Comments
Thanks, the test finishes successfully. The output of GDB is almost same with the result of "x86_64-linux-gnu-gcc -m32".
On Mac OS X 10.4 on PowerPC,
Also, the extension of FP_MAX_BITS=8192 seems to solve the similar issue for the binaries compiled for i386 with single precision module. |
Great! I'll check if we would consider changing the default value of |
Please consider i386 platform too (it was my original motivation to test this issue). Maybe, 32-bit PPC might be phasing out, but 32-bit x86 might be still non-negligible. I'm interested in other 32-bit platforms, like, 32-bit ARM, 32-bit MIPS, and m68k, but yet I've not made reliable environment to test them. |
Version
5.7.2
Description
It seems that the binaries built on/for 32-bit platforms have some troubles in OCSP.
ocsp.test differs on 64-bit platform and 32-bit platform
If I build binaries on GNU/Linux x86_64, scripts/ocsp.test finishes 2 tests: 1st for www.globalsign.com, 2nd for www.google.com. But if I build binaries for GNU/Linux i386, and Mac OS X 10.4 (running on PowerPC 32-bit), the 1st test passes, but the 2nd test fails by "ASN sig error".
Here I report the case of the binary built without single precision module (to compare with the result of PowerPC, a real 32-bit processor, but Mac OS X 10.4 assembler might be too buggy to compile single precision module, as reported in Issue #7905), but almost same error is found in the binary built with single precision module. The error occurs in fp_exptmod_nct(), by too big input length.
The beginning of the error happens in fp_exptmod_nct(), wolfcrypt/src/tfm.c:
If P->used is greater than (FP_SIZE / 2), fp_exptmod_nct() returns an error (if everything goes well, FP_OKAY would be returned).
GDB debugging script
I inspected the variables by following
.gdbinit
and traced the values for RsaFunctionSync() and fp_exptmod_nct().GDB output for a passing case
Below is the passing output of the x86_64 platform. P->used is always less than (FP_SIZE / 2) == 68
GDB output for a failing case (i686 binary)
Below is the failing output of the cross-built i686 binary (running on x86_64 machine). P->used == 128 is greater than (FP_SIZE / 2) == 68.
GDB output for a failing case (PowerPC)
Below is the failing output of the PowerPC binary (running on MacOS X 10.4). Unfortunately, the last version of gdb ported to MacOS X/ppc cannot handle the preprocessor macro constants, I inserted an unused fp_size variable to copy FP_SIZE value.
NOTE: "gcc -m32" is not good to reproduce this error
Maybe, I should note that using "-m32" on 64-bit platforms is inappropriate in such testing, because this option does not change the proprocessor macros
__x86_64__
or__aarch64__
, thus, the bitwidth of the registers might be different from real 32-bit processor.Below is the passing output of "-m32" binary built on the x86_64 platform.
QUESTION
In summary, FP_SIZE for both platform are same, it looks reasonable, but P->used on 32-bit platform is sometimes too big. On 64-bit platforms, P->used seems to be the one-eighth (1/8) of the inLen of RsaFunctionSync(). But on 32-bit platforms, P->used seems to be quarter (1/4) of the inLen of RsaFunctionSync().
Yet I could not find why they are different, which part of the code I should check?
The text was updated successfully, but these errors were encountered: