1=pod 2 3=head1 NAME 4 5ossl_cmp_calc_protection, 6ossl_cmp_msg_protect, 7ossl_cmp_msg_add_extraCerts 8- functions for producing CMP message protection 9 10=head1 SYNOPSIS 11 12 #include "cmp_local.h" 13 14 ASN1_BIT_STRING *ossl_cmp_calc_protection(const OSSL_CMP_CTX *ctx, 15 const OSSL_CMP_MSG *msg); 16 int ossl_cmp_msg_protect(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg); 17 int ossl_cmp_msg_add_extraCerts(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg); 18 19=head1 DESCRIPTION 20 21ossl_cmp_calc_protection() calculates the protection for the given I<msg> 22according to the algorithm and parameters in the message header's protectionAlg 23using the credentials, library context, and property criteria in the I<ctx>. 24 25ossl_cmp_msg_protect() (re-)protects the given message I<msg> using an algorithm 26depending on the available context information given in the I<ctx>. 27If there is a secretValue it selects PBMAC, else if there is a protection cert 28it selects Signature and uses ossl_cmp_msg_add_extraCerts (see below). 29It also sets the protectionAlg field in the message header accordingly. 30 31ossl_cmp_msg_add_extraCerts() adds elements to the extraCerts field in I<msg>. 32If signature-based message protection is used it adds first the CMP signer cert 33ctx->cert and then its chain ctx->chain. If this chain is not present in I<ctx> 34tries to build it using ctx->untrusted and caches the result in ctx->chain. 35In any case all the certificates explicitly specified to be sent out (i.e., 36I<ctx->extraCertsOut>) are added. Note that it will NOT add the root certificate 37of the chain, i.e, the trust anchor (unless it is part of extraCertsOut). 38 39=head1 NOTES 40 41CMP is defined in RFC 4210 (and CRMF in RFC 4211). 42 43The I<ctx> parameter of ossl_cmp_msg_add_extraCerts() 44and thus also of ossl_cmp_msg_protect() cannot be made I<const> 45because I<ctx->chain> may get adapted to cache the chain of the CMP signer cert. 46 47=head1 RETURN VALUES 48 49ossl_cmp_calc_protection() returns the protection on success, else NULL. 50 51All other functions return 1 on success, 0 on error. 52 53=head1 HISTORY 54 55The OpenSSL CMP support was added in OpenSSL 3.0. 56 57=head1 COPYRIGHT 58 59Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved. 60 61Licensed under the Apache License 2.0 (the "License"). You may not use 62this file except in compliance with the License. You can obtain a copy 63in the file LICENSE in the source distribution or at 64L<https://www.openssl.org/source/license.html>. 65 66=cut 67