CMP: introduce version 3, while version 2 stays the default

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18294)
This commit is contained in:
Dr. David von Oheimb 2022-05-04 15:49:47 +02:00 committed by Hugo Landau
parent 3ee2611677
commit c4ad4e5bf6
4 changed files with 7 additions and 4 deletions

View File

@ -446,7 +446,7 @@ DECLARE_ASN1_FUNCTIONS(OSSL_CMP_POLLREPCONTENT)
/*- /*-
* PKIHeader ::= SEQUENCE { * PKIHeader ::= SEQUENCE {
* pvno INTEGER { cmp1999(1), cmp2000(2) }, * pvno INTEGER { cmp1999(1), cmp2000(2), cmp2021(3) },
* sender GeneralName, * sender GeneralName,
* -- identifies the sender * -- identifies the sender
* recipient GeneralName, * recipient GeneralName,

View File

@ -749,7 +749,8 @@ int ossl_cmp_msg_check_update(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *msg,
} }
/* check CMP version number in header */ /* check CMP version number in header */
if (ossl_cmp_hdr_get_pvno(hdr) != OSSL_CMP_PVNO) { if (ossl_cmp_hdr_get_pvno(hdr) != OSSL_CMP_PVNO_2
&& ossl_cmp_hdr_get_pvno(hdr) != OSSL_CMP_PVNO_3) {
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION #ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
ERR_raise(ERR_LIB_CMP, CMP_R_UNEXPECTED_PVNO); ERR_raise(ERR_LIB_CMP, CMP_R_UNEXPECTED_PVNO);
return 0; return 0;

View File

@ -33,7 +33,7 @@ The B<msg> is checked for the following:
=item its protection is present and valid (or a callback function B<cb> =item its protection is present and valid (or a callback function B<cb>
is present and indicates that a missing or invalid protection is acceptable), is present and indicates that a missing or invalid protection is acceptable),
=item its CMP protocol version is acceptable, namely B<OSSL_CMP_PVNO>, =item its CMP protocol version is acceptable,
=item its body type is valid, =item its body type is valid,

View File

@ -36,7 +36,9 @@ use OpenSSL::stackhash qw(generate_stack_macros);
extern "C" { extern "C" {
# endif # endif
# define OSSL_CMP_PVNO 2 # define OSSL_CMP_PVNO_2 2
# define OSSL_CMP_PVNO_3 3
# define OSSL_CMP_PVNO OSSL_CMP_PVNO_2 /* v2 is the default */
/*- /*-
* PKIFailureInfo ::= BIT STRING { * PKIFailureInfo ::= BIT STRING {