diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libcrypto/asn1/asn1_string_to_utf8.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/regress/lib/libcrypto/asn1/asn1_string_to_utf8.c b/src/regress/lib/libcrypto/asn1/asn1_string_to_utf8.c index 2ead7b46c3..a87969d987 100644 --- a/src/regress/lib/libcrypto/asn1/asn1_string_to_utf8.c +++ b/src/regress/lib/libcrypto/asn1/asn1_string_to_utf8.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1_string_to_utf8.c,v 1.1 2022/05/16 20:53:20 tb Exp $ */ | 1 | /* $OpenBSD: asn1_string_to_utf8.c,v 1.2 2022/11/23 08:51:05 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> |
| 4 | * | 4 | * |
| @@ -86,12 +86,18 @@ asn1_string_to_utf8_test(const struct asn1_string_to_utf8_test_case *test) | |||
| 86 | goto err; | 86 | goto err; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | if ((ret = ASN1_STRING_to_UTF8(&out, str)) != test->want_len) { | 89 | if ((ret = ASN1_STRING_to_UTF8(&out, str)) < 0) { |
| 90 | warnx("ASN1_STRING_to_UTF8 failed: got %d, want %d", ret, | 90 | warnx("ASN1_STRING_to_UTF8 failed: got %d, want %d", ret, |
| 91 | test->want_len); | 91 | test->want_len); |
| 92 | goto err; | 92 | goto err; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | if (ret != test->want_len) { | ||
| 96 | warnx("ASN1_STRING_to_UTF8: got %d, want %d", ret, | ||
| 97 | test->want_len); | ||
| 98 | goto err; | ||
| 99 | } | ||
| 100 | |||
| 95 | if (memcmp(out, test->want, test->want_len) != 0) { | 101 | if (memcmp(out, test->want, test->want_len) != 0) { |
| 96 | warnx("memcmp failed"); | 102 | warnx("memcmp failed"); |
| 97 | goto err; | 103 | goto err; |
