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