summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/hx509/ks_p12.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/heimdal/lib/hx509/ks_p12.c')
-rw-r--r--source4/heimdal/lib/hx509/ks_p12.c92
1 files changed, 46 insertions, 46 deletions
diff --git a/source4/heimdal/lib/hx509/ks_p12.c b/source4/heimdal/lib/hx509/ks_p12.c
index 53590c768c..b59bd215f0 100644
--- a/source4/heimdal/lib/hx509/ks_p12.c
+++ b/source4/heimdal/lib/hx509/ks_p12.c
@@ -1,34 +1,34 @@
/*
- * Copyright (c) 2004 - 2007 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
+ * Copyright (c) 2004 - 2007 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
*
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * 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
- * without specific prior written permission.
+ * 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
+ * without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * 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
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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
+ * SUCH DAMAGE.
*/
#include "hx_locl.h"
@@ -50,7 +50,7 @@ struct type {
};
static void
-parse_pkcs12_type(hx509_context, struct hx509_collector *, const heim_oid *,
+parse_pkcs12_type(hx509_context, struct hx509_collector *, const heim_oid *,
const void *, size_t, const PKCS12_Attributes *);
@@ -68,7 +68,7 @@ find_attribute(const PKCS12_Attributes *attrs, const heim_oid *oid)
static int
keyBag_parser(hx509_context context,
- struct hx509_collector *c,
+ struct hx509_collector *c,
const void *data, size_t length,
const PKCS12_Attributes *attrs)
{
@@ -84,7 +84,7 @@ keyBag_parser(hx509_context context,
ret = decode_PKCS8PrivateKeyInfo(data, length, &ki, NULL);
if (ret)
return ret;
-
+
_hx509_collector_private_key_add(context,
c,
&ki.privateKeyAlgorithm,
@@ -97,16 +97,16 @@ keyBag_parser(hx509_context context,
static int
ShroudedKeyBag_parser(hx509_context context,
- struct hx509_collector *c,
+ struct hx509_collector *c,
const void *data, size_t length,
const PKCS12_Attributes *attrs)
{
PKCS8EncryptedPrivateKeyInfo pk;
heim_octet_string content;
int ret;
-
+
memset(&pk, 0, sizeof(pk));
-
+
ret = decode_PKCS8EncryptedPrivateKeyInfo(data, length, &pk, NULL);
if (ret)
return ret;
@@ -127,7 +127,7 @@ ShroudedKeyBag_parser(hx509_context context,
static int
certBag_parser(hx509_context context,
- struct hx509_collector *c,
+ struct hx509_collector *c,
const void *data, size_t length,
const PKCS12_Attributes *attrs)
{
@@ -145,7 +145,7 @@ certBag_parser(hx509_context context,
return 0;
}
- ret = decode_PKCS12_OctetString(cb.certValue.data,
+ ret = decode_PKCS12_OctetString(cb.certValue.data,
cb.certValue.length,
&os,
NULL);
@@ -187,7 +187,7 @@ certBag_parser(hx509_context context,
static int
parse_safe_content(hx509_context context,
- struct hx509_collector *c,
+ struct hx509_collector *c,
const unsigned char *p, size_t len)
{
PKCS12_SafeContents sc;
@@ -213,7 +213,7 @@ parse_safe_content(hx509_context context,
static int
safeContent_parser(hx509_context context,
- struct hx509_collector *c,
+ struct hx509_collector *c,
const void *data, size_t length,
const PKCS12_Attributes *attrs)
{
@@ -280,7 +280,7 @@ envelopedData_parser(hx509_context context,
&contentType,
&content);
if (ret) {
- hx509_set_error_string(context, HX509_ERROR_APPEND, ret,
+ hx509_set_error_string(context, HX509_ERROR_APPEND, ret,
"PKCS12 failed to unenvelope");
return ret;
}
@@ -307,7 +307,7 @@ struct type bagtypes[] = {
static void
parse_pkcs12_type(hx509_context context,
struct hx509_collector *c,
- const heim_oid *oid,
+ const heim_oid *oid,
const void *data, size_t length,
const PKCS12_Attributes *attrs)
{
@@ -320,7 +320,7 @@ parse_pkcs12_type(hx509_context context,
static int
p12_init(hx509_context context,
- hx509_certs certs, void **data, int flags,
+ hx509_certs certs, void **data, int flags,
const char *residue, hx509_lock lock)
{
struct ks_pkcs12 *p12;
@@ -404,7 +404,7 @@ p12_init(hx509_context context,
hx509_clear_error_string(context);
goto out;
}
- ret = decode_PKCS12_AuthenticatedSafe(asdata.data,
+ ret = decode_PKCS12_AuthenticatedSafe(asdata.data,
asdata.length,
&as,
NULL);
@@ -465,7 +465,7 @@ addBag(hx509_context context,
hx509_set_error_string(context, 0, ret, "out of memory");
return ret;
}
-
+
as->val[as->len].content = calloc(1, sizeof(*as->val[0].content));
if (as->val[as->len].content == NULL) {
der_free_oid(&as->val[as->len].contentType);
@@ -528,7 +528,7 @@ store_func(hx509_context context, void *ctx, hx509_cert c)
ret = der_parse_hex_heim_integer("00", &pki.version);
if (ret)
return ret;
- ret = _hx509_private_key_oid(context, key,
+ ret = _hx509_private_key_oid(context, key,
&pki.privateKeyAlgorithm.algorithm);
if (ret) {
free_PKCS8PrivateKeyInfo(&pki);
@@ -559,7 +559,7 @@ out:
}
static int
-p12_store(hx509_context context,
+p12_store(hx509_context context,
hx509_certs certs, void *data, int flags, hx509_lock lock)
{
struct ks_pkcs12 *p12 = data;
@@ -581,7 +581,7 @@ p12_store(hx509_context context,
free_PKCS12_AuthenticatedSafe(&as);
if (ret)
return ret;
-
+
ret = der_parse_hex_heim_integer("03", &pfx.version);
if (ret) {
free(asdata.data);
@@ -590,7 +590,7 @@ p12_store(hx509_context context,
pfx.authSafe.content = calloc(1, sizeof(*pfx.authSafe.content));
- ASN1_MALLOC_ENCODE(PKCS12_OctetString,
+ ASN1_MALLOC_ENCODE(PKCS12_OctetString,
pfx.authSafe.content->data,
pfx.authSafe.content->length,
&asdata, &size, ret);
@@ -647,14 +647,14 @@ p12_free(hx509_certs certs, void *data)
return 0;
}
-static int
+static int
p12_add(hx509_context context, hx509_certs certs, void *data, hx509_cert c)
{
struct ks_pkcs12 *p12 = data;
return hx509_certs_add(context, p12->certs, c);
}
-static int
+static int
p12_iter_start(hx509_context context,
hx509_certs certs,
void *data,