rpm  5.4.15
rpmtpm.h
Go to the documentation of this file.
1 #ifndef H_RPMTPM
2 #define H_RPMTPM
3 
8 #include <stdlib.h> /* XXX libtpm bootstrapping */
9 #include <stdint.h> /* XXX libtpm bootstrapping */
10 #include <rpmio.h>
11 #include <rpmiotypes.h>
12 #include <rpmlog.h>
13 #include <rpmcb.h>
14 #include <argv.h>
15 #include <poptIO.h>
16 
19 /*@unchecked@*/
20 extern int _rpmtpm_debug;
21 
24 typedef /*@refcounted@*/ struct rpmtpm_s * rpmtpm;
25 
26 #if defined(_RPMTPM_INTERNAL)
27 
28 #define TPM_POSIX 1
29 #define TPM_V12 1
30 #define TPM_NV_DISK 1
31 #define TPM_MAXIMUM_KEY_SIZE 4096
32 #define TPM_AES 1
33 #define TPM_USE_TAG_IN_STRUCTURE 1
34 
37 struct rpmtpm_s {
38  struct rpmioItem_s _item;
40  int in_fips_mode; /* XXX trsa */
41  int nbits; /* XXX trsa */
42  int qbits; /* XXX trsa */
43  int badok; /* XXX trsa */
44  int err;
45 
46  void * digest;
47  size_t digestlen;
48 
49  poptContext con;
50  ARGV_t av;
51  int ac;
52  FILE *fp;
53 
54  int enabled;
55 
56  unsigned pkcsv15;
57  unsigned ownflag;
58  unsigned allkeys;
59  unsigned keephandle;
60  unsigned oldversion;
61  unsigned zeroauth;
62  unsigned addversion;
63  unsigned use_long;
64  unsigned use_struct;
65  unsigned inc;
66  unsigned activate;
67  unsigned use_ca;
68  unsigned v12;
69  unsigned disable;
70  unsigned deactivated;
71 
72  int ix;
73  unsigned keysize;
74  unsigned exponent;
75  unsigned per1;
76  unsigned per2;
77  unsigned familyID;
78  unsigned migscheme;
79  int mode;
80  int ordinal;
81  unsigned audit;
82  unsigned restype;
83  unsigned cap;
84  unsigned scap;
85  unsigned bitname;
86  unsigned bitvalue;
87  unsigned size;
88  unsigned offset;
89  int expectederror;
90  unsigned val;
91  unsigned type;
92 
93  char *ic_str;;
94  ARGV_t av_ix;
95  char *label;
96 
97  unsigned char *b;
98  uint32_t nb;
99 
100  char * ifn;
101  char * ofn;
102  char * kfn;
103  char * sfn;
104  char * msafn;
105 
106  char * ownerpass;
107  char * keypass;
108  char * parpass;
109  char * certpass;
110  char * newpass;
111  char * areapass;
112  char * sigpass;
113  char * migpass;
114  char * datpass;
115 
116  unsigned char * pwdo;
117  unsigned char * pwdk;
118  unsigned char * pwdp;
119  unsigned char * pwdc;
120  unsigned char * pwdn;
121  unsigned char * pwda;
122  unsigned char * pwds;
123  unsigned char * pwdm;
124  unsigned char * pwdd;
125 
126  unsigned char pwdohash[20];
127  unsigned char pwdkhash[20];
128  unsigned char pwdphash[20];
129  unsigned char pwdchash[20];
130  unsigned char pwdnhash[20];
131  unsigned char pwdahash[20];
132  unsigned char pwdshash[20];
133  unsigned char pwdmhash[20];
134  unsigned char pwddhash[20];
135 
136  uint32_t keyhandle;
137  uint32_t parhandle;
138  uint32_t certhandle;
139  uint32_t sighandle;
140  uint32_t mighandle;
141  uint32_t handle;
142 
143  char *hk_str;
144  char *hp_str;
145  char *hc_str;
146  char *hs_str;
147  char *hm_str;
148  char *ha_str;
149  char *ix_str;
150 
151  char *cap_str;
152  char *scap_str;
153  char *scapd_str;
154 
155  char *per1_str;
156  char *per2_str;
157  char *es_str;
158 
159  char *bm_str;
160  uint32_t restrictions;
161 
162  char *kt_str;
163  char keytype;
164 
165 #if defined(__LCLINT__)
166 /*@refs@*/
167  int nrefs;
168 #endif
169 };
170 
171 extern struct rpmtpm_s __tpm;
172 extern rpmtpm _tpm;
173 
174 #endif /* _RPMTPM_INTERNAL */
175 
176 #ifdef __cplusplus
177 extern "C" {
178 #endif
179 
185 /*@unused@*/ /*@null@*/
186 rpmtpm rpmtpmUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmtpm tpm)
187  /*@modifies tpm @*/;
188 #define rpmtpmUnlink(_tpm) \
189  ((rpmtpm)rpmioUnlinkPoolItem((rpmioItem)(_tpm), __FUNCTION__, __FILE__, __LINE__))
190 
196 /*@unused@*/ /*@newref@*/ /*@null@*/
197 rpmtpm rpmtpmLink (/*@null@*/ rpmtpm tpm)
198  /*@modifies tpm @*/;
199 #define rpmtpmLink(_tpm) \
200  ((rpmtpm)rpmioLinkPoolItem((rpmioItem)(_tpm), __FUNCTION__, __FILE__, __LINE__))
201 
207 /*@null@*/
208 rpmtpm rpmtpmFree(/*@killref@*/ /*@null@*/rpmtpm tpm)
209  /*@globals fileSystem @*/
210  /*@modifies tpm, fileSystem @*/;
211 #define rpmtpmFree(_tpm) \
212  ((rpmtpm)rpmioFreePoolItem((rpmioItem)(_tpm), __FUNCTION__, __FILE__, __LINE__))
213 
222 /*@newref@*/ /*@null@*/
223 rpmtpm rpmtpmNew(int ac, char ** av, struct poptOption *tbl, uint32_t flags)
224  /*@globals fileSystem, internalState @*/
225  /*@modifies fileSystem, internalState @*/;
226 
227 int rpmtpmErr(rpmtpm tpm, const char * msg, uint32_t mask, uint32_t rc)
228  /*@*/;
229 void rpmtpmDump(rpmtpm tpm, const char * msg, unsigned char * b, size_t nb)
230  /*@*/;
231 
232 #ifdef __cplusplus
233 }
234 #endif
235 
236 #endif /* H_RPMTPM */
const bson * b
Definition: bson.h:280
int rpmtpmErr(rpmtpm tpm, const char *msg, uint32_t mask, uint32_t rc)
Definition: rpmtpm.c:37
rpmtpm rpmtpmNew(int ac, char **av, struct poptOption *tbl, uint32_t flags)
Create and load a TPM wrapper.
Definition: rpmtpm.c:270
Yet Another syslog(3) API clone.
const char * mode
Definition: mongo.h:440
#define rpmtpmLink(_tpm)
Definition: rpmtpm.h:199
mongo_error_t err
Definition: mongo.h:922
#define rpmtpmFree(_tpm)
Definition: rpmtpm.h:211
struct rpmtpm_s * rpmtpm
Definition: rpmtpm.h:24
void rpmtpmDump(rpmtpm tpm, const char *msg, unsigned char *b, size_t nb)
Definition: rpmtpm.c:57
const char const bson int mongo_write_concern int flags
Definition: mongo.h:485
const char const char size_t size
Definition: bson.h:895
#define rpmtpmUnlink(_tpm)
Definition: rpmtpm.h:188
int _rpmtpm_debug
Definition: rpmtpm.c:30
rpmtpm _tpm
Definition: rpmtpm.c:35
const char char type
Definition: bson.h:908
ARGstr_t * ARGV_t
Definition: argv.h:12
struct rpmtpm_s __tpm
Definition: rpmtpm.c:33