X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=test%2Fasn1_encode_test.c;h=18c46459c3d4eebcf8361ab3e90381d80993e553;hp=e9f459ad6505adf9f2b17f01a524b13d7949f7a7;hb=459217237640369a092084ccb80175b5758f40b1;hpb=3a63c0edab842af3e84ef1cad2b4eb701eece3e1 diff --git a/test/asn1_encode_test.c b/test/asn1_encode_test.c index e9f459ad65..18c46459c3 100644 --- a/test/asn1_encode_test.c +++ b/test/asn1_encode_test.c @@ -1,7 +1,7 @@ /* - * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved. * - * Licensed under the OpenSSL license (the "License"). You may not use + * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html @@ -179,7 +179,7 @@ typedef struct { ENCDEC_DATA(-1, -1), \ ENCDEC_DATA(0, ASN1_LONG_UNDEF) -#if OPENSSL_API_COMPAT < 0x10200000L +#if !OPENSSL_API_3 /***** LONG ******************************************************************/ typedef struct { @@ -709,15 +709,18 @@ static int do_encode_custom(EXPECTED *input, static int do_print_item(const TEST_PACKAGE *package) { #define DATA_BUF_SIZE 256 - unsigned char buf[DATA_BUF_SIZE]; const ASN1_ITEM *i = ASN1_ITEM_ptr(package->asn1_type); - ASN1_VALUE *o = (ASN1_VALUE *)&buf; + ASN1_VALUE *o; int ret; OPENSSL_assert(package->encode_expectations_elem_size <= DATA_BUF_SIZE); + if ((o = OPENSSL_malloc(DATA_BUF_SIZE)) == NULL) + return 0; - (void)RAND_bytes(buf, (int)package->encode_expectations_elem_size); + (void)RAND_bytes((unsigned char*)o, + (int)package->encode_expectations_elem_size); ret = ASN1_item_print(bio_err, o, 0, i, NULL); + OPENSSL_free(o); return ret; } @@ -821,7 +824,7 @@ static int test_intern(const TEST_PACKAGE *package) return fail == 0; } -#if OPENSSL_API_COMPAT < 0x10200000L +#if !OPENSSL_API_3 static int test_long_32bit(void) { return test_intern(&long_test_package_32bit); @@ -855,7 +858,7 @@ static int test_uint64(void) int setup_tests(void) { -#if OPENSSL_API_COMPAT < 0x10200000L +#if !OPENSSL_API_3 ADD_TEST(test_long_32bit); ADD_TEST(test_long_64bit); #endif