]> git.ipfire.org Git - thirdparty/openssl.git/blob - crypto/cmp/cmp_local.h
Strengthen chain building for CMP
[thirdparty/openssl.git] / crypto / cmp / cmp_local.h
1 /*
2 * Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved.
3 * Copyright Nokia 2007-2019
4 * Copyright Siemens AG 2015-2019
5 *
6 * Licensed under the Apache License 2.0 (the "License"). You may not use
7 * this file except in compliance with the License. You can obtain a copy
8 * in the file LICENSE in the source distribution or at
9 * https://www.openssl.org/source/license.html
10 */
11
12 #ifndef OSSL_CRYPTO_CMP_LOCAL_H
13 # define OSSL_CRYPTO_CMP_LOCAL_H
14
15 # include "internal/cryptlib.h"
16
17 # include <openssl/cmp.h>
18 # include <openssl/err.h>
19
20 /* explicit #includes not strictly needed since implied by the above: */
21 # include <openssl/crmf.h>
22 # include <openssl/types.h>
23 # include <openssl/safestack.h>
24 # include <openssl/x509.h>
25 # include <openssl/x509v3.h>
26
27 /*
28 * this structure is used to store the context for CMP sessions
29 */
30 struct ossl_cmp_ctx_st {
31 OPENSSL_CTX *libctx;
32 const char *propq;
33 OSSL_CMP_log_cb_t log_cb; /* log callback for error/debug/etc. output */
34 OSSL_CMP_severity log_verbosity; /* level of verbosity of log output */
35
36 /* message transfer */
37 OSSL_CMP_transfer_cb_t transfer_cb; /* default: OSSL_CMP_MSG_http_perform */
38 void *transfer_cb_arg; /* allows to store optional argument to cb */
39 /* HTTP-based transfer */
40 char *serverPath;
41 char *server;
42 int serverPort;
43 char *proxy;
44 char *no_proxy;
45 int msg_timeout; /* max seconds to wait for each CMP message round trip */
46 int total_timeout; /* max number of seconds an enrollment may take, incl. */
47 /* attempts polling for a response if a 'waiting' PKIStatus is received */
48 time_t end_time; /* session start time + totaltimeout */
49 OSSL_HTTP_bio_cb_t http_cb;
50 void *http_cb_arg; /* allows to store optional argument to cb */
51
52 /* server authentication */
53 /*
54 * unprotectedErrors may be set as workaround for broken server responses:
55 * accept missing or invalid protection of regular error messages, negative
56 * certificate responses (ip/cp/kup), revocation responses (rp), and PKIConf
57 */
58 int unprotectedErrors;
59 X509 *srvCert; /* certificate used to identify the server */
60 X509 *validatedSrvCert; /* caches any already validated server cert */
61 X509_NAME *expected_sender; /* expected sender in header of response */
62 X509_STORE *trusted; /* trust store maybe w CRLs and cert verify callback */
63 STACK_OF(X509) *untrusted_certs; /* untrusted (intermediate) certs */
64 int ignore_keyusage; /* ignore key usage entry when validating certs */
65 /*
66 * permitTAInExtraCertsForIR allows use of root certs in extracerts
67 * when validating message protection; this is used for 3GPP-style E.7
68 */
69 int permitTAInExtraCertsForIR;
70
71 /* client authentication */
72 int unprotectedSend; /* send unprotected PKI messages */
73 X509 *cert; /* protection cert used to identify and sign for MSG_SIG_ALG */
74 EVP_PKEY *pkey; /* the key pair corresponding to cert */
75 ASN1_OCTET_STRING *referenceValue; /* optional user name for MSG_MAC_ALG */
76 ASN1_OCTET_STRING *secretValue; /* password/shared secret for MSG_MAC_ALG */
77 /* PBMParameters for MSG_MAC_ALG */
78 size_t pbm_slen; /* salt length, currently fixed to 16 */
79 EVP_MD *pbm_owf; /* one-way function (OWF), default: SHA256 */
80 int pbm_itercnt; /* OWF iteration count, currently fixed to 500 */
81 int pbm_mac; /* NID of MAC algorithm, default: HMAC-SHA1 as per RFC 4210 */
82
83 /* CMP message header and extra certificates */
84 X509_NAME *recipient; /* to set in recipient in pkiheader */
85 EVP_MD *digest; /* digest used in MSG_SIG_ALG and POPO, default SHA256 */
86 ASN1_OCTET_STRING *transactionID; /* the current transaction ID */
87 ASN1_OCTET_STRING *senderNonce; /* last nonce sent */
88 ASN1_OCTET_STRING *recipNonce; /* last nonce received */
89 ASN1_UTF8STRING *freeText; /* optional string to include each msg */
90 STACK_OF(OSSL_CMP_ITAV) *geninfo_ITAVs;
91 int implicitConfirm; /* set implicitConfirm in IR/KUR/CR messages */
92 int disableConfirm; /* disable certConf in IR/KUR/CR for broken servers */
93 STACK_OF(X509) *extraCertsOut; /* to be included in request messages */
94
95 /* certificate template */
96 EVP_PKEY *newPkey; /* explicit new private/public key for cert enrollment */
97 int newPkey_priv; /* flag indicating if newPkey contains private key */
98 X509_NAME *issuer; /* issuer name to used in cert template */
99 int days; /* Number of days new certificates are asked to be valid for */
100 X509_NAME *subjectName; /* subject name to be used in cert template */
101 STACK_OF(GENERAL_NAME) *subjectAltNames; /* to add to the cert template */
102 int SubjectAltName_nodefault;
103 int setSubjectAltNameCritical;
104 X509_EXTENSIONS *reqExtensions; /* exts to be added to cert template */
105 CERTIFICATEPOLICIES *policies; /* policies to be included in extensions */
106 int setPoliciesCritical;
107 int popoMethod; /* Proof-of-possession mechanism; default: signature */
108 X509 *oldCert; /* cert to be updated (via KUR) or to be revoked (via RR) */
109 X509_REQ *p10CSR; /* for P10CR: PKCS#10 CSR to be sent */
110
111 /* misc body contents */
112 int revocationReason; /* revocation reason code to be included in RR */
113 STACK_OF(OSSL_CMP_ITAV) *genm_ITAVs; /* content of general message */
114
115 /* result returned in responses */
116 int status; /* PKIStatus of last received IP/CP/KUP/RP/error or -1 */
117 /* TODO: this should be a stack since there could be more than one */
118 OSSL_CMP_PKIFREETEXT *statusString; /* of last IP/CP/KUP/RP/error */
119 int failInfoCode; /* failInfoCode of last received IP/CP/KUP/error, or -1 */
120 /* TODO: this should be a stack since there could be more than one */
121 X509 *newCert; /* newly enrolled cert received from the CA */
122 /* TODO: this should be a stack since there could be more than one */
123 STACK_OF(X509) *newChain; /* chain of newly enrolled cert received */
124 STACK_OF(X509) *caPubs; /* CA certs received from server (in IP message) */
125 STACK_OF(X509) *extraCertsIn; /* extraCerts received from server */
126
127 /* certificate confirmation */
128 OSSL_CMP_certConf_cb_t certConf_cb; /* callback for app checking new cert */
129 void *certConf_cb_arg; /* allows to store an argument individual to cb */
130 } /* OSSL_CMP_CTX */;
131
132 /*
133 * ##########################################################################
134 * ASN.1 DECLARATIONS
135 * ##########################################################################
136 */
137
138 /*-
139 * RevAnnContent ::= SEQUENCE {
140 * status PKIStatus,
141 * certId CertId,
142 * willBeRevokedAt GeneralizedTime,
143 * badSinceDate GeneralizedTime,
144 * crlDetails Extensions OPTIONAL
145 * -- extra CRL details (e.g., crl number, reason, location, etc.)
146 * }
147 */
148 typedef struct ossl_cmp_revanncontent_st {
149 ASN1_INTEGER *status;
150 OSSL_CRMF_CERTID *certId;
151 ASN1_GENERALIZEDTIME *willBeRevokedAt;
152 ASN1_GENERALIZEDTIME *badSinceDate;
153 X509_EXTENSIONS *crlDetails;
154 } OSSL_CMP_REVANNCONTENT;
155 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_REVANNCONTENT)
156
157 /*-
158 * Challenge ::= SEQUENCE {
159 * owf AlgorithmIdentifier OPTIONAL,
160 *
161 * -- MUST be present in the first Challenge; MAY be omitted in
162 * -- any subsequent Challenge in POPODecKeyChallContent (if
163 * -- omitted, then the owf used in the immediately preceding
164 * -- Challenge is to be used).
165 *
166 * witness OCTET STRING,
167 * -- the result of applying the one-way function (owf) to a
168 * -- randomly-generated INTEGER, A. [Note that a different
169 * -- INTEGER MUST be used for each Challenge.]
170 * challenge OCTET STRING
171 * -- the encryption (under the public key for which the cert.
172 * -- request is being made) of Rand, where Rand is specified as
173 * -- Rand ::= SEQUENCE {
174 * -- int INTEGER,
175 * -- - the randomly-generated INTEGER A (above)
176 * -- sender GeneralName
177 * -- - the sender's name (as included in PKIHeader)
178 * -- }
179 * }
180 */
181 typedef struct ossl_cmp_challenge_st {
182 X509_ALGOR *owf;
183 ASN1_OCTET_STRING *witness;
184 ASN1_OCTET_STRING *challenge;
185 } OSSL_CMP_CHALLENGE;
186 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_CHALLENGE)
187
188 /*-
189 * CAKeyUpdAnnContent ::= SEQUENCE {
190 * oldWithNew Certificate,
191 * newWithOld Certificate,
192 * newWithNew Certificate
193 * }
194 */
195 typedef struct ossl_cmp_cakeyupdanncontent_st {
196 X509 *oldWithNew;
197 X509 *newWithOld;
198 X509 *newWithNew;
199 } OSSL_CMP_CAKEYUPDANNCONTENT;
200 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_CAKEYUPDANNCONTENT)
201
202 /*-
203 * declared already here as it will be used in OSSL_CMP_MSG (nested) and
204 * infoType and infoValue
205 */
206 typedef STACK_OF(OSSL_CMP_MSG) OSSL_CMP_MSGS;
207 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_MSGS)
208
209 /*-
210 * InfoTypeAndValue ::= SEQUENCE {
211 * infoType OBJECT IDENTIFIER,
212 * infoValue ANY DEFINED BY infoType OPTIONAL
213 * }
214 */
215 struct ossl_cmp_itav_st {
216 ASN1_OBJECT *infoType;
217 union {
218 char *ptr;
219 /* NID_id_it_caProtEncCert - CA Protocol Encryption Certificate */
220 X509 *caProtEncCert;
221 /* NID_id_it_signKeyPairTypes - Signing Key Pair Types */
222 STACK_OF(X509_ALGOR) *signKeyPairTypes;
223 /* NID_id_it_encKeyPairTypes - Encryption/Key Agreement Key Pair Types */
224 STACK_OF(X509_ALGOR) *encKeyPairTypes;
225 /* NID_id_it_preferredSymmAlg - Preferred Symmetric Algorithm */
226 X509_ALGOR *preferredSymmAlg;
227 /* NID_id_it_caKeyUpdateInfo - Updated CA Key Pair */
228 OSSL_CMP_CAKEYUPDANNCONTENT *caKeyUpdateInfo;
229 /* NID_id_it_currentCRL - CRL */
230 X509_CRL *currentCRL;
231 /* NID_id_it_unsupportedOIDs - Unsupported Object Identifiers */
232 STACK_OF(ASN1_OBJECT) *unsupportedOIDs;
233 /* NID_id_it_keyPairParamReq - Key Pair Parameters Request */
234 ASN1_OBJECT *keyPairParamReq;
235 /* NID_id_it_keyPairParamRep - Key Pair Parameters Response */
236 X509_ALGOR *keyPairParamRep;
237 /* NID_id_it_revPassphrase - Revocation Passphrase */
238 OSSL_CRMF_ENCRYPTEDVALUE *revPassphrase;
239 /* NID_id_it_implicitConfirm - ImplicitConfirm */
240 ASN1_NULL *implicitConfirm;
241 /* NID_id_it_confirmWaitTime - ConfirmWaitTime */
242 ASN1_GENERALIZEDTIME *confirmWaitTime;
243 /* NID_id_it_origPKIMessage - origPKIMessage */
244 OSSL_CMP_MSGS *origPKIMessage;
245 /* NID_id_it_suppLangTags - Supported Language Tags */
246 STACK_OF(ASN1_UTF8STRING) *suppLangTagsValue;
247 /* this is to be used for so far undeclared objects */
248 ASN1_TYPE *other;
249 } infoValue;
250 } /* OSSL_CMP_ITAV */;
251 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_ITAV)
252
253 typedef struct ossl_cmp_certorenccert_st {
254 int type;
255 union {
256 X509 *certificate;
257 OSSL_CRMF_ENCRYPTEDVALUE *encryptedCert;
258 } value;
259 } OSSL_CMP_CERTORENCCERT;
260 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_CERTORENCCERT)
261
262 /*-
263 * CertifiedKeyPair ::= SEQUENCE {
264 * certOrEncCert CertOrEncCert,
265 * privateKey [0] EncryptedValue OPTIONAL,
266 * -- see [CRMF] for comment on encoding
267 * publicationInfo [1] PKIPublicationInfo OPTIONAL
268 * }
269 */
270 typedef struct ossl_cmp_certifiedkeypair_st {
271 OSSL_CMP_CERTORENCCERT *certOrEncCert;
272 OSSL_CRMF_ENCRYPTEDVALUE *privateKey;
273 OSSL_CRMF_PKIPUBLICATIONINFO *publicationInfo;
274 } OSSL_CMP_CERTIFIEDKEYPAIR;
275 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_CERTIFIEDKEYPAIR)
276
277 /*-
278 * PKIStatusInfo ::= SEQUENCE {
279 * status PKIStatus,
280 * statusString PKIFreeText OPTIONAL,
281 * failInfo PKIFailureInfo OPTIONAL
282 * }
283 */
284 struct ossl_cmp_pkisi_st {
285 OSSL_CMP_PKISTATUS *status;
286 OSSL_CMP_PKIFREETEXT *statusString;
287 OSSL_CMP_PKIFAILUREINFO *failInfo;
288 } /* OSSL_CMP_PKISI */;
289
290 /*-
291 * RevReqContent ::= SEQUENCE OF RevDetails
292 *
293 * RevDetails ::= SEQUENCE {
294 * certDetails CertTemplate,
295 * crlEntryDetails Extensions OPTIONAL
296 * }
297 */
298 struct ossl_cmp_revdetails_st {
299 OSSL_CRMF_CERTTEMPLATE *certDetails;
300 X509_EXTENSIONS *crlEntryDetails;
301 } /* OSSL_CMP_REVDETAILS */;
302 typedef struct ossl_cmp_revdetails_st OSSL_CMP_REVDETAILS;
303 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_REVDETAILS)
304 DEFINE_STACK_OF(OSSL_CMP_REVDETAILS)
305
306 /*-
307 * RevRepContent ::= SEQUENCE {
308 * status SEQUENCE SIZE (1..MAX) OF PKIStatusInfo,
309 * -- in same order as was sent in RevReqContent
310 * revCerts [0] SEQUENCE SIZE (1..MAX) OF CertId
311 * OPTIONAL,
312 * -- IDs for which revocation was requested
313 * -- (same order as status)
314 * crls [1] SEQUENCE SIZE (1..MAX) OF CertificateList
315 * OPTIONAL
316 * -- the resulting CRLs (there may be more than one)
317 * }
318 */
319 struct ossl_cmp_revrepcontent_st {
320 STACK_OF(OSSL_CMP_PKISI) *status;
321 STACK_OF(OSSL_CRMF_CERTID) *revCerts;
322 STACK_OF(X509_CRL) *crls;
323 } /* OSSL_CMP_REVREPCONTENT */;
324 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_REVREPCONTENT)
325
326 /*-
327 * KeyRecRepContent ::= SEQUENCE {
328 * status PKIStatusInfo,
329 * newSigCert [0] Certificate OPTIONAL,
330 * caCerts [1] SEQUENCE SIZE (1..MAX) OF
331 * Certificate OPTIONAL,
332 * keyPairHist [2] SEQUENCE SIZE (1..MAX) OF
333 * CertifiedKeyPair OPTIONAL
334 * }
335 */
336 typedef struct ossl_cmp_keyrecrepcontent_st {
337 OSSL_CMP_PKISI *status;
338 X509 *newSigCert;
339 STACK_OF(X509) *caCerts;
340 STACK_OF(OSSL_CMP_CERTIFIEDKEYPAIR) *keyPairHist;
341 } OSSL_CMP_KEYRECREPCONTENT;
342 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_KEYRECREPCONTENT)
343
344 /*-
345 * ErrorMsgContent ::= SEQUENCE {
346 * pKIStatusInfo PKIStatusInfo,
347 * errorCode INTEGER OPTIONAL,
348 * -- implementation-specific error codes
349 * errorDetails PKIFreeText OPTIONAL
350 * -- implementation-specific error details
351 * }
352 */
353 typedef struct ossl_cmp_errormsgcontent_st {
354 OSSL_CMP_PKISI *pKIStatusInfo;
355 ASN1_INTEGER *errorCode;
356 OSSL_CMP_PKIFREETEXT *errorDetails;
357 } OSSL_CMP_ERRORMSGCONTENT;
358 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_ERRORMSGCONTENT)
359
360 /*-
361 * CertConfirmContent ::= SEQUENCE OF CertStatus
362 *
363 * CertStatus ::= SEQUENCE {
364 * certHash OCTET STRING,
365 * -- the hash of the certificate, using the same hash algorithm
366 * -- as is used to create and verify the certificate signature
367 * certReqId INTEGER,
368 * -- to match this confirmation with the corresponding req/rep
369 * statusInfo PKIStatusInfo OPTIONAL
370 * }
371 */
372 struct ossl_cmp_certstatus_st {
373 ASN1_OCTET_STRING *certHash;
374 ASN1_INTEGER *certReqId;
375 OSSL_CMP_PKISI *statusInfo;
376 } /* OSSL_CMP_CERTSTATUS */;
377 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_CERTSTATUS)
378 typedef STACK_OF(OSSL_CMP_CERTSTATUS) OSSL_CMP_CERTCONFIRMCONTENT;
379 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_CERTCONFIRMCONTENT)
380
381 /*-
382 * CertResponse ::= SEQUENCE {
383 * certReqId INTEGER,
384 * -- to match this response with corresponding request (a value
385 * -- of -1 is to be used if certReqId is not specified in the
386 * -- corresponding request)
387 * status PKIStatusInfo,
388 * certifiedKeyPair CertifiedKeyPair OPTIONAL,
389 * rspInfo OCTET STRING OPTIONAL
390 * -- analogous to the id-regInfo-utf8Pairs string defined
391 * -- for regInfo in CertReqMsg [CRMF]
392 * }
393 */
394 struct ossl_cmp_certresponse_st {
395 ASN1_INTEGER *certReqId;
396 OSSL_CMP_PKISI *status;
397 OSSL_CMP_CERTIFIEDKEYPAIR *certifiedKeyPair;
398 ASN1_OCTET_STRING *rspInfo;
399 } /* OSSL_CMP_CERTRESPONSE */;
400 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_CERTRESPONSE)
401
402 /*-
403 * CertRepMessage ::= SEQUENCE {
404 * caPubs [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
405 * OPTIONAL,
406 * response SEQUENCE OF CertResponse
407 * }
408 */
409 struct ossl_cmp_certrepmessage_st {
410 STACK_OF(X509) *caPubs;
411 STACK_OF(OSSL_CMP_CERTRESPONSE) *response;
412 } /* OSSL_CMP_CERTREPMESSAGE */;
413 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_CERTREPMESSAGE)
414
415 /*-
416 * PollReqContent ::= SEQUENCE OF SEQUENCE {
417 * certReqId INTEGER
418 * }
419 */
420 typedef struct ossl_cmp_pollreq_st {
421 ASN1_INTEGER *certReqId;
422 } OSSL_CMP_POLLREQ;
423 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_POLLREQ)
424 DEFINE_STACK_OF(OSSL_CMP_POLLREQ)
425 typedef STACK_OF(OSSL_CMP_POLLREQ) OSSL_CMP_POLLREQCONTENT;
426 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_POLLREQCONTENT)
427
428 /*-
429 * PollRepContent ::= SEQUENCE OF SEQUENCE {
430 * certReqId INTEGER,
431 * checkAfter INTEGER, -- time in seconds
432 * reason PKIFreeText OPTIONAL
433 * }
434 */
435 struct ossl_cmp_pollrep_st {
436 ASN1_INTEGER *certReqId;
437 ASN1_INTEGER *checkAfter;
438 OSSL_CMP_PKIFREETEXT *reason;
439 } /* OSSL_CMP_POLLREP */;
440 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_POLLREP)
441 DEFINE_STACK_OF(OSSL_CMP_POLLREP)
442 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_POLLREPCONTENT)
443
444 /*-
445 * PKIHeader ::= SEQUENCE {
446 * pvno INTEGER { cmp1999(1), cmp2000(2) },
447 * sender GeneralName,
448 * -- identifies the sender
449 * recipient GeneralName,
450 * -- identifies the intended recipient
451 * messageTime [0] GeneralizedTime OPTIONAL,
452 * -- time of production of this message (used when sender
453 * -- believes that the transport will be "suitable"; i.e.,
454 * -- that the time will still be meaningful upon receipt)
455 * protectionAlg [1] AlgorithmIdentifier OPTIONAL,
456 * -- algorithm used for calculation of protection bits
457 * senderKID [2] KeyIdentifier OPTIONAL,
458 * recipKID [3] KeyIdentifier OPTIONAL,
459 * -- to identify specific keys used for protection
460 * transactionID [4] OCTET STRING OPTIONAL,
461 * -- identifies the transaction; i.e., this will be the same in
462 * -- corresponding request, response, certConf, and PKIConf
463 * -- messages
464 * senderNonce [5] OCTET STRING OPTIONAL,
465 * recipNonce [6] OCTET STRING OPTIONAL,
466 * -- nonces used to provide replay protection, senderNonce
467 * -- is inserted by the creator of this message; recipNonce
468 * -- is a nonce previously inserted in a related message by
469 * -- the intended recipient of this message
470 * freeText [7] PKIFreeText OPTIONAL,
471 * -- this may be used to indicate context-specific instructions
472 * -- (this field is intended for human consumption)
473 * generalInfo [8] SEQUENCE SIZE (1..MAX) OF
474 * InfoTypeAndValue OPTIONAL
475 * -- this may be used to convey context-specific information
476 * -- (this field not primarily intended for human consumption)
477 * }
478 */
479 struct ossl_cmp_pkiheader_st {
480 ASN1_INTEGER *pvno;
481 GENERAL_NAME *sender;
482 GENERAL_NAME *recipient;
483 ASN1_GENERALIZEDTIME *messageTime; /* 0 */
484 X509_ALGOR *protectionAlg; /* 1 */
485 ASN1_OCTET_STRING *senderKID; /* 2 */
486 ASN1_OCTET_STRING *recipKID; /* 3 */
487 ASN1_OCTET_STRING *transactionID; /* 4 */
488 ASN1_OCTET_STRING *senderNonce; /* 5 */
489 ASN1_OCTET_STRING *recipNonce; /* 6 */
490 OSSL_CMP_PKIFREETEXT *freeText; /* 7 */
491 STACK_OF(OSSL_CMP_ITAV) *generalInfo; /* 8 */
492 } /* OSSL_CMP_PKIHEADER */;
493
494 typedef STACK_OF(OSSL_CMP_CHALLENGE) OSSL_CMP_POPODECKEYCHALLCONTENT;
495 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_POPODECKEYCHALLCONTENT)
496 typedef STACK_OF(ASN1_INTEGER) OSSL_CMP_POPODECKEYRESPCONTENT;
497 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_POPODECKEYRESPCONTENT)
498 typedef STACK_OF(OSSL_CMP_REVDETAILS) OSSL_CMP_REVREQCONTENT;
499 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_REVREQCONTENT)
500 typedef STACK_OF(X509_CRL) OSSL_CMP_CRLANNCONTENT;
501 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_CRLANNCONTENT)
502 typedef STACK_OF(OSSL_CMP_ITAV) OSSL_CMP_GENMSGCONTENT;
503 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_GENMSGCONTENT)
504 typedef STACK_OF(OSSL_CMP_ITAV) OSSL_CMP_GENREPCONTENT;
505 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_GENREPCONTENT)
506
507 /*-
508 * PKIBody ::= CHOICE { -- message-specific body elements
509 * ir [0] CertReqMessages, --Initialization Request
510 * ip [1] CertRepMessage, --Initialization Response
511 * cr [2] CertReqMessages, --Certification Request
512 * cp [3] CertRepMessage, --Certification Response
513 * p10cr [4] CertificationRequest, --imported from [PKCS10]
514 * popdecc [5] POPODecKeyChallContent, --pop Challenge
515 * popdecr [6] POPODecKeyRespContent, --pop Response
516 * kur [7] CertReqMessages, --Key Update Request
517 * kup [8] CertRepMessage, --Key Update Response
518 * krr [9] CertReqMessages, --Key Recovery Request
519 * krp [10] KeyRecRepContent, --Key Recovery Response
520 * rr [11] RevReqContent, --Revocation Request
521 * rp [12] RevRepContent, --Revocation Response
522 * ccr [13] CertReqMessages, --Cross-Cert. Request
523 * ccp [14] CertRepMessage, --Cross-Cert. Response
524 * ckuann [15] CAKeyUpdAnnContent, --CA Key Update Ann.
525 * cann [16] CertAnnContent, --Certificate Ann.
526 * rann [17] RevAnnContent, --Revocation Ann.
527 * crlann [18] CRLAnnContent, --CRL Announcement
528 * pkiconf [19] PKIConfirmContent, --Confirmation
529 * nested [20] NestedMessageContent, --Nested Message
530 * genm [21] GenMsgContent, --General Message
531 * genp [22] GenRepContent, --General Response
532 * error [23] ErrorMsgContent, --Error Message
533 * certConf [24] CertConfirmContent, --Certificate confirm
534 * pollReq [25] PollReqContent, --Polling request
535 * pollRep [26] PollRepContent --Polling response
536 * }
537 */
538 typedef struct ossl_cmp_pkibody_st {
539 int type;
540 union {
541 OSSL_CRMF_MSGS *ir; /* 0 */
542 OSSL_CMP_CERTREPMESSAGE *ip; /* 1 */
543 OSSL_CRMF_MSGS *cr; /* 2 */
544 OSSL_CMP_CERTREPMESSAGE *cp; /* 3 */
545 /*-
546 * p10cr [4] CertificationRequest, --imported from [PKCS10]
547 *
548 * PKCS10_CERTIFICATIONREQUEST is effectively X509_REQ
549 * so it is used directly
550 */
551 X509_REQ *p10cr; /* 4 */
552 /*-
553 * popdecc [5] POPODecKeyChallContent, --pop Challenge
554 *
555 * POPODecKeyChallContent ::= SEQUENCE OF Challenge
556 */
557 OSSL_CMP_POPODECKEYCHALLCONTENT *popdecc; /* 5 */
558 /*-
559 * popdecr [6] POPODecKeyRespContent, --pop Response
560 *
561 * POPODecKeyRespContent ::= SEQUENCE OF INTEGER
562 */
563 OSSL_CMP_POPODECKEYRESPCONTENT *popdecr; /* 6 */
564 OSSL_CRMF_MSGS *kur; /* 7 */
565 OSSL_CMP_CERTREPMESSAGE *kup; /* 8 */
566 OSSL_CRMF_MSGS *krr; /* 9 */
567
568 /*-
569 * krp [10] KeyRecRepContent, --Key Recovery Response
570 */
571 OSSL_CMP_KEYRECREPCONTENT *krp; /* 10 */
572 /*-
573 * rr [11] RevReqContent, --Revocation Request
574 */
575 OSSL_CMP_REVREQCONTENT *rr; /* 11 */
576 /*-
577 * rp [12] RevRepContent, --Revocation Response
578 */
579 OSSL_CMP_REVREPCONTENT *rp; /* 12 */
580 /*-
581 * ccr [13] CertReqMessages, --Cross-Cert. Request
582 */
583 OSSL_CRMF_MSGS *ccr; /* 13 */
584 /*-
585 * ccp [14] CertRepMessage, --Cross-Cert. Response
586 */
587 OSSL_CMP_CERTREPMESSAGE *ccp; /* 14 */
588 /*-
589 * ckuann [15] CAKeyUpdAnnContent, --CA Key Update Ann.
590 */
591 OSSL_CMP_CAKEYUPDANNCONTENT *ckuann; /* 15 */
592 /*-
593 * cann [16] CertAnnContent, --Certificate Ann.
594 * OSSL_CMP_CMPCERTIFICATE is effectively X509 so it is used directly
595 */
596 X509 *cann; /* 16 */
597 /*-
598 * rann [17] RevAnnContent, --Revocation Ann.
599 */
600 OSSL_CMP_REVANNCONTENT *rann; /* 17 */
601 /*-
602 * crlann [18] CRLAnnContent, --CRL Announcement
603 * CRLAnnContent ::= SEQUENCE OF CertificateList
604 */
605 OSSL_CMP_CRLANNCONTENT *crlann; /* 18 */
606 /*-
607 * PKIConfirmContent ::= NULL
608 * pkiconf [19] PKIConfirmContent, --Confirmation
609 * OSSL_CMP_PKICONFIRMCONTENT would be only a typedef of ASN1_NULL
610 * OSSL_CMP_CONFIRMCONTENT *pkiconf;
611 *
612 * NOTE: this should ASN1_NULL according to the RFC
613 * but there might be a struct in it when sent from faulty servers...
614 */
615 ASN1_TYPE *pkiconf; /* 19 */
616 /*-
617 * nested [20] NestedMessageContent, --Nested Message
618 * NestedMessageContent ::= PKIMessages
619 */
620 OSSL_CMP_MSGS *nested; /* 20 */
621 /*-
622 * genm [21] GenMsgContent, --General Message
623 * GenMsgContent ::= SEQUENCE OF InfoTypeAndValue
624 */
625 OSSL_CMP_GENMSGCONTENT *genm; /* 21 */
626 /*-
627 * genp [22] GenRepContent, --General Response
628 * GenRepContent ::= SEQUENCE OF InfoTypeAndValue
629 */
630 OSSL_CMP_GENREPCONTENT *genp; /* 22 */
631 /*-
632 * error [23] ErrorMsgContent, --Error Message
633 */
634 OSSL_CMP_ERRORMSGCONTENT *error; /* 23 */
635 /*-
636 * certConf [24] CertConfirmContent, --Certificate confirm
637 */
638 OSSL_CMP_CERTCONFIRMCONTENT *certConf; /* 24 */
639 /*-
640 * pollReq [25] PollReqContent, --Polling request
641 */
642 OSSL_CMP_POLLREQCONTENT *pollReq; /* 25 */
643 /*-
644 * pollRep [26] PollRepContent --Polling response
645 */
646 OSSL_CMP_POLLREPCONTENT *pollRep; /* 26 */
647 } value;
648 } OSSL_CMP_PKIBODY;
649 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_PKIBODY)
650
651 /*-
652 * PKIProtection ::= BIT STRING
653 *
654 * PKIMessages ::= SEQUENCE SIZE (1..MAX) OF PKIMessage
655 *
656 * PKIMessage ::= SEQUENCE {
657 * header PKIHeader,
658 * body PKIBody,
659 * protection [0] PKIProtection OPTIONAL,
660 * extraCerts [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
661 * OPTIONAL
662 * }
663 */
664 struct ossl_cmp_msg_st {
665 OSSL_CMP_PKIHEADER *header;
666 OSSL_CMP_PKIBODY *body;
667 ASN1_BIT_STRING *protection; /* 0 */
668 /* OSSL_CMP_CMPCERTIFICATE is effectively X509 so it is used directly */
669 STACK_OF(X509) *extraCerts; /* 1 */
670 } /* OSSL_CMP_MSG */;
671 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_MSG)
672
673 /*-
674 * ProtectedPart ::= SEQUENCE {
675 * header PKIHeader,
676 * body PKIBody
677 * }
678 */
679 typedef struct ossl_cmp_protectedpart_st {
680 OSSL_CMP_PKIHEADER *header;
681 OSSL_CMP_PKIBODY *body;
682 } OSSL_CMP_PROTECTEDPART;
683 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_PROTECTEDPART)
684
685 /*-
686 * this is not defined here as it is already in CRMF:
687 * id-PasswordBasedMac OBJECT IDENTIFIER ::= {1 2 840 113533 7 66 13}
688 * PBMParameter ::= SEQUENCE {
689 * salt OCTET STRING,
690 * -- note: implementations MAY wish to limit acceptable sizes
691 * -- of this string to values appropriate for their environment
692 * -- in order to reduce the risk of denial-of-service attacks
693 * owf AlgorithmIdentifier,
694 * -- AlgId for a One-Way Function (SHA-1 recommended)
695 * iterationCount INTEGER,
696 * -- number of times the OWF is applied
697 * -- note: implementations MAY wish to limit acceptable sizes
698 * -- of this integer to values appropriate for their environment
699 * -- in order to reduce the risk of denial-of-service attacks
700 * mac AlgorithmIdentifier
701 * -- the MAC AlgId (e.g., DES-MAC, Triple-DES-MAC [PKCS11],
702 * } -- or HMAC [RFC2104, RFC2202])
703 */
704 /*-
705 * TODO: this is not yet defined here - but DH is anyway not used yet
706 *
707 * id-DHBasedMac OBJECT IDENTIFIER ::= {1 2 840 113533 7 66 30}
708 * DHBMParameter ::= SEQUENCE {
709 * owf AlgorithmIdentifier,
710 * -- AlgId for a One-Way Function (SHA-1 recommended)
711 * mac AlgorithmIdentifier
712 * -- the MAC AlgId (e.g., DES-MAC, Triple-DES-MAC [PKCS11],
713 * } -- or HMAC [RFC2104, RFC2202])
714 */
715 /*-
716 * The following is not cared for, because it is described in section 5.2.5
717 * that this is beyond the scope of CMP
718 * OOBCert ::= CMPCertificate
719 *
720 * OOBCertHash ::= SEQUENCE {
721 * hashAlg [0] AlgorithmIdentifier OPTIONAL,
722 * certId [1] CertId OPTIONAL,
723 * hashVal BIT STRING
724 * -- hashVal is calculated over the DER encoding of the
725 * -- self-signed certificate with the identifier certID.
726 * }
727 */
728
729 /* from cmp_asn.c */
730 int ossl_cmp_asn1_get_int(const ASN1_INTEGER *a);
731
732 /* from cmp_util.c */
733 const char *ossl_cmp_log_parse_metadata(const char *buf,
734 OSSL_CMP_severity *level, char **func,
735 char **file, int *line);
736 # define ossl_cmp_add_error_data(txt) ERR_add_error_txt(" : ", txt)
737 # define ossl_cmp_add_error_line(txt) ERR_add_error_txt("\n", txt)
738 /* The two functions manipulating X509_STORE could be generally useful */
739 int ossl_cmp_X509_STORE_add1_certs(X509_STORE *store, STACK_OF(X509) *certs,
740 int only_self_issued);
741 STACK_OF(X509) *ossl_cmp_X509_STORE_get1_certs(X509_STORE *store);
742 int ossl_cmp_sk_ASN1_UTF8STRING_push_str(STACK_OF(ASN1_UTF8STRING) *sk,
743 const char *text);
744 int ossl_cmp_asn1_octet_string_set1(ASN1_OCTET_STRING **tgt,
745 const ASN1_OCTET_STRING *src);
746 int ossl_cmp_asn1_octet_string_set1_bytes(ASN1_OCTET_STRING **tgt,
747 const unsigned char *bytes, int len);
748 STACK_OF(X509)
749 *ossl_cmp_build_cert_chain(OPENSSL_CTX *libctx, const char *propq,
750 X509_STORE *store,
751 STACK_OF(X509) *certs, X509 *cert);
752
753 /* from cmp_ctx.c */
754 int ossl_cmp_print_log(OSSL_CMP_severity level, const OSSL_CMP_CTX *ctx,
755 const char *func, const char *file, int line,
756 const char *level_str, const char *format, ...);
757 # define ossl_cmp_log(level, ctx, msg) \
758 ossl_cmp_print_log(OSSL_CMP_LOG_##level, ctx, OPENSSL_FUNC, OPENSSL_FILE, \
759 OPENSSL_LINE, #level, "%s", msg)
760 # define ossl_cmp_log1(level, ctx, fmt, arg1) \
761 ossl_cmp_print_log(OSSL_CMP_LOG_##level, ctx, OPENSSL_FUNC, OPENSSL_FILE, \
762 OPENSSL_LINE, #level, fmt, arg1)
763 # define ossl_cmp_log2(level, ctx, fmt, arg1, arg2) \
764 ossl_cmp_print_log(OSSL_CMP_LOG_##level, ctx, OPENSSL_FUNC, OPENSSL_FILE, \
765 OPENSSL_LINE, #level, fmt, arg1, arg2)
766 # define ossl_cmp_log3(level, ctx, fmt, arg1, arg2, arg3) \
767 ossl_cmp_print_log(OSSL_CMP_LOG_##level, ctx, OPENSSL_FUNC, OPENSSL_FILE, \
768 OPENSSL_LINE, #level, fmt, arg1, arg2, arg3)
769 # define ossl_cmp_log4(level, ctx, fmt, arg1, arg2, arg3, arg4) \
770 ossl_cmp_print_log(OSSL_CMP_LOG_##level, ctx, OPENSSL_FUNC, OPENSSL_FILE, \
771 OPENSSL_LINE, #level, fmt, arg1, arg2, arg3, arg4)
772 # define OSSL_CMP_LOG_ERROR OSSL_CMP_LOG_ERR
773 # define OSSL_CMP_LOG_WARN OSSL_CMP_LOG_WARNING
774 # define ossl_cmp_alert(ctx, msg) ossl_cmp_log(ALERT, ctx, msg)
775 # define ossl_cmp_err(ctx, msg) ossl_cmp_log(ERROR, ctx, msg)
776 # define ossl_cmp_warn(ctx, msg) ossl_cmp_log(WARN, ctx, msg)
777 # define ossl_cmp_info(ctx, msg) ossl_cmp_log(INFO, ctx, msg)
778 # define ossl_cmp_debug(ctx, msg) ossl_cmp_log(DEBUG, ctx, msg)
779 int ossl_cmp_ctx_set0_validatedSrvCert(OSSL_CMP_CTX *ctx, X509 *cert);
780 int ossl_cmp_ctx_set_status(OSSL_CMP_CTX *ctx, int status);
781 int ossl_cmp_ctx_set0_statusString(OSSL_CMP_CTX *ctx,
782 OSSL_CMP_PKIFREETEXT *text);
783 int ossl_cmp_ctx_set_failInfoCode(OSSL_CMP_CTX *ctx, int fail_info);
784 int ossl_cmp_ctx_set0_newCert(OSSL_CMP_CTX *ctx, X509 *cert);
785 int ossl_cmp_ctx_set1_newChain(OSSL_CMP_CTX *ctx, STACK_OF(X509) *newChain);
786 int ossl_cmp_ctx_set1_caPubs(OSSL_CMP_CTX *ctx, STACK_OF(X509) *caPubs);
787 int ossl_cmp_ctx_set1_extraCertsIn(OSSL_CMP_CTX *ctx,
788 STACK_OF(X509) *extraCertsIn);
789 int ossl_cmp_ctx_set1_recipNonce(OSSL_CMP_CTX *ctx,
790 const ASN1_OCTET_STRING *nonce);
791
792 /* from cmp_status.c */
793 int ossl_cmp_pkisi_get_status(const OSSL_CMP_PKISI *si);
794 const char *ossl_cmp_PKIStatus_to_string(int status);
795 OSSL_CMP_PKIFREETEXT *ossl_cmp_pkisi_get0_statusString(const OSSL_CMP_PKISI *s);
796 int ossl_cmp_pkisi_get_pkifailureinfo(const OSSL_CMP_PKISI *si);
797 int ossl_cmp_pkisi_check_pkifailureinfo(const OSSL_CMP_PKISI *si, int index);
798
799 /* from cmp_hdr.c */
800 int ossl_cmp_hdr_set_pvno(OSSL_CMP_PKIHEADER *hdr, int pvno);
801 int ossl_cmp_hdr_get_pvno(const OSSL_CMP_PKIHEADER *hdr);
802 int ossl_cmp_hdr_get_protection_nid(const OSSL_CMP_PKIHEADER *hdr);
803 ASN1_OCTET_STRING *ossl_cmp_hdr_get0_senderNonce(const OSSL_CMP_PKIHEADER *hdr);
804 int ossl_cmp_general_name_is_NULL_DN(GENERAL_NAME *name);
805 int ossl_cmp_hdr_set1_sender(OSSL_CMP_PKIHEADER *hdr, const X509_NAME *nm);
806 int ossl_cmp_hdr_set1_recipient(OSSL_CMP_PKIHEADER *hdr, const X509_NAME *nm);
807 int ossl_cmp_hdr_update_messageTime(OSSL_CMP_PKIHEADER *hdr);
808 int ossl_cmp_hdr_set1_senderKID(OSSL_CMP_PKIHEADER *hdr,
809 const ASN1_OCTET_STRING *senderKID);
810 int ossl_cmp_hdr_push0_freeText(OSSL_CMP_PKIHEADER *hdr, ASN1_UTF8STRING *text);
811 int ossl_cmp_hdr_push1_freeText(OSSL_CMP_PKIHEADER *hdr, ASN1_UTF8STRING *text);
812 int ossl_cmp_hdr_generalInfo_push0_item(OSSL_CMP_PKIHEADER *hdr,
813 OSSL_CMP_ITAV *itav);
814 int ossl_cmp_hdr_generalInfo_push1_items(OSSL_CMP_PKIHEADER *hdr,
815 const STACK_OF(OSSL_CMP_ITAV) *itavs);
816 int ossl_cmp_hdr_set_implicitConfirm(OSSL_CMP_PKIHEADER *hdr);
817 int ossl_cmp_hdr_has_implicitConfirm(const OSSL_CMP_PKIHEADER *hdr);
818 # define OSSL_CMP_TRANSACTIONID_LENGTH 16
819 # define OSSL_CMP_SENDERNONCE_LENGTH 16
820 int ossl_cmp_hdr_set_transactionID(OSSL_CMP_CTX *ctx, OSSL_CMP_PKIHEADER *hdr);
821 int ossl_cmp_hdr_init(OSSL_CMP_CTX *ctx, OSSL_CMP_PKIHEADER *hdr);
822
823 /* from cmp_msg.c */
824 /* OSSL_CMP_MSG bodytype ASN.1 choice IDs */
825 # define OSSL_CMP_PKIBODY_IR 0
826 # define OSSL_CMP_PKIBODY_IP 1
827 # define OSSL_CMP_PKIBODY_CR 2
828 # define OSSL_CMP_PKIBODY_CP 3
829 # define OSSL_CMP_PKIBODY_P10CR 4
830 # define OSSL_CMP_PKIBODY_POPDECC 5
831 # define OSSL_CMP_PKIBODY_POPDECR 6
832 # define OSSL_CMP_PKIBODY_KUR 7
833 # define OSSL_CMP_PKIBODY_KUP 8
834 # define OSSL_CMP_PKIBODY_KRR 9
835 # define OSSL_CMP_PKIBODY_KRP 10
836 # define OSSL_CMP_PKIBODY_RR 11
837 # define OSSL_CMP_PKIBODY_RP 12
838 # define OSSL_CMP_PKIBODY_CCR 13
839 # define OSSL_CMP_PKIBODY_CCP 14
840 # define OSSL_CMP_PKIBODY_CKUANN 15
841 # define OSSL_CMP_PKIBODY_CANN 16
842 # define OSSL_CMP_PKIBODY_RANN 17
843 # define OSSL_CMP_PKIBODY_CRLANN 18
844 # define OSSL_CMP_PKIBODY_PKICONF 19
845 # define OSSL_CMP_PKIBODY_NESTED 20
846 # define OSSL_CMP_PKIBODY_GENM 21
847 # define OSSL_CMP_PKIBODY_GENP 22
848 # define OSSL_CMP_PKIBODY_ERROR 23
849 # define OSSL_CMP_PKIBODY_CERTCONF 24
850 # define OSSL_CMP_PKIBODY_POLLREQ 25
851 # define OSSL_CMP_PKIBODY_POLLREP 26
852 # define OSSL_CMP_PKIBODY_TYPE_MAX OSSL_CMP_PKIBODY_POLLREP
853 /* certReqId for the first - and so far only - certificate request */
854 # define OSSL_CMP_CERTREQID 0
855 /* sequence id for the first - and so far only - revocation request */
856 # define OSSL_CMP_REVREQSID 0
857 const char *ossl_cmp_bodytype_to_string(int type);
858 int ossl_cmp_msg_set_bodytype(OSSL_CMP_MSG *msg, int type);
859 int ossl_cmp_msg_get_bodytype(const OSSL_CMP_MSG *msg);
860 OSSL_CMP_MSG *ossl_cmp_msg_create(OSSL_CMP_CTX *ctx, int bodytype);
861 OSSL_CMP_MSG *ossl_cmp_certreq_new(OSSL_CMP_CTX *ctx, int bodytype,
862 const OSSL_CRMF_MSG *crm);
863 OSSL_CMP_MSG *ossl_cmp_certrep_new(OSSL_CMP_CTX *ctx, int bodytype,
864 int certReqId, OSSL_CMP_PKISI *si,
865 X509 *cert, STACK_OF(X509) *chain,
866 STACK_OF(X509) *caPubs, int encrypted,
867 int unprotectedErrors);
868 OSSL_CMP_MSG *ossl_cmp_rr_new(OSSL_CMP_CTX *ctx);
869 OSSL_CMP_MSG *ossl_cmp_rp_new(OSSL_CMP_CTX *ctx, OSSL_CMP_PKISI *si,
870 OSSL_CRMF_CERTID *certId, int unprot_err);
871 OSSL_CMP_MSG *ossl_cmp_pkiconf_new(OSSL_CMP_CTX *ctx);
872 OSSL_CMP_MSG *ossl_cmp_pollRep_new(OSSL_CMP_CTX *ctx, int crid,
873 int64_t poll_after);
874 int ossl_cmp_msg_gen_push0_ITAV(OSSL_CMP_MSG *msg, OSSL_CMP_ITAV *itav);
875 int ossl_cmp_msg_gen_push1_ITAVs(OSSL_CMP_MSG *msg,
876 const STACK_OF(OSSL_CMP_ITAV) *itavs);
877 OSSL_CMP_MSG *ossl_cmp_genm_new(OSSL_CMP_CTX *ctx);
878 OSSL_CMP_MSG *ossl_cmp_genp_new(OSSL_CMP_CTX *ctx,
879 const STACK_OF(OSSL_CMP_ITAV) *itavs);
880 OSSL_CMP_MSG *ossl_cmp_error_new(OSSL_CMP_CTX *ctx, OSSL_CMP_PKISI *si,
881 int errorCode,
882 const char *details, int unprotected);
883 int ossl_cmp_certstatus_set0_certHash(OSSL_CMP_CERTSTATUS *certStatus,
884 ASN1_OCTET_STRING *hash);
885 OSSL_CMP_MSG *ossl_cmp_certConf_new(OSSL_CMP_CTX *ctx, int fail_info,
886 const char *text);
887 OSSL_CMP_MSG *ossl_cmp_pollReq_new(OSSL_CMP_CTX *ctx, int crid);
888 OSSL_CMP_MSG *ossl_cmp_pollRep_new(OSSL_CMP_CTX *ctx, int crid,
889 int64_t poll_after);
890 OSSL_CMP_PKISI *
891 ossl_cmp_revrepcontent_get_pkisi(OSSL_CMP_REVREPCONTENT *rrep, int rsid);
892 OSSL_CRMF_CERTID *ossl_cmp_revrepcontent_get_CertId(OSSL_CMP_REVREPCONTENT *rc,
893 int rsid);
894 OSSL_CMP_POLLREP *
895 ossl_cmp_pollrepcontent_get0_pollrep(const OSSL_CMP_POLLREPCONTENT *prc,
896 int rid);
897 OSSL_CMP_CERTRESPONSE *
898 ossl_cmp_certrepmessage_get0_certresponse(const OSSL_CMP_CERTREPMESSAGE *crm,
899 int rid);
900 X509 *ossl_cmp_certresponse_get1_cert(const OSSL_CMP_CERTRESPONSE *crep,
901 const OSSL_CMP_CTX *ctx, EVP_PKEY *pkey);
902 OSSL_CMP_MSG *ossl_cmp_msg_load(const char *file);
903
904 /* from cmp_protect.c */
905 int ossl_cmp_msg_add_extraCerts(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
906 ASN1_BIT_STRING *ossl_cmp_calc_protection(const OSSL_CMP_CTX *ctx,
907 const OSSL_CMP_MSG *msg);
908 int ossl_cmp_msg_protect(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
909
910 /* from cmp_vfy.c */
911 typedef int (*ossl_cmp_allow_unprotected_cb_t)(const OSSL_CMP_CTX *ctx,
912 const OSSL_CMP_MSG *msg,
913 int invalid_protection, int arg);
914 int ossl_cmp_msg_check_update(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *msg,
915 ossl_cmp_allow_unprotected_cb_t cb, int cb_arg);
916 int ossl_cmp_msg_check_received(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *msg,
917 ossl_cmp_allow_unprotected_cb_t cb, int cb_arg);
918 int ossl_cmp_verify_popo(const OSSL_CMP_CTX *ctx,
919 const OSSL_CMP_MSG *msg, int accept_RAVerified);
920
921 /* from cmp_client.c */
922 int ossl_cmp_exchange_certConf(OSSL_CMP_CTX *ctx, int fail_info,
923 const char *txt);
924 int ossl_cmp_exchange_error(OSSL_CMP_CTX *ctx, int status, int fail_info,
925 const char *txt, int errorCode, const char *detail);
926
927 #endif /* !defined(OSSL_CRYPTO_CMP_LOCAL_H) */