diff options
Diffstat (limited to 'pkcs11.c')
-rw-r--r-- | pkcs11.c | 72 |
1 files changed, 36 insertions, 36 deletions
@@ -1,4 +1,4 @@ -/* +/* * pkcs11.c * -------- * @@ -7,37 +7,37 @@ * * Author: Rob Austein * Copyright (c) 2015, SUNET - * - * 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. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * + * 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. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT OWNER 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 + * 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 <stdio.h> #include <string.h> #include <stdlib.h> -#include <stdarg.h> +#include <stdarg.h> #include <assert.h> #include <hal.h> @@ -386,7 +386,7 @@ static CK_RV posix_mutex_create(CK_VOID_PTR_PTR ppMutex) default: lose(CKR_GENERAL_ERROR); - } + } fail: if (m != NULL) @@ -683,7 +683,7 @@ static int p11_attribute_get(const CK_OBJECT_HANDLE object_handle, if (value != NULL && maxlength < len) goto fail; - + if (value != NULL) memcpy(value, sqlite3_column_blob(q, 0), len); @@ -1108,7 +1108,7 @@ static CK_OBJECT_HANDLE p11_object_create(const p11_session_t *session, /* * Finally, add generation mechanism attributes as needed. */ - + if (mechanism != NULL && (!sql_check_ok(sqlite3_reset(q)) || !sql_check_ok(sqlite3_bind_int64(q, 2, CKA_LOCAL)) || @@ -1612,7 +1612,7 @@ static CK_RV p11_check_keypair_attributes_check_template_2(const p11_session_t * * public and private keys in a keypair), so we need to do a fair * amount of checking. We automate as much of the dumb stuff as * possible through the object descriptor. - * + * * Key usage handling here is based on RFC 5280 4.2.1.3. * * PKCS #11 suggests but does not require CKA_ID values for public and @@ -1689,7 +1689,7 @@ static CK_RV p11_check_keypair_attributes(const p11_session_t *session, ulPublicKeyAttributeCount)) != CKR_OK || (rv = p11_check_keypair_attributes_check_template_2(session, private_descriptor, - pPrivateKeyTemplate, + pPrivateKeyTemplate, ulPrivateKeyAttributeCount)) != CKR_OK) goto fail; @@ -1746,7 +1746,7 @@ static CK_RV generate_keypair_rsa_pkcs(p11_session_t *session, return rv; assert(session != NULL && pMechanism != NULL && - pPublicKeyTemplate != NULL && phPublicKey != NULL && + pPublicKeyTemplate != NULL && phPublicKey != NULL && pPrivateKeyTemplate != NULL && phPrivateKey != NULL); /* @@ -2369,7 +2369,7 @@ CK_RV C_OpenSession(CK_SLOT_ID slotID, lose(CKR_SESSION_READ_WRITE_SO_EXISTS); session->state = CKS_RW_SO_FUNCTIONS; break; - } + } session->notify = Notify; session->application = pApplication; @@ -2453,7 +2453,7 @@ CK_RV C_Login(CK_SESSION_HANDLE hSession, */ if (logged_in_as != not_logged_in) - lose(CKR_USER_ALREADY_LOGGED_IN); + lose(CKR_USER_ALREADY_LOGGED_IN); /* * Figure out which PIN we're checking. @@ -2884,7 +2884,7 @@ CK_RV C_FindObjectsInit(CK_SESSION_HANDLE hSession, */ if (!sql_check_ok(sql_prepare(&session->find_query, select_format, hSession))) - lose(CKR_FUNCTION_FAILED); + lose(CKR_FUNCTION_FAILED); session->find_query_done = 0; fail: @@ -2958,7 +2958,7 @@ CK_RV C_FindObjectsFinal(CK_SESSION_HANDLE hSession) p11_session_t *session; sqlite3_stmt *q = NULL; CK_RV rv = CKR_OK; - + mutex_lock_or_return_failure(p11_global_mutex); if ((session = p11_session_find(hSession)) == NULL) @@ -3422,7 +3422,7 @@ CK_RV C_GetMechanismInfo(CK_SLOT_ID slotID, return CKR_SLOT_ID_INVALID; switch (type) { - + case CKM_RSA_PKCS_KEY_PAIR_GEN: pInfo->ulMinKeySize = 1024; pInfo->ulMaxKeySize = 8192; |