summaryrefslogtreecommitdiff
path: root/src/regress/lib/libcrypto/x509/x509name.c
diff options
context:
space:
mode:
authortb <>2025-05-05 06:33:35 +0000
committertb <>2025-05-05 06:33:35 +0000
commitcf9a875b09cbb6aa6e9bcff0fafc7ee1fe7259ed (patch)
tree94ef6c894b1aca7b207c6ef0621b489cb7225b77 /src/regress/lib/libcrypto/x509/x509name.c
parent20bf2c83596ec9d0cc2e5982ff1ee23284036e3a (diff)
downloadopenbsd-cf9a875b09cbb6aa6e9bcff0fafc7ee1fe7259ed.tar.gz
openbsd-cf9a875b09cbb6aa6e9bcff0fafc7ee1fe7259ed.tar.bz2
openbsd-cf9a875b09cbb6aa6e9bcff0fafc7ee1fe7259ed.zip
merge the x509name test into x509_name_test.cHEADmaster
Remove the old x509name test and its Makefile rule. Its logic has been fully integrated into x509_name_test.c using a new table-driven approach. Each x509 name entry is added and validated step by step, checking both the string representation produced by X509_NAME_print_ex() and the internal RDN set structure. This makes the test easier to extend and maintain, and eliminates the need for an external .expected file or output diff. From Kenjiro Nakayama (with tiny tweaks)
Diffstat (limited to 'src/regress/lib/libcrypto/x509/x509name.c')
-rw-r--r--src/regress/lib/libcrypto/x509/x509name.c62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/regress/lib/libcrypto/x509/x509name.c b/src/regress/lib/libcrypto/x509/x509name.c
deleted file mode 100644
index 9deeeb2986..0000000000
--- a/src/regress/lib/libcrypto/x509/x509name.c
+++ /dev/null
@@ -1,62 +0,0 @@
1/* $OpenBSD: x509name.c,v 1.3 2021/10/31 08:27:15 tb Exp $ */
2/*
3 * Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <err.h>
19#include <stdio.h>
20
21#include <openssl/x509.h>
22
23static void debug_print(X509_NAME *);
24
25static void
26debug_print(X509_NAME *name)
27{
28 int loc;
29
30 for (loc = 0; loc < X509_NAME_entry_count(name); loc++)
31 printf("%d:",
32 X509_NAME_ENTRY_set(X509_NAME_get_entry(name, loc)));
33 putchar(' ');
34 X509_NAME_print_ex_fp(stdout, name, 0, XN_FLAG_SEP_CPLUS_SPC);
35 putchar('\n');
36}
37
38int
39main(void)
40{
41 X509_NAME *name;
42
43 if ((name = X509_NAME_new()) == NULL)
44 err(1, NULL);
45 X509_NAME_add_entry_by_txt(name, "ST", MBSTRING_ASC,
46 "BaWue", -1, -1, 0);
47 X509_NAME_add_entry_by_txt(name, "O", MBSTRING_ASC,
48 "KIT", -1, -1, 0);
49 debug_print(name);
50
51 X509_NAME_add_entry_by_txt(name, "L", MBSTRING_ASC,
52 "Karlsruhe", -1, 1, 0);
53 debug_print(name);
54
55 X509_NAME_add_entry_by_txt(name, "C", MBSTRING_ASC,
56 "DE", -1, 0, 1);
57 debug_print(name);
58
59 X509_NAME_free(name);
60
61 return 0;
62}