Merge pull request #2699 from JacobBarthelmeh/Testing

big endian changes
pull/2705/head
toddouska 2019-12-27 12:52:30 -08:00 committed by GitHub
commit dd28f26c44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -21201,6 +21201,9 @@ int wolfSSL_X509_cmp(const WOLFSSL_X509 *a, const WOLFSSL_X509 *b)
mp_to_unsigned_bin(&rsa.e, rawKey);
if ((word32)rawLen <= sizeof(word32)) {
idx = *(word32*)rawKey;
#ifdef BIG_ENDIAN_ORDER
idx = ByteReverseWord32(idx);
#endif
}
XSNPRINTF(tmp, sizeof(tmp) - 1,
"\n Exponent: %d\n", idx);
@ -33314,6 +33317,9 @@ int wolfSSL_RSA_print(WOLFSSL_BIO* bio, WOLFSSL_RSA* rsa, int offset)
mp_to_unsigned_bin(rsaElem, rawKey);
if ((word32)rawLen <= sizeof(word32)) {
idx = *(word32*)rawKey;
#ifdef BIG_ENDIAN_ORDER
idx = ByteReverseWord32(idx);
#endif
}
XSNPRINTF(tmp, sizeof(tmp) - 1, "\nExponent: %d (0x%x)", idx, idx);
if (wolfSSL_BIO_write(bio, tmp, (int)XSTRLEN(tmp)) <= 0) {

View File

@ -25273,7 +25273,11 @@ static void test_wolfSSL_X509V3_EXT_d2i(void) {
AssertNotNull(asn1str = (WOLFSSL_ASN1_STRING*)wolfSSL_X509V3_EXT_d2i(ext));
AssertNotNull(data = wolfSSL_ASN1_STRING_data(asn1str));
expected = KEYUSE_KEY_CERT_SIGN | KEYUSE_CRL_SIGN;
#ifdef BIG_ENDIAN_ORDER
actual = data[1];
#else
actual = data[0];
#endif
AssertIntEQ(actual, expected);
wolfSSL_ASN1_STRING_free(asn1str);
#if 0

View File

@ -21328,7 +21328,13 @@ static int myDecryptionFunc(PKCS7* pkcs7, int encryptOID, byte* iv, int ivSz,
/* keyIdRaw[0] OCTET TAG */
/* keyIdRaw[1] Length */
#ifdef BIG_ENDIAN_ORDER
if (keyIdRaw[1] == 0x01) {
keyId = 1;
}
#else
keyId = *(int*)(keyIdRaw + 2);
#endif
}