]> sourceware.org Git - systemtap.git/blame - nsscommon.h
rhbz1741831: support arm64 with linux/sched.h include order
[systemtap.git] / nsscommon.h
CommitLineData
cc7c72cd
DB
1#ifndef NSS_COMMON_H
2#define NSS_COMMON_H 1
3
aeb9cc10
DB
4/* Used for parameters with default C++ values which are also called from C */
5#if defined(c_plusplus) || defined(__cplusplus)
6#define INIT(v,i) v = (i)
7#else
8#define INIT(v,i) v
9#endif
10
11/* These functions are called from both C and C++. */
12#if defined(c_plusplus) || defined(__cplusplus)
13extern "C" {
14#endif
15
9af478a9 16#include <pk11func.h>
fddf715d 17#include <nss.h>
52c2652f
NMA
18#include "config.h"
19#if ENABLE_NLS
3cb0c273
LB
20#include <libintl.h>
21#include <locale.h>
52c2652f 22#endif
3cb0c273
LB
23
24#if ENABLE_NLS
25#define _(string) gettext(string)
26#define _N(string, string_plural, count) \
27 ngettext((string), (string_plural), (count))
28#else
29#define _(string) (string)
30#define _N(string, string_plural, count) \
31 ( (count) == 1 ? (string) : (string_plural) )
32#endif
33#define _F(format, ...) autosprintf(_(format), __VA_ARGS__)
34#define _NF(format, format_plural, count, ...) \
35 autosprintf(_N((format), (format_plural), (count)), __VA_ARGS__)
9af478a9 36
aeb9cc10
DB
37char *nssPasswordCallback (PK11SlotInfo *info __attribute ((unused)),
38 PRBool retry __attribute ((unused)),
39 void *arg __attribute ((unused)));
40
dff24561 41SECStatus nssInit (const char *db_path, INIT (int readWrite, 0), INIT (int issueMessage, 1));
fddf715d
SC
42NSSInitContext * nssInitContext (const char *db_path, INIT (int readWrite, 0), INIT (int issueMessage, 1));
43void nssCleanup (const char *db_path, NSSInitContext *context);
aeb9cc10
DB
44
45void nsscommon_error (const char *msg, INIT(int logit, 1));
2035bcd4 46void nssError (void);
d781daa0 47
5ab345f0
DB
48PRInt32 PR_Read_Complete (PRFileDesc *fd, void *buf, PRInt32 requestedBytes);
49
aeb9cc10
DB
50#if defined(c_plusplus) || defined(__cplusplus)
51}
52#endif
53
54#if defined(c_plusplus) || defined(__cplusplus)
55/* These functions are only called from C++ */
56#include <string>
57
58const char *server_cert_nickname ();
59std::string server_cert_db_path ();
aeb9cc10 60std::string local_client_cert_db_path ();
c981acd9 61std::string add_cert_db_prefix (const std::string &db_path);
aeb9cc10
DB
62
63void nsscommon_error (const std::string &msg, int logit = 1);
64
da43562f 65void start_log (const char *arg, bool redirect_clog = false);
aeb9cc10
DB
66bool log_ok ();
67void log (const std::string &msg);
68void end_log ();
69
638abbd0
SC
70bool get_host_name (CERTCertificate *c, std::string &host_name);
71#ifdef HAVE_HTTP_SUPPORT
72bool cvt_nss_to_pem (CERTCertificate *c, std::string &cert_pem);
73bool get_pem_cert (const std::string &db_path, const std::string &nss_cert_name, const std::string &host, std::string &cert);
74bool have_san_match (std::string & hostname, std::string & server_cert);
75#endif
76
aeb9cc10
DB
77int check_cert (const std::string &db_path, const std::string &nss_cert_name, bool use_db_password = false);
78int gen_cert_db (const std::string &db_path, const std::string &extraDnsNames, bool use_password);
7209427d
SC
79typedef enum {db_no_nssinit, db_nssinitcontext, db_nssinit} db_init_types;
80SECStatus add_client_cert (const std::string &inFileName, const std::string &db_path, db_init_types db_init_type);
aeb9cc10
DB
81void sign_file (
82 const std::string &db_path,
83 const std::string &nss_cert_name,
84 const std::string &inputName,
85 const std::string &outputName
86);
87
88CERTCertList *get_cert_list_from_db (const std::string &cert_nickname);
aeb9cc10 89
b3367f63 90SECStatus
cd1418c7 91read_cert_info_from_file (const std::string &certPath,
b3367f63
DS
92 std::string &fingerprint);
93
aeb9cc10 94#endif // defined(c_plusplus) || defined(__cplusplus)
9af478a9 95
cc7c72cd
DB
96#endif // NSS_COMMON_H
97
d781daa0 98/* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.144196 seconds and 5 git commands to generate.