osx - Same C code producing different results on Mac OS X than Windows and Linux -
I am working with an older version of OpenSLL, and I'm going through some behaviors that make me Trying to work with cross-platform codes that have been stumped for.
I have a code that calls OpenSSL to sign something. My code has been prepared after code in ASN1_sign, which is found in a_sign.c in the OpenSSL, which shows the same problem while using it. Here is the relevant line of code (which is similar to that found in A_signi and used in the same way):
EVP_SignUpdate (& amp; ctx; (unsigned char * buf_in, inl) ;
CTX is a structure that uses OpenSSL, is not related to this discussion
BUF_It is a four * of data that is to be signed - inl The length of buf_in
EVP_SignUpdate can be repeated to read EVP_SignFinal before being asked to sign the data to be signed.
When this code is used on Ubuntu and Windows 7, everything works fine, only one of those inputs is the exact same signature produced.
On OS X, if the size of the INL is less than 64 (which is 64 bytes or buf_in), even if it produces the same signature as Ubuntu and Windows, If the inline size exceeds 64, then it produces its own internal coherent signature which is different from other platforms. Internally, I mean that Mac will read the signature and verify it correctly, while it will reject signatures from Ubuntu and Windows, and vice versa.
I managed to fix this problem, and changed the above version to the same signature, where it read buffer, one byte at a time:
input_it; (Input_it = (int) buf_in; input_it & lt; inl + (int) buf_in; intput_it ++) {EVP_SIGNUpdate (and CTX, (unsigned char *) input_it, 1); }
For this reason OS X has rejected its signature of data> 64 bytes have been rejected as invalid, and I have to verify the signature in a similar way Tracked elsewhere, which must be broken in the same way.
This signature fixes creation and validation, but some are still going wrong, as I am facing other problems, and I'm really deep into OpenSSL (and modified! ) Do not want to walk.
Of course, I am doing something wrong, because when I use stock ASN1_sign, I am seeing the same issue. Is this an issue in the way of compiling OpenSSL? For my life, I can not understand it. Can someone educate me on the mistake of disorder, what should I do?
This is probably a bug, Mac OS implementation suggests that you
Comments
Post a Comment