File: cscommon.h

package info (click to toggle)
systemtap 5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,556 kB
  • sloc: cpp: 81,117; ansic: 54,933; xml: 49,795; exp: 43,595; sh: 11,526; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (82 lines) | stat: -rw-r--r-- 3,210 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Common functions and macros used by the compile-server and its client.
#ifndef CSCOMMON_H
#define CSCOMMON_H 1

#define MOK_PRIVATE_CERT_NAME "signing_key.priv"
#define MOK_PRIVATE_CERT_FILE "/" MOK_PRIVATE_CERT_NAME
#define MOK_CONFIG_FILE "/x509.genkey"
#define MOK_PUBLIC_CERT_NAME "signing_key.x509"
#define MOK_PUBLIC_CERT_FILE "/" MOK_PUBLIC_CERT_NAME

#if HAVE_NSS
extern "C"
{
#include <ssl.h>
#include <nspr.h>
}
#endif

// Versioning system for the protocol used for communication between the compile-server and client.
// The original version is 1.0. After that, we use the systemtap release number.
//
// By Policy:
//   - All servers are backward compatible with clients. Servers adapt to the protocol version
//     of the client.
//   - All clients are backward compatible with servers. Clients adapt to the protocol version
//     of the server. Warnings are issued for servers lacking features.
//
// Features:
//   Version 1.0
//     Original version
//   Versions 1.6 and higher
//     Client:
//       - Passes localization variables to the server in the file client_tmpdir + "/locale"
//       - Looks for the uprobes module in server_response + "/uprobes"
//       - No longer needs to remove stap's "Keeping temporary directory ..." message from
//         the server's stderr response.
//       - Looks for 'version' tag in server's avahi record and does not automatically connect to
//         an incompatible server. Also prefers newer servers over older ones.
//     Server:
//       - Applies localization variables passed from the client to stap during translation.
//       - Looks for the uprobes module in server_response + "/uprobes"
//       - Uses --tmpdir to specify temp directory to be used by stap, instead of -k, in order to
//         avoid parsing error messages in search of stap's randomly-generated temp dir.
//       - Advertises its protocol version using a 'version' tag in avahi.
//
#define CURRENT_CS_PROTOCOL_VERSION VERSION

struct cs_protocol_version
{
  cs_protocol_version (const char *v = "1.0") : v(0) { *this = v; }
  ~cs_protocol_version ();
  const cs_protocol_version &operator= (const char *v);
  bool operator< (const cs_protocol_version &that) const;

  const char *v;
};

#if HAVE_NSS
struct thread_arg
{
 PRFileDesc *tcpSocket;
 CERTCertificate *cert;
 SECKEYPrivateKey *privKey;
 PRNetAddr addr;
};

extern int read_from_file (const std::string &fname, cs_protocol_version &data);
extern std::string get_cert_serial_number (const CERTCertificate *cert);
extern int mok_sign_file (const std::string &mok_fingerprint,
			  const std::string &mok_path,
			  const std::string &kernel_build_tree,
			  const std::string &name);
extern void generate_mok (std::string &mok_fingerprint, void report_error(const std::string &msg, int logit));
extern int sign_module (const std::string &tmpdir, const std::string &module_filename, std::vector<std::string> mok_fingerprints,
			 const std::string &mok_path, const std::string &kernel_build_tree);
extern bool mok_dir_valid_p (const std::string &mok_fingerprint, const std::string &mok_path, bool verbose,
			     void report_error (const std::string &msg, int logit));


#endif

#endif // CSCOMMON_H