Make doc/man7/ and doc/internal/man3/ conform with man-pages(7)
[openssl.git] / doc / internal / man3 / ossl_cmp_asn1_octet_string_set1.pod
1 =pod
2
3 =head1 NAME
4
5 ossl_cmp_log_parse_metadata,
6 ossl_cmp_add_error_txt,
7 ossl_cmp_add_error_data,
8 ossl_cmp_add_error_line,
9 ossl_cmp_asn1_octet_string_set1,
10 ossl_cmp_asn1_octet_string_set1_bytes,
11 ossl_cmp_build_cert_chain
12 - misc internal utility functions
13
14 =head1 SYNOPSIS
15
16  #include "cmp_int.h"
17
18  const char *ossl_cmp_log_parse_metadata(const char *buf,
19                                          OSSL_CMP_severity *level, char **func,
20                                          char **file, int *line);
21
22  void ossl_cmp_add_error_txt(const char *separator, const char *txt);
23  #define ossl_cmp_add_error_data(txt)
24  #define ossl_cmp_add_error_line(txt)
25
26  int ossl_cmp_asn1_octet_string_set1(ASN1_OCTET_STRING **tgt,
27                                      const ASN1_OCTET_STRING *src);
28  int ossl_cmp_asn1_octet_string_set1_bytes(ASN1_OCTET_STRING **tgt,
29                                            const unsigned char *bytes, int len);
30
31  STACK_OF(X509) *ossl_cmp_build_cert_chain(STACK_OF(X509) *certs, X509 *cert);
32
33 =head1 DESCRIPTION
34
35 ossl_cmp_log_parse_metadata() parses the given message buffer I<buf> populated
36 by L<OSSL_CMP_log(3)> etc.
37 according to the pattern OSSL_CMP_LOG_START#level ": %s\n", filling in
38 the variable pointed to by I<level> with the severity level or -1,
39 the variable pointed to by I<func> with the function name string or NULL,
40 the variable pointed to by I<file> with the file name string or NULL, and
41 the variable pointed to by I<line> with the line number or -1.
42 Any string returned via I<*func> and I<*file> must be freeed by the caller.
43
44 ossl_cmp_add_error_txt() appends text to the extra data field of the last
45 error message in the OpenSSL error queue, after adding the optional separator
46 unless data has been empty so far. The text can be of arbitrary length,
47 which is not possible when using L<ERR_add_error_data(3)> in conjunction with
48 L<ERR_print_errors_cb(3)>.
49
50 ossl_cmp_add_error_data() is a macro calling
51 ossl_cmp_add_error_txt() with the separator being ":".
52
53 ossl_cmp_add_error_line() is a macro calling
54 ossl_cmp_add_error_txt() with the separator being "\n".
55
56 ossl_cmp_asn1_octet_string_set1() frees any previous value of the variable
57 referenced via the I<tgt> argument and assigns either a copy of
58 the ASN1_OCTET_STRING given as the I<src> argument or NULL.
59 It returns 1 on success, 0 on error.
60
61 ossl_cmp_asn1_octet_string_set1_bytes() frees any previous value of the variable
62 referenced via the I<tgt> argument and assigns either a copy of the given byte
63 string (with the given length) or NULL. It returns 1 on success, 0 on error.
64
65 ossl_cmp_build_cert_chain() builds up the certificate chain of cert as high up
66 as possible using the given X509_STORE containing all possible intermediate
67 certificates and optionally the (possible) trust anchor(s).
68
69 =head1 RETURN VALUES
70
71 ossl_cmp_log_parse_metadata() returns the pointer to the actual message text
72 after the OSSL_CMP_LOG_PREFIX and level and ':' if found in the buffer,
73 else the beginning of the buffer.
74
75 ossl_cmp_add_error_txt()
76 ossl_cmp_add_error_data(), and
77 ossl_cmp_add_error_line()
78 do not return anything.
79
80 ossl_cmp_build_cert_chain()
81 returns NULL on error, else a pointer to a stack of (up_ref'ed) certificates
82 containing the EE certificate given in the function arguments (cert)
83 and all intermediate certificates up the chain toward the trust anchor.
84 The (self-signed) trust anchor is not included.
85
86 All other functions return 1 on success, 0 on error.
87
88 =head1 HISTORY
89
90 The OpenSSL CMP support was added in OpenSSL 3.0.
91
92 =head1 COPYRIGHT
93
94 Copyright 2007-2019 The OpenSSL Project Authors. All Rights Reserved.
95
96 Licensed under the Apache License 2.0 (the "License").  You may not use
97 this file except in compliance with the License.  You can obtain a copy
98 in the file LICENSE in the source distribution or at
99 L<https://www.openssl.org/source/license.html>.
100
101 =cut