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