aboutsummaryrefslogtreecommitdiff
path: root/crypto/cms/cms_att.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/cms/cms_att.c')
-rw-r--r--crypto/cms/cms_att.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/crypto/cms/cms_att.c b/crypto/cms/cms_att.c
index 4f716619193a..64acda72630a 100644
--- a/crypto/cms/cms_att.c
+++ b/crypto/cms/cms_att.c
@@ -1,7 +1,7 @@
/*
- * Copyright 2008-2019 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2008-2024 The OpenSSL Project Authors. All Rights Reserved.
*
- * Licensed under the OpenSSL license (the "License"). You may not use
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
@@ -12,8 +12,9 @@
#include <openssl/x509v3.h>
#include <openssl/err.h>
#include <openssl/cms.h>
-#include "cms_local.h"
#include "internal/nelem.h"
+#include "crypto/x509.h"
+#include "cms_local.h"
/*-
* Attribute flags.
@@ -94,7 +95,7 @@ X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc)
int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr)
{
- if (X509at_add1_attr(&si->signedAttrs, attr))
+ if (ossl_x509at_add1_attr(&si->signedAttrs, attr))
return 1;
return 0;
}
@@ -103,7 +104,7 @@ int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,
const ASN1_OBJECT *obj, int type,
const void *bytes, int len)
{
- if (X509at_add1_attr_by_OBJ(&si->signedAttrs, obj, type, bytes, len))
+ if (ossl_x509at_add1_attr_by_OBJ(&si->signedAttrs, obj, type, bytes, len))
return 1;
return 0;
}
@@ -111,7 +112,7 @@ int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,
int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,
int nid, int type, const void *bytes, int len)
{
- if (X509at_add1_attr_by_NID(&si->signedAttrs, nid, type, bytes, len))
+ if (ossl_x509at_add1_attr_by_NID(&si->signedAttrs, nid, type, bytes, len))
return 1;
return 0;
}
@@ -120,12 +121,14 @@ int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
const char *attrname, int type,
const void *bytes, int len)
{
- if (X509at_add1_attr_by_txt(&si->signedAttrs, attrname, type, bytes, len))
+ if (ossl_x509at_add1_attr_by_txt(&si->signedAttrs, attrname, type, bytes,
+ len))
return 1;
return 0;
}
-void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid,
+void *CMS_signed_get0_data_by_OBJ(const CMS_SignerInfo *si,
+ const ASN1_OBJECT *oid,
int lastpos, int type)
{
return X509at_get0_data_by_OBJ(si->signedAttrs, oid, lastpos, type);
@@ -160,7 +163,7 @@ X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc)
int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr)
{
- if (X509at_add1_attr(&si->unsignedAttrs, attr))
+ if (ossl_x509at_add1_attr(&si->unsignedAttrs, attr))
return 1;
return 0;
}
@@ -169,7 +172,7 @@ int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
const ASN1_OBJECT *obj, int type,
const void *bytes, int len)
{
- if (X509at_add1_attr_by_OBJ(&si->unsignedAttrs, obj, type, bytes, len))
+ if (ossl_x509at_add1_attr_by_OBJ(&si->unsignedAttrs, obj, type, bytes, len))
return 1;
return 0;
}
@@ -178,7 +181,7 @@ int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,
int nid, int type,
const void *bytes, int len)
{
- if (X509at_add1_attr_by_NID(&si->unsignedAttrs, nid, type, bytes, len))
+ if (ossl_x509at_add1_attr_by_NID(&si->unsignedAttrs, nid, type, bytes, len))
return 1;
return 0;
}
@@ -187,8 +190,8 @@ int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,
const char *attrname, int type,
const void *bytes, int len)
{
- if (X509at_add1_attr_by_txt(&si->unsignedAttrs, attrname,
- type, bytes, len))
+ if (ossl_x509at_add1_attr_by_txt(&si->unsignedAttrs, attrname,
+ type, bytes, len))
return 1;
return 0;
}
@@ -262,7 +265,7 @@ static int cms_check_attribute(int nid, int flags, int type,
* attributes. Only one instance of each is allowed, with each of these
* attributes containing a single attribute value in its set.
*/
-int CMS_si_check_attributes(const CMS_SignerInfo *si)
+int ossl_cms_si_check_attributes(const CMS_SignerInfo *si)
{
int i;
int have_signed_attrs = (CMS_signed_get_attr_count(si) > 0);
@@ -276,7 +279,7 @@ int CMS_si_check_attributes(const CMS_SignerInfo *si)
si->signedAttrs, have_signed_attrs)
|| !cms_check_attribute(nid, flags, CMS_ATTR_F_UNSIGNED,
si->unsignedAttrs, have_unsigned_attrs)) {
- CMSerr(CMS_F_CMS_SI_CHECK_ATTRIBUTES, CMS_R_ATTRIBUTE_ERROR);
+ ERR_raise(ERR_LIB_CMS, CMS_R_ATTRIBUTE_ERROR);
return 0;
}
}