some indent fixes from Martin Paljak plus some additional changes from me

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2083 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
nils 2005-01-19 18:15:43 +00:00
parent 8a0fc5bdcf
commit cb5d576267
9 changed files with 203 additions and 204 deletions

View File

@ -835,7 +835,7 @@ static CK_RV pkcs15_change_pin(struct sc_pkcs11_card *p11card,
rc = sc_pkcs15_change_pin(fw_data->p15_card, pin, pOldPin, ulOldLen,
pNewPin, ulNewLen);
sc_debug(context, "PIN verification returned %d\n", rc);
sc_debug(context, "PIN change returned %d\n", rc);
if (rc >= 0)
cache_pin(fw_token, CKU_USER, &pin->path, pNewPin, ulNewLen);
@ -1555,7 +1555,7 @@ static CK_RV pkcs15_cert_get_attribute(struct sc_pkcs11_session *session,
break;
case CKA_TRUSTED:
check_attribute_buffer(attr, sizeof(CK_BBOOL));
*(CK_BBOOL*)attr->pValue = cert->cert_info->authority?TRUE:FALSE;
*(CK_BBOOL*)attr->pValue = cert->cert_info->authority ? TRUE : FALSE;
break;
case CKA_VALUE:
check_attribute_buffer(attr, cert->cert_data->data_len);
@ -1617,7 +1617,6 @@ pkcs15_cert_cmp_attribute(struct sc_pkcs11_session *session,
default:
return sc_pkcs11_any_cmp_attribute(session, object, attr);
}
return 0;
}

View File

@ -24,9 +24,9 @@
#define DUMP_TEMPLATE_MAX 32
void strcpy_bp(u8 *dst, const char *src, int dstsize)
void strcpy_bp(u8 *dst, const char *src, size_t dstsize)
{
int c;
size_t c;
if (!dst || !src || !dstsize)
return;

View File

@ -70,7 +70,7 @@ void print_generic(FILE *f, CK_LONG type, CK_VOID_PTR value, CK_ULONG size, CK_V
}
#ifdef HAVE_OPENSSL
void print_dn(FILE *f, CK_LONG type, CK_VOID_PTR value, CK_ULONG size, CK_VOID_PTR arg)
static void print_dn(FILE *f, CK_LONG type, CK_VOID_PTR value, CK_ULONG size, CK_VOID_PTR arg)
{
print_generic(f, type, value, size, arg);
if(size && value) {

View File

@ -63,7 +63,8 @@ CK_RV C_Initialize(CK_VOID_PTR pReserved)
context = NULL;
}
out: if (context != NULL)
out:
if (context != NULL)
sc_debug(context, "C_Initialize: result = %d\n", rv);
return rv;
}
@ -120,7 +121,7 @@ CK_RV C_GetInfo(CK_INFO_PTR pInfo)
"SmartCard PKCS#11 API",
sizeof(pInfo->libraryDescription));
pInfo->libraryVersion.major = 0;
pInfo->libraryVersion.minor = 8;
pInfo->libraryVersion.minor = 9;
out: sc_pkcs11_unlock();
return rv;

View File

@ -92,10 +92,11 @@ CK_RV C_GetAttributeValue(CK_SESSION_HANDLE hSession, /* the session's handle
-1
};
char object_name[64];
int i, j, rv;
int j, rv;
struct sc_pkcs11_session *session;
struct sc_pkcs11_object *object;
int res, res_type;
unsigned int i;
rv = sc_pkcs11_lock();
if (rv != CKR_OK)
@ -150,7 +151,8 @@ CK_RV C_SetAttributeValue(CK_SESSION_HANDLE hSession, /* the session's handle
CK_ATTRIBUTE_PTR pTemplate, /* specifies attributes and values */
CK_ULONG ulCount) /* attributes in template */
{
int i, rv;
int rv;
unsigned int i;
struct sc_pkcs11_session *session;
struct sc_pkcs11_object *object;
@ -189,7 +191,8 @@ CK_RV C_FindObjectsInit(CK_SESSION_HANDLE hSession, /* the session's handle */
CK_BBOOL is_private = TRUE;
CK_ATTRIBUTE private_attribute = { CKA_PRIVATE, &is_private, sizeof(is_private) };
int j, rv, match, hide_private;
int rv, match, hide_private;
unsigned int j;
struct sc_pkcs11_session *session;
struct sc_pkcs11_object *object;
struct sc_pkcs11_find_operation *operation;
@ -285,7 +288,8 @@ CK_RV C_FindObjects(CK_SESSION_HANDLE hSession, /* the session's han
CK_ULONG ulMaxObjectCount, /* max handles to be returned */
CK_ULONG_PTR pulObjectCount) /* actual number returned */
{
int rv, to_return;
int rv;
CK_ULONG to_return;
struct sc_pkcs11_session *session;
struct sc_pkcs11_find_operation *operation;
@ -302,7 +306,7 @@ CK_RV C_FindObjects(CK_SESSION_HANDLE hSession, /* the session's han
if (rv != CKR_OK)
goto out;
to_return = operation->num_handles - operation->current_handle;
to_return = (CK_ULONG)operation->num_handles - operation->current_handle;
if (to_return > ulMaxObjectCount)
to_return = ulMaxObjectCount;

View File

@ -82,7 +82,7 @@ out: sc_pkcs11_unlock();
/* Internal version of C_CloseSession that gets called with
* the global lock held */
CK_RV sc_pkcs11_close_session(CK_SESSION_HANDLE hSession)
static CK_RV sc_pkcs11_close_session(CK_SESSION_HANDLE hSession)
{
struct sc_pkcs11_slot *slot;
struct sc_pkcs11_session *session;
@ -250,8 +250,7 @@ CK_RV C_Login(CK_SESSION_HANDLE hSession, /* the session's handle */
goto out;
}
rv = slot->card->framework->login(slot->card,
slot->fw_data,
rv = slot->card->framework->login(slot->card, slot->fw_data,
userType, pPin, ulPinLen);
if (rv == CKR_OK)
slot->login_user = userType;

View File

@ -117,8 +117,8 @@ void enter(char *function)
CK_RV retne(CK_RV rv)
{
fprintf(spy_output, "Returned: %ld %s\n", rv,
lookup_enum ( RV_T, rv ));
fprintf(spy_output, "Returned: %ld %s\n", rv, lookup_enum ( RV_T, rv ));
fflush(spy_output);
return rv;
}

View File

@ -325,7 +325,7 @@ extern unsigned int first_free_slot;
extern struct sc_pkcs11_framework_ops framework_pkcs15;
extern struct sc_pkcs11_framework_ops framework_pkcs15init;
void strcpy_bp(u8 *dst, const char *src, int dstsize);
void strcpy_bp(u8 *dst, const char *src, size_t dstsize);
CK_RV sc_to_cryptoki_error(int rc, int reader);
void sc_pkcs11_print_attrs(const char *file, unsigned int line, const char *function,
const char *info, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount);

View File

@ -228,7 +228,6 @@ CK_RV slot_allocate(struct sc_pkcs11_slot **slot, struct sc_pkcs11_card *card)
for (i = first; i < last; i++) {
if (!virtual_slots[i].card) {
sc_debug(context, "Allocated slot %d\n", i);
virtual_slots[i].card = card;
virtual_slots[i].events = SC_EVENT_CARD_INSERTED;
*slot = &virtual_slots[i];
@ -237,7 +236,6 @@ CK_RV slot_allocate(struct sc_pkcs11_slot **slot, struct sc_pkcs11_card *card)
}
}
return CKR_FUNCTION_FAILED;
}
CK_RV slot_get_slot(int id, struct sc_pkcs11_slot **slot)
@ -266,7 +264,6 @@ CK_RV slot_get_token(int id, struct sc_pkcs11_slot **slot)
if (rv != CKR_OK)
return CKR_TOKEN_NOT_PRESENT;
}
return CKR_OK;
}
@ -317,7 +314,6 @@ CK_RV slot_token_removed(int id)
slot->events = SC_EVENT_CARD_REMOVED;
return CKR_OK;
}
CK_RV slot_find_changed(CK_SLOT_ID_PTR idp, int mask)