diff --git a/testprof/base64_test.c b/testprof/base64_test.c index 8c15d3c..4b0ac89 100644 --- a/testprof/base64_test.c +++ b/testprof/base64_test.c @@ -56,6 +56,22 @@ int base64_test(void) return 1; } } + + x--; + memmove(&out[11], &out[10], l1 - 10); + out[10] = '\0'; + l1++; + l2 = sizeof(tmp); + DO(base64_decode_ex(out, l1, tmp, &l2, 0)); + if (l2 != x || memcmp(tmp, in, x)) { + fprintf(stderr, "loose base64 decoding failed %lu %lu %lu", x, l1, l2); + print_hex("is ", tmp, l2); + print_hex("should", in, x); + print_hex("input ", out, l1); + return 1; + } + l2 = sizeof(tmp); + DO(base64_decode_ex(out, l1, tmp, &l2, 1) == CRYPT_INVALID_PACKET ? CRYPT_OK : CRYPT_INVALID_PACKET); return 0; } #endif diff --git a/testprof/der_tests.c b/testprof/der_tests.c index b79a5ae..322b49a 100644 --- a/testprof/der_tests.c +++ b/testprof/der_tests.c @@ -392,7 +392,7 @@ static void der_cacert_test(void) ltc_asn1_list *decoded_list, *l, *l1, *l2; - DO(base64_decode(_der_tests_cacert_root_cert, sizeof(_der_tests_cacert_root_cert), buf, &len1)); + DO(base64_decode_ex(_der_tests_cacert_root_cert, sizeof(_der_tests_cacert_root_cert), buf, &len1, 0)); len2 = len1; DO(der_decode_sequence_flexi(buf, &len2, &decoded_list));