Remove trailing white space.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19160 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-11-27 14:12:01 +00:00
parent d51986d91e
commit 2cac1cbf59

View File

@@ -1,34 +1,34 @@
/* /*
* Copyright (c) 2003 - 2006 Kungliga Tekniska H<>gskolan * Copyright (c) 2003 - 2006 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* *
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* *
* 3. Neither the name of the Institute nor the names of its contributors * 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "hx_locl.h" #include "hx_locl.h"
@@ -39,7 +39,7 @@ RCSID("$Id$");
int int
hx509_cms_wrap_ContentInfo(const heim_oid *oid, hx509_cms_wrap_ContentInfo(const heim_oid *oid,
const heim_octet_string *buf, const heim_octet_string *buf,
heim_octet_string *res) heim_octet_string *res)
{ {
ContentInfo ci; ContentInfo ci;
@@ -240,7 +240,7 @@ find_CMSIdentifier(hx509_context context,
"Failed to find CMS id in cert store"); "Failed to find CMS id in cert store");
return HX509_CMS_NO_RECIPIENT_CERTIFICATE; return HX509_CMS_NO_RECIPIENT_CERTIFICATE;
} }
*signer_cert = cert; *signer_cert = cert;
return 0; return 0;
@@ -314,7 +314,7 @@ hx509_cms_unenvelope(hx509_context context,
* ki->keyEncryptionAlgorithm.algorithm); * ki->keyEncryptionAlgorithm.algorithm);
*/ */
ret = find_CMSIdentifier(context, &ri->rid, certs, &cert, ret = find_CMSIdentifier(context, &ri->rid, certs, &cert,
HX509_QUERY_PRIVATE_KEY|findflags); HX509_QUERY_PRIVATE_KEY|findflags);
if (ret) if (ret)
continue; continue;
@@ -322,7 +322,7 @@ hx509_cms_unenvelope(hx509_context context,
matched = 1; /* found a matching certificate, let decrypt */ matched = 1; /* found a matching certificate, let decrypt */
ret = _hx509_cert_private_decrypt(context, ret = _hx509_cert_private_decrypt(context,
&ri->encryptedKey, &ri->encryptedKey,
&ri->keyEncryptionAlgorithm.algorithm, &ri->keyEncryptionAlgorithm.algorithm,
cert, &key); cert, &key);
@@ -337,14 +337,14 @@ hx509_cms_unenvelope(hx509_context context,
free(str); free(str);
} }
} }
if (!matched) { if (!matched) {
ret = HX509_CMS_NO_RECIPIENT_CERTIFICATE; ret = HX509_CMS_NO_RECIPIENT_CERTIFICATE;
hx509_set_error_string(context, 0, ret, hx509_set_error_string(context, 0, ret,
"No private key matched any certificate"); "No private key matched any certificate");
goto out; goto out;
} }
if (cert == NULL) { if (cert == NULL) {
ret = HX509_CMS_NO_RECIPIENT_CERTIFICATE; ret = HX509_CMS_NO_RECIPIENT_CERTIFICATE;
hx509_set_error_string(context, HX509_ERROR_APPEND, ret, hx509_set_error_string(context, HX509_ERROR_APPEND, ret,
@@ -391,7 +391,7 @@ hx509_cms_unenvelope(hx509_context context,
goto out; goto out;
} }
ret = hx509_crypto_decrypt(crypto, ret = hx509_crypto_decrypt(crypto,
enccontent->data, enccontent->data,
enccontent->length, enccontent->length,
ivec.length ? &ivec : NULL, ivec.length ? &ivec : NULL,
@@ -458,7 +458,7 @@ hx509_cms_envelope_1(hx509_context context,
goto out; goto out;
} }
ret = hx509_crypto_encrypt(crypto, ret = hx509_crypto_encrypt(crypto,
data, data,
length, length,
&ivec, &ivec,
@@ -570,7 +570,7 @@ static int
any_to_certs(hx509_context context, const SignedData *sd, hx509_certs certs) any_to_certs(hx509_context context, const SignedData *sd, hx509_certs certs)
{ {
int ret, i; int ret, i;
if (sd->certificates == NULL) if (sd->certificates == NULL)
return 0; return 0;
@@ -628,7 +628,7 @@ hx509_cms_verify_signed(hx509_context context,
SignedData sd; SignedData sd;
size_t size; size_t size;
int ret, i, found_valid_sig; int ret, i, found_valid_sig;
*signer_certs = NULL; *signer_certs = NULL;
content->data = NULL; content->data = NULL;
content->length = 0; content->length = 0;
@@ -656,7 +656,7 @@ hx509_cms_verify_signed(hx509_context context,
if (ret) if (ret)
goto out; goto out;
ret = hx509_certs_init(context, "MEMORY:cms-signer-certs", ret = hx509_certs_init(context, "MEMORY:cms-signer-certs",
0, NULL, signer_certs); 0, NULL, signer_certs);
if (ret) if (ret)
goto out; goto out;
@@ -696,7 +696,7 @@ hx509_cms_verify_signed(hx509_context context,
if (signer_info->signedAttrs) { if (signer_info->signedAttrs) {
const Attribute *attr; const Attribute *attr;
CMSAttributes sa; CMSAttributes sa;
heim_octet_string os; heim_octet_string os;
@@ -720,8 +720,8 @@ hx509_cms_verify_signed(hx509_context context,
"messageDigest (signature)"); "messageDigest (signature)");
goto next_sigature; goto next_sigature;
} }
ret = decode_MessageDigest(attr->value.val[0].data, ret = decode_MessageDigest(attr->value.val[0].data,
attr->value.val[0].length, attr->value.val[0].length,
&os, &os,
&size); &size);
@@ -744,7 +744,7 @@ hx509_cms_verify_signed(hx509_context context,
goto next_sigature; goto next_sigature;
} }
/* /*
* Fetch content oid inside signedAttrs or set it to * Fetch content oid inside signedAttrs or set it to
* id-pkcs7-data. * id-pkcs7-data.
*/ */
@@ -759,9 +759,9 @@ hx509_cms_verify_signed(hx509_context context,
goto next_sigature; goto next_sigature;
} }
ret = decode_ContentType(attr->value.val[0].data, ret = decode_ContentType(attr->value.val[0].data,
attr->value.val[0].length, attr->value.val[0].length,
&decode_oid, &decode_oid,
&size); &size);
if (ret) { if (ret) {
hx509_set_error_string(context, 0, ret, hx509_set_error_string(context, 0, ret,
@@ -780,11 +780,11 @@ hx509_cms_verify_signed(hx509_context context,
hx509_clear_error_string(context); hx509_clear_error_string(context);
goto next_sigature; goto next_sigature;
} }
ASN1_MALLOC_ENCODE(CMSAttributes, ASN1_MALLOC_ENCODE(CMSAttributes,
signed_data->data, signed_data->data,
signed_data->length, signed_data->length,
&sa, &sa,
&size, ret); &size, ret);
if (ret) { if (ret) {
if (match_oid == &decode_oid) if (match_oid == &decode_oid)
@@ -942,7 +942,7 @@ add_one_attribute(Attribute **attr,
return 0; return 0;
} }
int int
hx509_cms_create_signed_1(hx509_context context, hx509_cms_create_signed_1(hx509_context context,
const heim_oid *eContentType, const heim_oid *eContentType,
@@ -962,7 +962,7 @@ hx509_cms_create_signed_1(hx509_context context,
int ret; int ret;
size_t size; size_t size;
hx509_path path; hx509_path path;
memset(&sd, 0, sizeof(sd)); memset(&sd, 0, sizeof(sd));
memset(&name, 0, sizeof(name)); memset(&name, 0, sizeof(name));
memset(&path, 0, sizeof(path)); memset(&path, 0, sizeof(path));
@@ -975,14 +975,14 @@ hx509_cms_create_signed_1(hx509_context context,
} }
if (digest_alg == NULL) { if (digest_alg == NULL) {
ret = hx509_crypto_select(context, HX509_SELECT_DIGEST, ret = hx509_crypto_select(context, HX509_SELECT_DIGEST,
_hx509_cert_private_key(cert), peer, &digest); _hx509_cert_private_key(cert), peer, &digest);
} else { } else {
ret = copy_AlgorithmIdentifier(digest_alg, &digest); ret = copy_AlgorithmIdentifier(digest_alg, &digest);
if (ret) if (ret)
hx509_clear_error_string(context); hx509_clear_error_string(context);
} }
if (ret) if (ret)
goto out; goto out;
sd.version = CMSVersion_v3; sd.version = CMSVersion_v3;
@@ -1019,7 +1019,7 @@ hx509_cms_create_signed_1(hx509_context context,
if (ret) { if (ret) {
hx509_clear_error_string(context); hx509_clear_error_string(context);
goto out; goto out;
} }
signer_info->signedAttrs = NULL; signer_info->signedAttrs = NULL;
signer_info->unsignedAttrs = NULL; signer_info->unsignedAttrs = NULL;
@@ -1118,14 +1118,14 @@ hx509_cms_create_signed_1(hx509_context context,
} }
if (size != os.length) if (size != os.length)
_hx509_abort("internal ASN.1 encoder error"); _hx509_abort("internal ASN.1 encoder error");
ret = _hx509_create_signature(context, ret = _hx509_create_signature(context,
_hx509_cert_private_key(cert), _hx509_cert_private_key(cert),
hx509_signature_rsa_with_sha1(), hx509_signature_rsa_with_sha1(),
&os, &os,
&signer_info->signatureAlgorithm, &signer_info->signatureAlgorithm,
&signer_info->signature); &signer_info->signature);
der_free_octet_string(&os); der_free_octet_string(&os);
if (ret) { if (ret) {
hx509_clear_error_string(context); hx509_clear_error_string(context);
@@ -1177,7 +1177,7 @@ hx509_cms_create_signed_1(hx509_context context,
} }
for (i = 0; i < path.len; i++) { for (i = 0; i < path.len; i++) {
ASN1_MALLOC_ENCODE(Certificate, ASN1_MALLOC_ENCODE(Certificate,
sd.certificates->val[i].data, sd.certificates->val[i].data,
sd.certificates->val[i].length, sd.certificates->val[i].length,
_hx509_get_cert(path.val[i]), _hx509_get_cert(path.val[i]),