projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
GH601: Various spelling fixes.
[openssl.git]
/
crypto
/
cms
/
cms_lib.c
diff --git
a/crypto/cms/cms_lib.c
b/crypto/cms/cms_lib.c
index e698c006bfcbadcb3ccdbcb021cd78915333cca1..a0a1adb38adf5c98f44943a29d1ab86475a15bbc 100644
(file)
--- a/
crypto/cms/cms_lib.c
+++ b/
crypto/cms/cms_lib.c
@@
-1,4
+1,3
@@
-/* crypto/cms/cms_lib.c */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@
-64,11
+63,6
@@
IMPLEMENT_ASN1_FUNCTIONS(CMS_ContentInfo)
IMPLEMENT_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
IMPLEMENT_ASN1_FUNCTIONS(CMS_ContentInfo)
IMPLEMENT_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
-DECLARE_ASN1_ITEM(CMS_CertificateChoices)
-DECLARE_ASN1_ITEM(CMS_RevocationInfoChoice)
-DECLARE_STACK_OF(CMS_CertificateChoices)
-DECLARE_STACK_OF(CMS_RevocationInfoChoice)
-
const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms)
{
return cms->contentType;
const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms)
{
return cms->contentType;
@@
-78,7
+72,7
@@
CMS_ContentInfo *cms_Data_create(void)
{
CMS_ContentInfo *cms;
cms = CMS_ContentInfo_new();
{
CMS_ContentInfo *cms;
cms = CMS_ContentInfo_new();
- if (cms) {
+ if (cms
!= NULL
) {
cms->contentType = OBJ_nid2obj(NID_pkcs7_data);
/* Never detached */
CMS_set_detached(cms, 0);
cms->contentType = OBJ_nid2obj(NID_pkcs7_data);
/* Never detached */
CMS_set_detached(cms, 0);
@@
-159,7
+153,7
@@
int CMS_dataFinal(CMS_ContentInfo *cms, BIO *cmsbio)
ASN1_OCTET_STRING **pos = CMS_get0_content(cms);
if (!pos)
return 0;
ASN1_OCTET_STRING **pos = CMS_get0_content(cms);
if (!pos)
return 0;
- /* If e
bm
edded content find memory BIO and set content */
+ /* If e
mb
edded content find memory BIO and set content */
if (*pos && ((*pos)->flags & ASN1_STRING_FLAG_CONT)) {
BIO *mbio;
unsigned char *cont;
if (*pos && ((*pos)->flags & ASN1_STRING_FLAG_CONT)) {
BIO *mbio;
unsigned char *cont;
@@
-318,9
+312,9
@@
int CMS_set_detached(CMS_ContentInfo *cms, int detached)
*pos = NULL;
return 1;
}
*pos = NULL;
return 1;
}
- if (
!*pos
)
+ if (
*pos == NULL
)
*pos = ASN1_OCTET_STRING_new();
*pos = ASN1_OCTET_STRING_new();
- if (*pos) {
+ if (*pos
!= NULL
) {
/*
* NB: special flag to show content is created and not read in.
*/
/*
* NB: special flag to show content is created and not read in.
*/
@@
-346,7
+340,7
@@
BIO *cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm)
goto err;
}
mdbio = BIO_new(BIO_f_md());
goto err;
}
mdbio = BIO_new(BIO_f_md());
- if (
!mdbio
|| !BIO_set_md(mdbio, digest)) {
+ if (
mdbio == NULL
|| !BIO_set_md(mdbio, digest)) {
CMSerr(CMS_F_CMS_DIGESTALGORITHM_INIT_BIO, CMS_R_MD_BIO_INIT_ERROR);
goto err;
}
CMSerr(CMS_F_CMS_DIGESTALGORITHM_INIT_BIO, CMS_R_MD_BIO_INIT_ERROR);
goto err;
}
@@
-457,7
+451,7
@@
int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert)
int r;
r = CMS_add0_cert(cms, cert);
if (r > 0)
int r;
r = CMS_add0_cert(cms, cert);
if (r > 0)
-
CRYPTO_add(&cert->references, 1, CRYPTO_LOCK_X509
);
+
X509_up_ref(cert
);
return r;
}
return r;
}
@@
-542,7
+536,7
@@
STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms)
sk_X509_pop_free(certs, X509_free);
return NULL;
}
sk_X509_pop_free(certs, X509_free);
return NULL;
}
-
CRYPTO_add(&cch->d.certificate->references, 1, CRYPTO_LOCK_X509
);
+
X509_up_ref(cch->d.certificate
);
}
}
return certs;
}
}
return certs;
@@
-587,10
+581,11
@@
int cms_ias_cert_cmp(CMS_IssuerAndSerialNumber *ias, X509 *cert)
int cms_keyid_cert_cmp(ASN1_OCTET_STRING *keyid, X509 *cert)
{
int cms_keyid_cert_cmp(ASN1_OCTET_STRING *keyid, X509 *cert)
{
- X509_check_purpose(cert, -1, -1);
- if (!cert->skid)
+ const ASN1_OCTET_STRING *cert_keyid = X509_get0_subject_key_id(cert);
+
+ if (cert_keyid == NULL)
return -1;
return -1;
- return ASN1_OCTET_STRING_cmp(keyid, cert
->sk
id);
+ return ASN1_OCTET_STRING_cmp(keyid, cert
_key
id);
}
int cms_set1_ias(CMS_IssuerAndSerialNumber **pias, X509 *cert)
}
int cms_set1_ias(CMS_IssuerAndSerialNumber **pias, X509 *cert)
@@
-615,12
+610,13
@@
int cms_set1_ias(CMS_IssuerAndSerialNumber **pias, X509 *cert)
int cms_set1_keyid(ASN1_OCTET_STRING **pkeyid, X509 *cert)
{
ASN1_OCTET_STRING *keyid = NULL;
int cms_set1_keyid(ASN1_OCTET_STRING **pkeyid, X509 *cert)
{
ASN1_OCTET_STRING *keyid = NULL;
- X509_check_purpose(cert, -1, -1);
- if (!cert->skid) {
+ const ASN1_OCTET_STRING *cert_keyid;
+ cert_keyid = X509_get0_subject_key_id(cert);
+ if (cert_keyid == NULL) {
CMSerr(CMS_F_CMS_SET1_KEYID, CMS_R_CERTIFICATE_HAS_NO_KEYID);
return 0;
}
CMSerr(CMS_F_CMS_SET1_KEYID, CMS_R_CERTIFICATE_HAS_NO_KEYID);
return 0;
}
- keyid = ASN1_STRING_dup(cert
->sk
id);
+ keyid = ASN1_STRING_dup(cert
_key
id);
if (!keyid) {
CMSerr(CMS_F_CMS_SET1_KEYID, ERR_R_MALLOC_FAILURE);
return 0;
if (!keyid) {
CMSerr(CMS_F_CMS_SET1_KEYID, ERR_R_MALLOC_FAILURE);
return 0;