fix truncation of integers on 32bit AIX

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8417)
This commit is contained in:
Shane Lontis 2019-03-06 12:57:09 +10:00 committed by Richard Levitte
parent 2a6a56073c
commit 98f29466dc
9 changed files with 1473 additions and 465 deletions

View File

@ -23,10 +23,10 @@
static const uint64_t blake2b_IV[8] =
{
0x6a09e667f3bcc908U, 0xbb67ae8584caa73bU,
0x3c6ef372fe94f82bU, 0xa54ff53a5f1d36f1U,
0x510e527fade682d1U, 0x9b05688c2b3e6c1fU,
0x1f83d9abfb41bd6bU, 0x5be0cd19137e2179U
0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL,
0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL,
0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
};
static const uint8_t blake2b_sigma[12][16] =

View File

@ -27,8 +27,8 @@
static const curve448_scalar_t precomputed_scalarmul_adjustment = {
{
{
SC_LIMB(0xc873d6d54a7bb0cf), SC_LIMB(0xe933d8d723a70aad),
SC_LIMB(0xbb124b65129c96fd), SC_LIMB(0x00000008335dc163)
SC_LIMB(0xc873d6d54a7bb0cfULL), SC_LIMB(0xe933d8d723a70aadULL),
SC_LIMB(0xbb124b65129c96fdULL), SC_LIMB(0x00000008335dc163ULL)
}
}
};

File diff suppressed because it is too large Load Diff

View File

@ -12,9 +12,9 @@
#include "field.h"
static const gf MODULUS = {
FIELD_LITERAL(0xffffffffffffff, 0xffffffffffffff, 0xffffffffffffff,
0xffffffffffffff, 0xfffffffffffffe, 0xffffffffffffff,
0xffffffffffffff, 0xffffffffffffff)
FIELD_LITERAL(0xffffffffffffffULL, 0xffffffffffffffULL, 0xffffffffffffffULL,
0xffffffffffffffULL, 0xfffffffffffffeULL, 0xffffffffffffffULL,
0xffffffffffffffULL, 0xffffffffffffffULL)
};
/* Serialize to wire format. */

View File

@ -14,24 +14,24 @@
#include "word.h"
#include "point_448.h"
static const c448_word_t MONTGOMERY_FACTOR = (c448_word_t) 0x3bd440fae918bc5;
static const c448_word_t MONTGOMERY_FACTOR = (c448_word_t) 0x3bd440fae918bc5ULL;
static const curve448_scalar_t sc_p = {
{
{
SC_LIMB(0x2378c292ab5844f3), SC_LIMB(0x216cc2728dc58f55),
SC_LIMB(0xc44edb49aed63690), SC_LIMB(0xffffffff7cca23e9),
SC_LIMB(0xffffffffffffffff), SC_LIMB(0xffffffffffffffff),
SC_LIMB(0x3fffffffffffffff)
SC_LIMB(0x2378c292ab5844f3ULL), SC_LIMB(0x216cc2728dc58f55ULL),
SC_LIMB(0xc44edb49aed63690ULL), SC_LIMB(0xffffffff7cca23e9ULL),
SC_LIMB(0xffffffffffffffffULL), SC_LIMB(0xffffffffffffffffULL),
SC_LIMB(0x3fffffffffffffffULL)
}
}
}, sc_r2 = {
{
{
SC_LIMB(0xe3539257049b9b60), SC_LIMB(0x7af32c4bc1b195d9),
SC_LIMB(0x0d66de2388ea1859), SC_LIMB(0xae17cf725ee4d838),
SC_LIMB(0x1a9cc14ba3c47c44), SC_LIMB(0x2052bcb7e4d070af),
SC_LIMB(0x3402a939f823b729)
SC_LIMB(0xe3539257049b9b60ULL), SC_LIMB(0x7af32c4bc1b195d9ULL),
SC_LIMB(0x0d66de2388ea1859ULL), SC_LIMB(0xae17cf725ee4d838ULL),
SC_LIMB(0x1a9cc14ba3c47c44ULL), SC_LIMB(0x2052bcb7e4d070afULL),
SC_LIMB(0x3402a939f823b729ULL)
}
}
};

View File

@ -85,30 +85,30 @@ static const unsigned char rhotates[5][5] = {
};
static const uint64_t iotas[] = {
BIT_INTERLEAVE ? 0x0000000000000001U : 0x0000000000000001U,
BIT_INTERLEAVE ? 0x0000008900000000U : 0x0000000000008082U,
BIT_INTERLEAVE ? 0x8000008b00000000U : 0x800000000000808aU,
BIT_INTERLEAVE ? 0x8000808000000000U : 0x8000000080008000U,
BIT_INTERLEAVE ? 0x0000008b00000001U : 0x000000000000808bU,
BIT_INTERLEAVE ? 0x0000800000000001U : 0x0000000080000001U,
BIT_INTERLEAVE ? 0x8000808800000001U : 0x8000000080008081U,
BIT_INTERLEAVE ? 0x8000008200000001U : 0x8000000000008009U,
BIT_INTERLEAVE ? 0x0000000b00000000U : 0x000000000000008aU,
BIT_INTERLEAVE ? 0x0000000a00000000U : 0x0000000000000088U,
BIT_INTERLEAVE ? 0x0000808200000001U : 0x0000000080008009U,
BIT_INTERLEAVE ? 0x0000800300000000U : 0x000000008000000aU,
BIT_INTERLEAVE ? 0x0000808b00000001U : 0x000000008000808bU,
BIT_INTERLEAVE ? 0x8000000b00000001U : 0x800000000000008bU,
BIT_INTERLEAVE ? 0x8000008a00000001U : 0x8000000000008089U,
BIT_INTERLEAVE ? 0x8000008100000001U : 0x8000000000008003U,
BIT_INTERLEAVE ? 0x8000008100000000U : 0x8000000000008002U,
BIT_INTERLEAVE ? 0x8000000800000000U : 0x8000000000000080U,
BIT_INTERLEAVE ? 0x0000008300000000U : 0x000000000000800aU,
BIT_INTERLEAVE ? 0x8000800300000000U : 0x800000008000000aU,
BIT_INTERLEAVE ? 0x8000808800000001U : 0x8000000080008081U,
BIT_INTERLEAVE ? 0x8000008800000000U : 0x8000000000008080U,
BIT_INTERLEAVE ? 0x0000800000000001U : 0x0000000080000001U,
BIT_INTERLEAVE ? 0x8000808200000000U : 0x8000000080008008U
BIT_INTERLEAVE ? 0x0000000000000001ULL : 0x0000000000000001ULL,
BIT_INTERLEAVE ? 0x0000008900000000ULL : 0x0000000000008082ULL,
BIT_INTERLEAVE ? 0x8000008b00000000ULL : 0x800000000000808aULL,
BIT_INTERLEAVE ? 0x8000808000000000ULL : 0x8000000080008000ULL,
BIT_INTERLEAVE ? 0x0000008b00000001ULL : 0x000000000000808bULL,
BIT_INTERLEAVE ? 0x0000800000000001ULL : 0x0000000080000001ULL,
BIT_INTERLEAVE ? 0x8000808800000001ULL : 0x8000000080008081ULL,
BIT_INTERLEAVE ? 0x8000008200000001ULL : 0x8000000000008009ULL,
BIT_INTERLEAVE ? 0x0000000b00000000ULL : 0x000000000000008aULL,
BIT_INTERLEAVE ? 0x0000000a00000000ULL : 0x0000000000000088ULL,
BIT_INTERLEAVE ? 0x0000808200000001ULL : 0x0000000080008009ULL,
BIT_INTERLEAVE ? 0x0000800300000000ULL : 0x000000008000000aULL,
BIT_INTERLEAVE ? 0x0000808b00000001ULL : 0x000000008000808bULL,
BIT_INTERLEAVE ? 0x8000000b00000001ULL : 0x800000000000008bULL,
BIT_INTERLEAVE ? 0x8000008a00000001ULL : 0x8000000000008089ULL,
BIT_INTERLEAVE ? 0x8000008100000001ULL : 0x8000000000008003ULL,
BIT_INTERLEAVE ? 0x8000008100000000ULL : 0x8000000000008002ULL,
BIT_INTERLEAVE ? 0x8000000800000000ULL : 0x8000000000000080ULL,
BIT_INTERLEAVE ? 0x0000008300000000ULL : 0x000000000000800aULL,
BIT_INTERLEAVE ? 0x8000800300000000ULL : 0x800000008000000aULL,
BIT_INTERLEAVE ? 0x8000808800000001ULL : 0x8000000080008081ULL,
BIT_INTERLEAVE ? 0x8000008800000000ULL : 0x8000000000008080ULL,
BIT_INTERLEAVE ? 0x0000800000000001ULL : 0x0000000080000001ULL,
BIT_INTERLEAVE ? 0x8000808200000000ULL : 0x8000000080008008ULL
};
#if defined(KECCAK_REF)

View File

@ -396,7 +396,7 @@ static ASN1_INT64_DATA int64_expected[] = {
CUSTOM_EXPECTED_FAILURE, /* t_8bytes_3_pad (illegal padding) */
CUSTOM_EXPECTED_SUCCESS(INT64_MIN, INT64_MIN), /* t_8bytes_4_neg */
CUSTOM_EXPECTED_FAILURE, /* t_8bytes_5_negpad (illegal padding) */
CUSTOM_EXPECTED_SUCCESS(0x1ffffffff, 0x1ffffffff), /* t_5bytes_1 */
CUSTOM_EXPECTED_SUCCESS(0x1ffffffffULL, 0x1ffffffffULL), /* t_5bytes_1 */
CUSTOM_EXPECTED_SUCCESS(0x80000000, 0x80000000), /* t_4bytes_1 */
CUSTOM_EXPECTED_SUCCESS(INT32_MAX - 1, INT32_MAX -1), /* t_4bytes_2 */
CUSTOM_EXPECTED_FAILURE, /* t_4bytes_3_pad (illegal padding) */
@ -446,7 +446,7 @@ static ASN1_UINT64_DATA uint64_expected[] = {
CUSTOM_EXPECTED_FAILURE, /* t_8bytes_3_pad */
CUSTOM_EXPECTED_FAILURE, /* t_8bytes_4_neg */
CUSTOM_EXPECTED_FAILURE, /* t_8bytes_5_negpad */
CUSTOM_EXPECTED_SUCCESS(0x1ffffffff, 0x1ffffffff), /* t_5bytes_1 */
CUSTOM_EXPECTED_SUCCESS(0x1ffffffffULL, 0x1ffffffffULL), /* t_5bytes_1 */
CUSTOM_EXPECTED_SUCCESS(0x80000000, 0x80000000), /* t_4bytes_1 */
CUSTOM_EXPECTED_SUCCESS(INT32_MAX - 1, INT32_MAX -1), /* t_4bytes_2 */
CUSTOM_EXPECTED_FAILURE, /* t_4bytes_3_pad (illegal padding) */

View File

@ -146,14 +146,14 @@ typedef struct j_data_st {
} j_data;
static j_data jf_data[] = {
{ 0xffffffffffffffffU, "%ju", "18446744073709551615" },
{ 0xffffffffffffffffU, "%jx", "ffffffffffffffff" },
{ 0x8000000000000000U, "%ju", "9223372036854775808" },
{ 0xffffffffffffffffULL, "%ju", "18446744073709551615" },
{ 0xffffffffffffffffULL, "%jx", "ffffffffffffffff" },
{ 0x8000000000000000ULL, "%ju", "9223372036854775808" },
/*
* These tests imply two's-complement, but it's the only binary
* representation we support, see test/sanitytest.c...
*/
{ 0x8000000000000000U, "%ji", "-9223372036854775808" },
{ 0x8000000000000000ULL, "%ji", "-9223372036854775808" },
};
static int test_j(int i)

View File

@ -63,7 +63,7 @@ static CT_TEST_FIXTURE *set_up(const char *const test_case_name)
if (!TEST_ptr(fixture = OPENSSL_zalloc(sizeof(*fixture))))
goto end;
fixture->test_case_name = test_case_name;
fixture->epoch_time_in_ms = 1473269626000; /* Sep 7 17:33:46 2016 GMT */
fixture->epoch_time_in_ms = 1473269626000ULL; /* Sep 7 17:33:46 2016 GMT */
if (!TEST_ptr(fixture->ctlog_store = CTLOG_STORE_new())
|| !TEST_int_eq(
CTLOG_STORE_load_default_file(fixture->ctlog_store), 1))
@ -423,7 +423,7 @@ static int test_verify_fails_for_future_sct(void)
SETUP_CT_TEST_FIXTURE();
if (fixture == NULL)
return 0;
fixture->epoch_time_in_ms = 1365094800000; /* Apr 4 17:00:00 2013 GMT */
fixture->epoch_time_in_ms = 1365094800000ULL; /* Apr 4 17:00:00 2013 GMT */
fixture->certs_dir = certs_dir;
fixture->certificate_file = "embeddedSCTs1.pem";
fixture->issuer_file = "embeddedSCTs1_issuer.pem";