Lines Matching +full:custom +full:- +full:temp
2 * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
19 # pragma GCC diagnostic ignored "-Wunused-function"
20 # pragma GCC diagnostic ignored "-Wformat"
23 # pragma clang diagnostic ignored "-Wunused-function"
24 # pragma clang diagnostic ignored "-Wformat"
27 /***** Custom test data ******************************************************/
69 /* 32-bit long */
151 /* An array of structures to compare decoded custom data with */
179 ENCDEC_DATA(-1, -1), \
206 CUSTOM_EXPECTED_SUCCESS(-1, -1), /* t_one_neg */
207 CUSTOM_EXPECTED_SUCCESS(-256, -256), /* t_minus_256 */
216 CUSTOM_EXPECTED_SUCCESS(INT32_MAX - 1, INT32_MAX -1), /* t_4bytes_2 */
222 ENCDEC_ARRAY(LONG_MAX - 1, LONG_MAX, LONG_MIN, LONG_MIN),
242 CUSTOM_EXPECTED_SUCCESS(-1, -1), /* t_one_neg */
243 CUSTOM_EXPECTED_SUCCESS(-256, -256), /* t_minus_256 */
252 CUSTOM_EXPECTED_SUCCESS(INT32_MAX - 1, INT32_MAX -1), /* t_4bytes_2 */
295 CUSTOM_EXPECTED_SUCCESS(-1, -1), /* t_one_neg */
296 CUSTOM_EXPECTED_SUCCESS(-256, -256), /* t_minus_256 */
305 CUSTOM_EXPECTED_SUCCESS(INT32_MAX - 1, INT32_MAX -1), /* t_4bytes_2 */
353 CUSTOM_EXPECTED_SUCCESS(INT32_MAX - 1, INT32_MAX -1), /* t_4bytes_2 */
391 CUSTOM_EXPECTED_SUCCESS(-1, -1), /* t_one_neg */
392 CUSTOM_EXPECTED_SUCCESS(-256, -256), /* t_minus_256 */
401 CUSTOM_EXPECTED_SUCCESS(INT32_MAX - 1, INT32_MAX -1), /* t_4bytes_2 */
451 CUSTOM_EXPECTED_SUCCESS(INT32_MAX - 1, INT32_MAX -1), /* t_4bytes_2 */
480 * -1 Couldn't decode
493 enctst = package->d2i(NULL, &bytes, nbytes); in do_decode()
495 if (expected->success == 0) { in do_decode()
499 ret = -1; in do_decode()
509 package->ifree(enctst); in do_decode()
516 * -1 Couldn't encode
528 len = package->i2d(input, &data); in do_encode()
530 return -1; in do_encode()
534 if (input->success == 0) { in do_encode()
557 len = package->i2d(p, &data); in do_enc_dec()
559 return -1; in do_enc_dec()
582 *(*pp)++ = (unsigned char)(lenbytes - 1); in der_encode_length()
606 1 + der_encode_length(custom_data->nbytes1, NULL) in make_custom_der()
607 + custom_data->nbytes1; in make_custom_der()
609 for (i = custom_data->nbytes2; i > 0; i--) { in make_custom_der()
610 if (custom_data->bytes2[i - 1] != '\0') in make_custom_der()
619 1 + der_encode_length(custom_data->nbytes2, NULL) in make_custom_der()
620 + custom_data->nbytes2; in make_custom_der()
646 /* First INTEGER item (non-optional) */ in make_custom_der()
648 der_encode_length(custom_data->nbytes1, &p); in make_custom_der()
649 memcpy(p, custom_data->bytes1, custom_data->nbytes1); in make_custom_der()
650 p += custom_data->nbytes1; in make_custom_der()
658 der_encode_length(custom_data->nbytes2, &p); in make_custom_der()
659 memcpy(p, custom_data->bytes2, custom_data->nbytes2); in make_custom_der()
660 p += custom_data->nbytes2; in make_custom_der()
663 OPENSSL_assert(seqbytes == (size_t)(p - *encoding)); in make_custom_der()
668 /* Attempt to decode a custom encoding of the test structure */
682 return -1; in do_decode_custom()
691 /* Attempt to encode the test structure and compare it to custom DER */
701 return -1; in do_encode_custom()
712 const ASN1_ITEM *i = ASN1_ITEM_ptr(package->asn1_type); in do_print_item()
716 OPENSSL_assert(package->encode_expectations_elem_size <= DATA_BUF_SIZE); in do_print_item()
721 (int)package->encode_expectations_elem_size); in do_print_item()
735 if (package->skip) in test_intern()
739 nelems = package->encode_expectations_size in test_intern()
740 / package->encode_expectations_elem_size; in test_intern()
744 size_t pos = i * package->encode_expectations_elem_size; in test_intern()
746 = (EXPECTED *)&((unsigned char *)package->encode_expectations)[pos]; in test_intern()
749 case -1: in test_intern()
750 if (expected->success) { in test_intern()
751 TEST_error("Failed custom encode round trip %u of %s", in test_intern()
752 i, package->name); in test_intern()
758 TEST_error("Custom encode round trip %u of %s mismatch", in test_intern()
759 i, package->name); in test_intern()
770 package->encode_expectations_elem_size, in test_intern()
772 case -1: in test_intern()
773 if (expected->success) { in test_intern()
774 TEST_error("Failed custom decode round trip %u of %s", in test_intern()
775 i, package->name); in test_intern()
781 TEST_error("Custom decode round trip %u of %s mismatch", in test_intern()
782 i, package->name); in test_intern()
795 nelems = package->encdec_data_size / package->encdec_data_elem_size; in test_intern()
797 size_t pos = i * package->encdec_data_elem_size; in test_intern()
799 = (EXPECTED *)&((unsigned char *)package->encdec_data)[pos]; in test_intern()
801 switch (do_enc_dec(expected, package->encdec_data_elem_size, package)) { in test_intern()
802 case -1: in test_intern()
803 if (expected->success) { in test_intern()
805 i, package->name); in test_intern()
812 i, package->name); in test_intern()
824 TEST_error("Printing of %s failed", package->name); in test_intern()
870 * DirectoryString is a CHOICE type so it must use explicit tagging -
881 INVALIDTEMPLATE *temp = INVALIDTEMPLATE_new(); variable
884 if (!TEST_ptr(temp))
887 ret = i2d_INVALIDTEMPLATE(temp, NULL);
889 INVALIDTEMPLATE_free(temp);