summaryrefslogtreecommitdiff
path: root/crypto/cmp/cmp_protect.c
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2026-01-29 01:27:53 +0000
committerEnji Cooper <ngie@FreeBSD.org>2026-01-29 01:27:53 +0000
commit808413da28df9fb93e1f304e6016b15e660f54c8 (patch)
treef3ecb4f928716223c9563ee34e044ab84549debb /crypto/cmp/cmp_protect.c
parent8e12a5c4eb3507846b507d0afe87d115af41df40 (diff)
Diffstat (limited to 'crypto/cmp/cmp_protect.c')
-rw-r--r--crypto/cmp/cmp_protect.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/crypto/cmp/cmp_protect.c b/crypto/cmp/cmp_protect.c
index e4f3bffed720..1c8d2135fdab 100644
--- a/crypto/cmp/cmp_protect.c
+++ b/crypto/cmp/cmp_protect.c
@@ -31,7 +31,7 @@
* returns ASN1_BIT_STRING representing the protection on success, else NULL
*/
ASN1_BIT_STRING *ossl_cmp_calc_protection(const OSSL_CMP_CTX *ctx,
- const OSSL_CMP_MSG *msg)
+ const OSSL_CMP_MSG *msg)
{
ASN1_BIT_STRING *prot = NULL;
OSSL_CMP_PROTECTEDPART prot_part;
@@ -87,9 +87,9 @@ ASN1_BIT_STRING *ossl_cmp_calc_protection(const OSSL_CMP_CTX *ctx,
}
if (!OSSL_CRMF_pbm_new(ctx->libctx, ctx->propq,
- pbm, prot_part_der, prot_part_der_len,
- ctx->secretValue->data, ctx->secretValue->length,
- &protection, &sig_len))
+ pbm, prot_part_der, prot_part_der_len,
+ ctx->secretValue->data, ctx->secretValue->length,
+ &protection, &sig_len))
goto end;
if ((prot = ASN1_BIT_STRING_new()) == NULL)
@@ -111,7 +111,7 @@ ASN1_BIT_STRING *ossl_cmp_calc_protection(const OSSL_CMP_CTX *ctx,
if (ctx->pkey == NULL) {
ERR_raise(ERR_LIB_CMP,
- CMP_R_MISSING_KEY_INPUT_FOR_CREATING_PROTECTION);
+ CMP_R_MISSING_KEY_INPUT_FOR_CREATING_PROTECTION);
return NULL;
}
if (EVP_PKEY_get_default_digest_name(ctx->pkey, name, sizeof(name)) > 0
@@ -121,9 +121,9 @@ ASN1_BIT_STRING *ossl_cmp_calc_protection(const OSSL_CMP_CTX *ctx,
if ((prot = ASN1_BIT_STRING_new()) == NULL)
return NULL;
if (ASN1_item_sign_ex(ASN1_ITEM_rptr(OSSL_CMP_PROTECTEDPART),
- msg->header->protectionAlg, /* sets X509_ALGOR */
- NULL, prot, &prot_part, NULL, ctx->pkey, md,
- ctx->libctx, ctx->propq))
+ msg->header->protectionAlg, /* sets X509_ALGOR */
+ NULL, prot, &prot_part, NULL, ctx->pkey, md,
+ ctx->libctx, ctx->propq))
return prot;
ASN1_BIT_STRING_free(prot);
return NULL;
@@ -138,7 +138,7 @@ void ossl_cmp_set_own_chain(OSSL_CMP_CTX *ctx)
if (ctx->chain == NULL) {
ossl_cmp_debug(ctx, "trying to build chain for own CMP signer cert");
ctx->chain = X509_build_chain(ctx->cert, ctx->untrusted, NULL, 0,
- ctx->libctx, ctx->propq);
+ ctx->libctx, ctx->propq);
if (ctx->chain != NULL) {
ossl_cmp_debug(ctx, "success building chain for own CMP signer cert");
} else {
@@ -157,7 +157,7 @@ int ossl_cmp_msg_add_extraCerts(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg)
/* Add first ctx->cert and its chain if using signature-based protection */
if (!ctx->unprotectedSend && ctx->secretValue == NULL
- && ctx->cert != NULL && ctx->pkey != NULL) {
+ && ctx->cert != NULL && ctx->pkey != NULL) {
int prepend = X509_ADD_FLAG_UP_REF | X509_ADD_FLAG_NO_DUP
| X509_ADD_FLAG_PREPEND | X509_ADD_FLAG_NO_SS;
@@ -175,7 +175,7 @@ int ossl_cmp_msg_add_extraCerts(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg)
/* add any additional certificates from ctx->extraCertsOut */
if (!ossl_x509_add_certs_new(&msg->extraCerts, ctx->extraCertsOut,
- X509_ADD_FLAG_UP_REF | X509_ADD_FLAG_NO_DUP))
+ X509_ADD_FLAG_UP_REF | X509_ADD_FLAG_NO_DUP))
return 0;
/* in case extraCerts are empty list avoid empty ASN.1 sequence */
@@ -202,8 +202,8 @@ static X509_ALGOR *pbmac_algor(const OSSL_CMP_CTX *ctx)
return NULL;
pbm = OSSL_CRMF_pbmp_new(ctx->libctx, ctx->pbm_slen,
- EVP_MD_get_type(ctx->pbm_owf), ctx->pbm_itercnt,
- ctx->pbm_mac);
+ EVP_MD_get_type(ctx->pbm_owf), ctx->pbm_itercnt,
+ ctx->pbm_mac);
pbm_str = ASN1_STRING_new();
if (pbm == NULL || pbm_str == NULL)
goto err;
@@ -212,8 +212,8 @@ static X509_ALGOR *pbmac_algor(const OSSL_CMP_CTX *ctx)
if (!ASN1_STRING_set(pbm_str, pbm_der, pbm_der_len))
goto err;
alg = ossl_X509_ALGOR_from_nid(NID_id_PasswordBasedMAC,
- V_ASN1_SEQUENCE, pbm_str);
- err:
+ V_ASN1_SEQUENCE, pbm_str);
+err:
if (alg == NULL)
ASN1_STRING_free(pbm_str);
OPENSSL_free(pbm_der);
@@ -222,7 +222,7 @@ static X509_ALGOR *pbmac_algor(const OSSL_CMP_CTX *ctx)
}
static int set_senderKID(const OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg,
- const ASN1_OCTET_STRING *id)
+ const ASN1_OCTET_STRING *id)
{
if (id == NULL)
id = ctx->referenceValue; /* standard for PBM, fallback for sig-based */
@@ -280,12 +280,12 @@ int ossl_cmp_msg_protect(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg)
*/
} else {
ERR_raise(ERR_LIB_CMP,
- CMP_R_MISSING_KEY_INPUT_FOR_CREATING_PROTECTION);
+ CMP_R_MISSING_KEY_INPUT_FOR_CREATING_PROTECTION);
goto err;
}
if (!ctx->unprotectedSend
/* protect according to msg->header->protectionAlg partly set above */
- && ((msg->protection = ossl_cmp_calc_protection(ctx, msg)) == NULL))
+ && ((msg->protection = ossl_cmp_calc_protection(ctx, msg)) == NULL))
goto err;
/*
@@ -298,16 +298,16 @@ int ossl_cmp_msg_protect(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg)
goto err;
/*
- * As required by RFC 4210 section 5.1.1., if the sender name is not known
+ * As required by RFC 9810 section 5.1.1., if the sender name is not known
* to the client it set to NULL-DN. In this case for identification at least
* the senderKID must be set, where we took the referenceValue as fallback.
*/
if (!(ossl_cmp_general_name_is_NULL_DN(msg->header->sender)
- && msg->header->senderKID == NULL))
+ && msg->header->senderKID == NULL))
return 1;
ERR_raise(ERR_LIB_CMP, CMP_R_MISSING_SENDER_IDENTIFICATION);
- err:
+err:
ERR_raise(ERR_LIB_CMP, CMP_R_ERROR_PROTECTING_MESSAGE);
return 0;
}