From 0382c83ab0038d3424dc881e52ca0f170c074fae Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Thu, 25 Nov 2010 10:49:06 +0200 Subject: libcaccard: coding style: 80 width --- card_7816.h | 16 ++++++++++------ card_7816t.h | 22 +++++++++++----------- mutex.h | 8 +++++--- vcard.h | 4 ++-- vcard_emul.h | 11 ++++++----- 5 files changed, 34 insertions(+), 27 deletions(-) diff --git a/card_7816.h b/card_7816.h index b43cb55..35c903f 100644 --- a/card_7816.h +++ b/card_7816.h @@ -15,12 +15,14 @@ VCardResponse *vcard_response_new(VCard *card, unsigned char *buf, int len, int Le, VCard7816Status status); /* response from a return buffer and status bytes */ -VCardResponse *vcard_response_new_bytes(VCard *card, unsigned char *buf, int len, int Le, +VCardResponse *vcard_response_new_bytes(VCard *card, unsigned char *buf, + int len, int Le, unsigned char sw1, unsigned char sw2); /* response from just status bytes */ -VCardResponse *vcard_response_new_status_bytes(unsigned char sw1, unsigned char sw2); -/* response from just status: NOTE this cannot fail, it will alwyas return a valid - * response, if it can't allocate memory, the response will be +VCardResponse *vcard_response_new_status_bytes(unsigned char sw1, + unsigned char sw2); +/* response from just status: NOTE this cannot fail, it will alwyas return a + * valid response, if it can't allocate memory, the response will be * VCARD7816_STATUS_EXC_ERROR_MEMORY_FAILURE */ VCardResponse *vcard_make_response(VCard7816Status status); @@ -39,7 +41,8 @@ void vcard_response_delete(VCardResponse *response); /* * constructor for VCardAPDU */ -VCardAPDU *vcard_apdu_new(unsigned char *raw_apdu, int len, unsigned short *status); +VCardAPDU *vcard_apdu_new(unsigned char *raw_apdu, int len, + unsigned short *status); /* * destructor for VCardAPDU @@ -51,6 +54,7 @@ void vcard_apdu_delete(VCardAPDU *apdu); * APDU processing starts here. This routes the card processing stuff to the * right location. Always returns a valid response. */ -VCardStatus vcard_process_apdu(VCard *card, VCardAPDU *apdu, VCardResponse **response); +VCardStatus vcard_process_apdu(VCard *card, VCardAPDU *apdu, + VCardResponse **response); #endif diff --git a/card_7816t.h b/card_7816t.h index 7ddf525..10ed41e 100644 --- a/card_7816t.h +++ b/card_7816t.h @@ -24,13 +24,13 @@ struct VCardResponseStruct { #define VCARD_RESPONSE_NEW_STATIC_STATUS(stat) \ static const VCardResponse VCardResponse##stat = \ - {(unsigned char *)&VCardResponse##stat.b_sw1, (stat), ((stat) >> 8), ((stat) & 0xff), \ - 0, 2, VCARD_STATIC}; + {(unsigned char *)&VCardResponse##stat.b_sw1, (stat), ((stat) >> 8), \ + ((stat) & 0xff), 0, 2, VCARD_STATIC}; #define VCARD_RESPONSE_NEW_STATIC_STATUS_BYTES(sw1, sw2) \ static const VCardResponse VCARDResponse##sw1 = \ - {(unsigned char *)&VCardResponse##name.b_sw1, ((sw1) << 8 | (sw2)), (sw1), (sw2), \ - 0, 2, VCARD_STATIC}; + {(unsigned char *)&VCardResponse##name.b_sw1, ((sw1) << 8 | (sw2)), \ + (sw1), (sw2), 0, 2, VCARD_STATIC}; /* cast away the const, callers need may need to 'free' the * result, and const implies that they don't */ @@ -66,13 +66,13 @@ struct VCardAPDUHeader { */ struct VCardAPDUStruct { int a_len; /* length of the whole buffer, including header */ - int a_Lc; /* 7816 Lc (parameter length) value */ - int a_Le; /* 7816 Le (expected result length) value */ - unsigned char *a_body; /* pointer to the parameter */ - int a_channel; /* decoded channel */ - int a_secure_messaging; /* decoded secure messaging type */ - int a_type; /* decoded type from cla (top nibble of class) */ - VCardAPDUType a_gen_type; /* generic type (7816, PROPRIETARY, RFU, etc) */ + int a_Lc; /* 7816 Lc (parameter length) value */ + int a_Le; /* 7816 Le (expected result length) value */ + unsigned char *a_body; /* pointer to the parameter */ + int a_channel; /* decoded channel */ + int a_secure_messaging; /* decoded secure messaging type */ + int a_type; /* decoded type from cla (top nibble of class) */ + VCardAPDUType a_gen_type; /* generic type (7816, PROPRIETARY, RFU, etc) */ union { struct VCardAPDUHeader *header; unsigned char *data; diff --git a/mutex.h b/mutex.h index ade24b4..b28e000 100644 --- a/mutex.h +++ b/mutex.h @@ -17,8 +17,9 @@ */ /* - * This header file provides a way of mapping windows and linux thread calls to a set of macros. - * Ideally this would be shared by whatever subsystem we link with. + * This header file provides a way of mapping windows and linux thread calls + * to a set of macros. Ideally this would be shared by whatever subsystem we + * link with. */ #ifndef _H_MUTEX @@ -31,7 +32,8 @@ typedef CRITICAL_SECTION mutex_t; #define MUTEX_UNLOCK(mutex) LeaveCriticalSection(&mutex) typedef CONDITION_VARIABLE condition_t; #define CONDITION_INIT(cond) InitializeConditionVariable(&cond) -#define CONDITION_WAIT(cond,mutex) SleepConditionVariableCS(&cond,&mutex,INFINTE) +#define CONDITION_WAIT(cond,mutex) \ + SleepConditionVariableCS(&cond,&mutex,INFINTE) #define CONDITION_NOTIFY(cond) WakeConditionVariable(&cond) typedef DWORD thread_t; typedef HANDLE thread_status_t; diff --git a/vcard.h b/vcard.h index c844344..8dbd761 100644 --- a/vcard.h +++ b/vcard.h @@ -9,8 +9,8 @@ /* * response buffer constructors and destructors. * - * response buffers are used when we need to return more data than will fit in a normal APDU - * response (nominally 254 bytes). + * response buffers are used when we need to return more data than will fit in + * a normal APDU response (nominally 254 bytes). */ VCardBufferResponse *vcard_buffer_response_new(unsigned char *buffer, int size); void vcard_buffer_response_delete(VCardBufferResponse *buffer_response); diff --git a/vcard_emul.h b/vcard_emul.h index 06f8c4e..5a0053b 100644 --- a/vcard_emul.h +++ b/vcard_emul.h @@ -1,10 +1,10 @@ /* * This is the actual card emulator. * - * These functions can be implemented in different ways on different platforms using - * the underlying system primitives. For Linux it uses NSS, though direct to PKCS #11, - * openssl+pkcs11, or even gnu crypto libraries+pkcs #11 could be used. On Windows - * CAPI could be used. + * These functions can be implemented in different ways on different platforms + * using the underlying system primitives. For Linux it uses NSS, though direct + * to PKCS #11, openssl+pkcs11, or even gnu crypto libraries+pkcs #11 could be + * used. On Windows CAPI could be used. */ #ifndef VCARD_EMUL_H @@ -29,7 +29,8 @@ typedef struct VCardEmulOptionsStruct VCardEmulOptions; /* * Login functions */ -/* return the number of login attempts still possible on the card. if unknown, return -1 */ +/* return the number of login attempts still possible on the card. if unknown, + * return -1 */ int vcard_emul_get_login_count(VCard *card); /* login into the card, return the 7816 status word (sw2 || sw1) */ VCard7816Status vcard_emul_login(VCard *card, unsigned char *pin, int pin_len); -- cgit v1.2.3