Skip to content
Browse files

remove trailing whitespaces

inspired by
http://www.opensc-project.org/pipermail/opensc-devel/2012-March/017883.html

Change-Id: If170e830d8d9587a31742feffb6fff54cfdf75b4
  • Loading branch information...
1 parent e57d443 commit cb13633634a481560a26278a6284d11d1c21d00e @viktorTarasov viktorTarasov committed Apr 3, 2012
View
6 src/common/compat_getopt.c
@@ -9,10 +9,10 @@
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -193,7 +193,7 @@ int _my_getopt_internal(int argc, char * argv[], const char *shortopts,
if(((my_optopt = argv[my_optind][1]) != '-') && ! argv[my_optind][2]) {
int c;
-
+
ind = shortoff;
while((c = shortopts[ind++])) {
if(((shortopts[ind] == ':') ||
View
4 src/common/compat_getopt.h
@@ -9,10 +9,10 @@
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
View
6 src/common/compat_getopt_main.c
@@ -160,7 +160,7 @@ main(int argc, char * argv[])
/* long option list index */
int longind = 0;
- /*
+ /*
* print a warning when the POSIXLY_CORRECT environment variable will
* interfere with argument placement
*/
@@ -323,12 +323,12 @@ main(int argc, char * argv[])
if (optind < argc)
{
int argindex;
-
+
for (argindex = optind; argindex < argc; argindex ++)
{
const char *infilename = argv[argindex];
FILE *infile;
-
+
/* we allow "-" as a synonym for stdin here */
if (! strcmp(infilename, "-"))
{
View
60 src/common/simclist.c
@@ -157,11 +157,11 @@ static int list_attrOk(const list_t *restrict l);
#endif
/* do not inline, this is recursive */
-static void list_sort_quicksort(list_t *restrict l, int versus,
+static void list_sort_quicksort(list_t *restrict l, int versus,
unsigned int first, struct list_entry_s *fel,
unsigned int last, struct list_entry_s *lel);
-static inline void list_sort_selectionsort(list_t *restrict l, int versus,
+static inline void list_sort_selectionsort(list_t *restrict l, int versus,
unsigned int first, struct list_entry_s *fel,
unsigned int last, struct list_entry_s *lel);
@@ -185,8 +185,8 @@ static inline struct list_entry_s *list_findpos(const list_t *restrict l, int po
/*
* Random Number Generator
- *
- * The user is expected to seed the RNG (ie call srand()) if
+ *
+ * The user is expected to seed the RNG (ie call srand()) if
* SIMCLIST_SYSTEM_RNG is defined.
*
* Otherwise, a self-contained RNG based on LCG is used; see
@@ -290,7 +290,7 @@ int list_attributes_setdefaults(list_t *restrict l) {
l->attrs.unserializer = NULL;
assert(list_attrOk(l));
-
+
return 0;
}
@@ -301,7 +301,7 @@ int list_attributes_comparator(list_t *restrict l, element_comparator comparator
l->attrs.comparator = comparator_fun;
assert(list_attrOk(l));
-
+
return 0;
}
@@ -385,7 +385,7 @@ static void *list_get_minmax(const list_t *restrict l, int versus) {
if (l->attrs.comparator == NULL || l->numels == 0)
return NULL;
-
+
curminmax = l->head_sentinel->next->data;
for (s = l->head_sentinel->next->next; s != l->tail_sentinel; s = s->next) {
if (l->attrs.comparator(curminmax, s->data) * versus > 0)
@@ -425,7 +425,7 @@ static inline struct list_entry_s *list_findpos(const list_t *restrict l, int po
void *list_extract_at(list_t *restrict l, unsigned int pos) {
struct list_entry_s *tmp;
void *data;
-
+
if (l->iter_active || pos >= l->numels) return NULL;
tmp = list_findpos(l, pos);
@@ -434,17 +434,17 @@ void *list_extract_at(list_t *restrict l, unsigned int pos) {
tmp->data = NULL; /* save data from list_drop_elem() free() */
list_drop_elem(l, tmp, pos);
l->numels--;
-
+
assert(list_repOk(l));
return data;
}
int list_insert_at(list_t *restrict l, const void *data, unsigned int pos) {
struct list_entry_s *lent, *succ, *prec;
-
+
if (l->iter_active || pos > l->numels) return -1;
-
+
/* this code optimizes malloc() with a free-list */
if (l->spareelsnum > 0) {
lent = l->spareels[l->spareelsnum-1];
@@ -467,7 +467,7 @@ int list_insert_at(list_t *restrict l, const void *data, unsigned int pos) {
/* actually append element */
prec = list_findpos(l, pos-1);
succ = prec->next;
-
+
prec->next = lent;
lent->prev = prec;
lent->next = succ;
@@ -589,7 +589,7 @@ int list_clear(list_t *restrict l) {
struct list_entry_s *s;
if (l->iter_active) return -1;
-
+
if (l->attrs.copy_data) { /* also free user data */
/* spare a loop conditional with two loops: spareing elems and freeing elems */
for (s = l->head_sentinel->next; l->spareelsnum < SIMCLIST_MAX_SPARE_ELEMS && s != l->tail_sentinel; s = s->next) {
@@ -638,7 +638,7 @@ int list_empty(const list_t *restrict l) {
int list_locate(const list_t *restrict l, const void *data) {
struct list_entry_s *el;
int pos = 0;
-
+
if (l->attrs.comparator != NULL) {
/* use comparator */
for (el = l->head_sentinel->next; el != l->tail_sentinel; el = el->next, pos++) {
@@ -708,7 +708,7 @@ int list_concat(const list_t *l1, const list_t *l2, list_t *restrict dest) {
}
el->next = dest->tail_sentinel;
dest->tail_sentinel->prev = el;
-
+
/* fix mid pointer */
err = l2->numels - l1->numels;
if ((err+1)/2 > 0) { /* correct pos RIGHT (err-1)/2 moves */
@@ -718,7 +718,7 @@ int list_concat(const list_t *l1, const list_t *l2, list_t *restrict dest) {
err = -err/2;
for (cnt = 0; cnt < (unsigned int)err; cnt++) dest->mid = dest->mid->prev;
}
-
+
assert(!(list_repOk(l1) && list_repOk(l2)) || list_repOk(dest));
return 0;
@@ -752,15 +752,15 @@ static void *list_sort_quicksort_threadwrapper(void *wrapped_params) {
}
#endif
-static inline void list_sort_selectionsort(list_t *restrict l, int versus,
+static inline void list_sort_selectionsort(list_t *restrict l, int versus,
unsigned int first, struct list_entry_s *fel,
unsigned int last, struct list_entry_s *lel) {
struct list_entry_s *cursor, *toswap, *firstunsorted;
void *tmpdata;
if (last <= first) /* <= 1-element lists are always sorted */
return;
-
+
for (firstunsorted = fel; firstunsorted != lel; firstunsorted = firstunsorted->next) {
/* find min or max in the remainder of the list */
for (toswap = firstunsorted, cursor = firstunsorted->next; cursor != lel->next; cursor = cursor->next)
@@ -773,7 +773,7 @@ static inline void list_sort_selectionsort(list_t *restrict l, int versus,
}
}
-static void list_sort_quicksort(list_t *restrict l, int versus,
+static void list_sort_quicksort(list_t *restrict l, int versus,
unsigned int first, struct list_entry_s *fel,
unsigned int last, struct list_entry_s *lel) {
unsigned int pivotid;
@@ -789,12 +789,12 @@ static void list_sort_quicksort(list_t *restrict l, int versus,
if (last <= first) /* <= 1-element lists are always sorted */
return;
-
+
if (last - first+1 <= SIMCLIST_MINQUICKSORTELS) {
list_sort_selectionsort(l, versus, first, fel, last, lel);
return;
}
-
+
/* base of iteration: one element list */
if (! (last > first)) return;
@@ -931,7 +931,7 @@ int list_iterator_stop(list_t *restrict l) {
int list_hash(const list_t *restrict l, list_hash_t *restrict hash) {
struct list_entry_s *x;
list_hash_t tmphash;
-
+
assert(hash != NULL);
tmphash = l->numels * 2 + 100;
@@ -1064,13 +1064,13 @@ int list_dump_filedescriptor(const list_t *restrict l, int fd, size_t *restrict
/**** DUMP FORMAT ****
[ ver timestamp | totlen numels elemlen hash | DATA ]
-
+
where DATA can be:
@ for constant-size list (element size is constant; elemlen > 0)
[ elem elem ... elem ]
@ for other lists (element size dictated by element_meter each time; elemlen <= 0)
[ size elem size elem ... size elem ]
-
+
all integers are encoded in NETWORK BYTE FORMAT
*****/
@@ -1112,7 +1112,7 @@ int list_dump_filedescriptor(const list_t *restrict l, int fd, size_t *restrict
/* write CONTENT */
if (l->numels > 0) {
/* SPECULATE that the list has constant element size */
-
+
if (l->attrs.serializer != NULL) { /* user user-specified serializer */
/* get preliminary length of serialized element in header.elemlen */
ser_buf = l->attrs.serializer(l->head_sentinel->next->data, & header.elemlen);
@@ -1205,7 +1205,7 @@ int list_restore_filedescriptor(list_t *restrict l, int fd, size_t *restrict len
memset(& header, 0, sizeof(header));
/* read header */
-
+
/* version */
READ_ERRCHECK(fd, &header.ver, sizeof(header.ver));
header.ver = ntohs(header.ver);
@@ -1241,7 +1241,7 @@ int list_restore_filedescriptor(list_t *restrict l, int fd, size_t *restrict len
/* read content */
totreadlen = totmemorylen = 0;
- if (header.elemlen > 0) {
+ if (header.elemlen > 0) {
/* elements have constant size = header.elemlen */
if (l->attrs.unserializer != NULL) {
/* use unserializer */
@@ -1359,7 +1359,7 @@ static int list_drop_elem(list_t *restrict l, struct list_entry_s *tmp, unsigned
} else { /* now even */
if (pos < l->numels/2) l->mid = l->mid->next;
}
-
+
tmp->prev->next = tmp->next;
tmp->next->prev = tmp->prev;
@@ -1377,7 +1377,7 @@ static int list_drop_elem(list_t *restrict l, struct list_entry_s *tmp, unsigned
}
/* ready-made comparators and meters */
-#define SIMCLIST_NUMBER_COMPARATOR(type) int list_comparator_##type(const void *a, const void *b) { return( *(type *)a < *(type *)b) - (*(type *)a > *(type *)b); }
+#define SIMCLIST_NUMBER_COMPARATOR(type) int list_comparator_##type(const void *a, const void *b) { return( *(type *)a < *(type *)b) - (*(type *)a > *(type *)b); }
SIMCLIST_NUMBER_COMPARATOR(int8_t)
SIMCLIST_NUMBER_COMPARATOR(int16_t)
@@ -1458,7 +1458,7 @@ static int list_repOk(const list_t *restrict l) {
/* spare elements checks */
l->spareelsnum <= SIMCLIST_MAX_SPARE_ELEMS
);
-
+
if (!ok) return 0;
if (l->numels >= 1) {
View
12 src/common/simclist.h
@@ -398,7 +398,7 @@ void *list_get_at(const list_t *restrict l, unsigned int pos);
* @warning Requires a comparator function to be set for the list.
*
* Returns the maximum element with respect to the comparator function output.
- *
+ *
* @see list_attributes_comparator()
*
* @param l list to operate
@@ -501,7 +501,7 @@ unsigned int list_size(const list_t *restrict l);
*
* @param l list to operate
* @return 0 iff the list is not empty
- *
+ *
* @see list_size()
*/
int list_empty(const list_t *restrict l);
@@ -519,7 +519,7 @@ int list_empty(const list_t *restrict l);
* @param l list to operate
* @param data reference of the element to search for
* @return position of element in the list, or <0 if not found
- *
+ *
* @see list_attributes_comparator()
* @see list_get_at()
*/
@@ -552,7 +552,7 @@ void *list_seek(list_t *restrict l, const void *indicator);
* function has been set previously, with list_attributes_comparator();
* in which case, the given data reference is believed to be in list iff
* comparator_fun(elementdata, userdata) == 0 for any element in the list.
- *
+ *
* @param l list to operate
* @param data reference to the data to search
* @return 0 iff the list does not contain data as an element
@@ -604,7 +604,7 @@ int list_sort(list_t *restrict l, int versus);
*
* @param l list to operate
* @return 0 if the list cannot be currently iterated. >0 otherwise
- *
+ *
* @see list_iterator_stop()
*/
int list_iterator_start(list_t *restrict l);
@@ -731,7 +731,7 @@ int list_dump_filedescriptor(const list_t *restrict l, int fd, size_t *restrict
* @see list_dump_filedescriptor()
* @see list_restore_file()
*
- * This function stores a representation of the list
+ * This function stores a representation of the list
*/
int list_dump_file(const list_t *restrict l, const char *restrict filename, size_t *restrict len);
View
162 src/pkcs11/framework-pkcs15.c
@@ -242,17 +242,17 @@ static void pkcs15_init_token_info(struct sc_pkcs15_card *p15card, CK_TOKEN_INFO
#ifdef USE_PKCS15_INIT
static char *
-set_cka_label(CK_ATTRIBUTE_PTR attr, char *label)
-{
- char *l = (char *)attr->pValue;
- int len = attr->ulValueLen;
-
- if (len >= SC_PKCS15_MAX_LABEL_SIZE)
- len = SC_PKCS15_MAX_LABEL_SIZE-1;
- memcpy(label, l, len);
- label[len] = '\0';
- return label;
-}
+set_cka_label(CK_ATTRIBUTE_PTR attr, char *label)
+{
+ char *l = (char *)attr->pValue;
+ int len = attr->ulValueLen;
+
+ if (len >= SC_PKCS15_MAX_LABEL_SIZE)
+ len = SC_PKCS15_MAX_LABEL_SIZE-1;
+ memcpy(label, l, len);
+ label[len] = '\0';
+ return label;
+}
#endif
static int
@@ -286,7 +286,7 @@ __pkcs15_release_object(struct pkcs15_any_object *obj)
{
if (--(obj->refcount) != 0)
return obj->refcount;
-
+
sc_mem_clear(obj, obj->size);
free(obj);
@@ -377,7 +377,7 @@ CK_RV C_GetTokenInfo(CK_SLOT_ID slotID, CK_TOKEN_INFO_PTR pInfo)
static int public_key_created(struct pkcs15_fw_data *fw_data,
const unsigned int num_objects,
- const u8 *id,
+ const u8 *id,
const size_t size_id,
struct pkcs15_any_object **obj2)
{
@@ -389,27 +389,27 @@ static int public_key_created(struct pkcs15_fw_data *fw_data,
ii++;
continue;
}
- if ((fw_data->objects[ii]->p15_object->type != SC_PKCS15_TYPE_PUBKEY) &&
+ if ((fw_data->objects[ii]->p15_object->type != SC_PKCS15_TYPE_PUBKEY) &&
(fw_data->objects[ii]->p15_object->type != SC_PKCS15_TYPE_PUBKEY_RSA) &&
(fw_data->objects[ii]->p15_object->type != SC_PKCS15_TYPE_PUBKEY_DSA) &&
(fw_data->objects[ii]->p15_object->type != SC_PKCS15_TYPE_PUBKEY_EC) &&
(fw_data->objects[ii]->p15_object->type != SC_PKCS15_TYPE_PUBKEY_GOSTR3410)) {
ii++;
continue;
}
- /* XXX this is somewhat dirty as this assumes that the first
+ /* XXX this is somewhat dirty as this assumes that the first
* member of the is the pkcs15 id */
if (memcmp(fw_data->objects[ii]->p15_object->data, id, size_id) == 0) {
*obj2 = (struct pkcs15_any_object *) fw_data->objects[ii];
found=1;
} else
ii++;
}
-
+
if (found)
return SC_SUCCESS;
- else
- return SC_ERROR_OBJECT_NOT_FOUND;
+ else
+ return SC_ERROR_OBJECT_NOT_FOUND;
}
static int
@@ -442,14 +442,14 @@ __pkcs15_create_cert_object(struct pkcs15_fw_data *fw_data,
/* Corresponding public key */
rv = public_key_created(fw_data, fw_data->num_objects, p15_info->id.value, p15_info->id.len, (struct pkcs15_any_object **) &obj2);
-
+
if (rv != SC_SUCCESS)
rv = __pkcs15_create_object(fw_data, (struct pkcs15_any_object **) &obj2,
NULL, &pkcs15_pubkey_ops,
sizeof(struct pkcs15_pubkey_object));
if (rv < 0)
- return rv;
-
+ return rv;
+
if (p15_cert) {
/* we take the pubkey from the cert, as it in not needed */
obj2->pub_data = p15_cert->key;
@@ -458,7 +458,7 @@ __pkcs15_create_cert_object(struct pkcs15_fw_data *fw_data,
* sc_pkcs15_pubkey_dup would have been nice here) -- Nils
*/
p15_cert->key = NULL;
-
+
} else
obj2->pub_data = NULL; /* will copy from cert when cert is read */
@@ -480,13 +480,13 @@ __pkcs15_create_pubkey_object(struct pkcs15_fw_data *fw_data,
int rv;
/* Read public key from card */
- /* Attempt to read pubkey from card or file.
+ /* Attempt to read pubkey from card or file.
* During initialization process, the key may have been created
- * and saved as a file before the certificate has been created.
- */
+ * and saved as a file before the certificate has been created.
+ */
if (pubkey->flags & SC_PKCS15_CO_FLAG_PRIVATE) /* is the key private? */
p15_key = NULL; /* will read key when needed */
- else {
+ else {
/* if emulation already created pubkey use it */
if (pubkey->emulated && (fw_data->p15_card->flags & SC_PKCS15_CARD_FLAG_EMULATED)) {
p15_key = (struct sc_pkcs15_pubkey *) pubkey->emulated;
@@ -505,9 +505,9 @@ __pkcs15_create_pubkey_object(struct pkcs15_fw_data *fw_data,
if (rv >= 0) {
object->pub_info = (struct sc_pkcs15_pubkey_info *) pubkey->data;
object->pub_data = p15_key;
- if (p15_key && object->pub_info->modulus_length == 0
+ if (p15_key && object->pub_info->modulus_length == 0
&& p15_key->algorithm == SC_ALGORITHM_RSA) {
- object->pub_info->modulus_length =
+ object->pub_info->modulus_length =
8 * p15_key->u.rsa.modulus.len;
}
}
@@ -551,10 +551,10 @@ __pkcs15_create_data_object(struct pkcs15_fw_data *fw_data,
dobj->info = (struct sc_pkcs15_data_info *) object->data;
dobj->value = NULL;
}
-
+
if (data_object != NULL)
*data_object = (struct pkcs15_any_object *) dobj;
-
+
return 0;
}
@@ -612,7 +612,7 @@ __pkcs15_prkey_bind_related(struct pkcs15_fw_data *fw_data, struct pkcs15_prkey_
} else
if (is_pubkey(obj) && !pk->prv_pubkey) {
struct pkcs15_pubkey_object *pubkey;
-
+
pubkey = (struct pkcs15_pubkey_object *) obj;
if (sc_pkcs15_compare_id(&pubkey->pub_info->id, id)) {
sc_debug(context, SC_LOG_DEBUG_NORMAL, "Associating object %d as public key", i);
@@ -696,7 +696,7 @@ pkcs15_bind_related_objects(struct pkcs15_fw_data *fw_data)
* a private object, so we must wait till login to read
*/
-static int
+static int
check_cert_data_read(struct pkcs15_fw_data *fw_data,
struct pkcs15_cert_object *cert)
{
@@ -706,9 +706,9 @@ check_cert_data_read(struct pkcs15_fw_data *fw_data,
if (!cert)
return SC_ERROR_OBJECT_NOT_FOUND;
- if (cert->cert_data)
+ if (cert->cert_data)
return 0;
- if ((rv = sc_pkcs15_read_certificate(fw_data->p15_card,
+ if ((rv = sc_pkcs15_read_certificate(fw_data->p15_card,
cert->cert_info, &cert->cert_data) < 0))
return rv;
@@ -724,7 +724,7 @@ check_cert_data_read(struct pkcs15_fw_data *fw_data,
cert->cert_data->key = NULL;
/* now that we have the cert and pub key, lets see if we can bind anything else */
-
+
pkcs15_bind_related_objects(fw_data);
return 0;
@@ -742,7 +742,7 @@ pkcs15_add_object(struct sc_pkcs11_slot *slot,
|| (obj->base.flags & (SC_PKCS11_OBJECT_HIDDEN | SC_PKCS11_OBJECT_RECURS)))
return;
-
+
if (list_contains(&slot->objects, obj))
return;
@@ -1022,7 +1022,7 @@ static CK_RV pkcs15_create_tokens(struct sc_pkcs11_card *p11card)
break;
if (!(obj->base.flags & SC_PKCS11_OBJECT_SEEN)) {
- sc_debug(context, SC_LOG_DEBUG_NORMAL, "%d: Object ('%s',type:%X) was not seen previously\n", j,
+ sc_debug(context, SC_LOG_DEBUG_NORMAL, "%d: Object ('%s',type:%X) was not seen previously\n", j,
obj->p15_object->label, obj->p15_object->type);
if (!slot) {
rv = pkcs15_create_slot(p11card, NULL, &slot);
@@ -1033,7 +1033,7 @@ static CK_RV pkcs15_create_tokens(struct sc_pkcs11_card *p11card)
}
}
- /* FIXME Create read/write slots
+ /* FIXME Create read/write slots
while (slot_allocate(&slot, p11card) == CKR_OK) {
if (!sc_pkcs11_conf.hide_empty_tokens && !(fw_data->p15_card->flags & SC_PKCS15_CARD_FLAG_EMULATED)) {
slot->slot_info.flags |= CKF_TOKEN_PRESENT;
@@ -1101,9 +1101,9 @@ static CK_RV pkcs15_login(struct sc_pkcs11_slot *slot,
break;
case CKU_CONTEXT_SPECIFIC:
/*
- * A session should already be open for user or SO
+ * A session should already be open for user or SO
* All we need to do is authenticate to the card
- * using the correct auth_object.
+ * using the correct auth_object.
* TODO: handle the CK_SO case
*/
sc_debug(context, SC_LOG_DEBUG_NORMAL, "context specific login %d",
@@ -1115,8 +1115,8 @@ static CK_RV pkcs15_login(struct sc_pkcs11_slot *slot,
break;
}
/* TODO looks like this was never executed,
- * And even if it was, why the lock as a session
- * should already be open and the card locked.
+ * And even if it was, why the lock as a session
+ * should already be open and the card locked.
*/
/* For a while, used only to unblock User PIN. */
rc = 0;
@@ -1172,7 +1172,7 @@ static CK_RV pkcs15_login(struct sc_pkcs11_slot *slot,
* after we've authenticated with the card */
/* Context specific login is not real login but only a
- * reassertion of the PIN to the card.
+ * reassertion of the PIN to the card.
* And we don't want to do any extra operations to the card
* that could invalidate the assertion of the pin
* before the crypto operation that requires the assertion
@@ -1183,7 +1183,7 @@ static CK_RV pkcs15_login(struct sc_pkcs11_slot *slot,
}
rc = sc_pkcs15_verify_pin(p15card, auth_object, pPin, ulPinLen);
- sc_debug(context, SC_LOG_DEBUG_NORMAL, "PKCS15 verify PIN returned %d", rc);
+ sc_debug(context, SC_LOG_DEBUG_NORMAL, "PKCS15 verify PIN returned %d", rc);
if (rc != SC_SUCCESS)
return sc_to_cryptoki_error(rc, "C_Login");
@@ -1242,7 +1242,7 @@ static CK_RV pkcs15_logout(struct sc_pkcs11_card *p11card, void *fw_token)
struct pkcs15_fw_data *fw_data = (struct pkcs15_fw_data *) p11card->fw_data;
CK_RV ret = CKR_OK;
int rc;
-
+
memset(fw_data->user_puk, 0, sizeof(fw_data->user_puk));
fw_data->user_puk_len = 0;
@@ -1282,7 +1282,7 @@ static CK_RV pkcs15_change_pin(struct sc_pkcs11_card *p11card,
if (!(auth_info = slot_data_auth_info(fw_token)))
return CKR_USER_PIN_NOT_INITIALIZED;
- sc_debug(context, SC_LOG_DEBUG_NORMAL, "Change '%s', reference %i; login type %i",
+ sc_debug(context, SC_LOG_DEBUG_NORMAL, "Change '%s', reference %i; login type %i",
pin_obj->label, auth_info->attrs.pin.reference, login_user);
if (p11card->card->reader->capabilities & SC_READER_CAP_PIN_PAD) {
/* pPin should be NULL in case of a pin pad reader, but
@@ -1293,7 +1293,7 @@ static CK_RV pkcs15_change_pin(struct sc_pkcs11_card *p11card,
*/
pOldPin = pNewPin = NULL;
ulOldLen = ulNewLen = 0;
- }
+ }
else if (ulNewLen < auth_info->attrs.pin.min_length || ulNewLen > auth_info->attrs.pin.max_length) {
return CKR_PIN_LEN_RANGE;
}
@@ -1364,14 +1364,14 @@ static CK_RV pkcs15_init_pin(struct sc_pkcs11_card *p11card,
/* C_InitPIN is used to unblock User PIN or set it in the SO session .*/
auth_obj = slot_data_auth(slot->fw_data);
if (fw_data->user_puk_len) {
- rc = sc_pkcs15_unblock_pin(fw_data->p15_card, auth_obj,
+ rc = sc_pkcs15_unblock_pin(fw_data->p15_card, auth_obj,
fw_data->user_puk, fw_data->user_puk_len, pPin, ulPinLen);
}
else {
/* FIXME (VT): Actually sc_pkcs15_unblock_pin() do not accepts zero length PUK.
* Something like sc_pkcs15_set_pin() should be introduced.
* For a while, use the 'libopensc' API to set PIN. */
- rc = sc_reset_retry_counter(fw_data->p15_card->card, SC_AC_CHV, auth_info->attrs.pin.reference,
+ rc = sc_reset_retry_counter(fw_data->p15_card->card, SC_AC_CHV, auth_info->attrs.pin.reference,
NULL, 0, pPin, ulPinLen);
}
@@ -1503,23 +1503,23 @@ static CK_RV pkcs15_create_private_key(struct sc_pkcs11_card *p11card,
bn = &rsa->q; break;
case CKA_VALUE:
if (key_type == CKK_GOSTR3410)
- bn = &gost->d;
+ bn = &gost->d;
break;
case CKA_SIGN:
args.usage |= pkcs15_check_bool_cka(attr, SC_PKCS15_PRKEY_USAGE_SIGN);
- break;
+ break;
case CKA_SIGN_RECOVER:
args.usage |= pkcs15_check_bool_cka(attr, SC_PKCS15_PRKEY_USAGE_SIGNRECOVER);
- break;
+ break;
case CKA_DECRYPT:
args.usage |= pkcs15_check_bool_cka(attr, SC_PKCS15_PRKEY_USAGE_DECRYPT);
- break;
+ break;
case CKA_UNWRAP:
args.usage |= pkcs15_check_bool_cka(attr, SC_PKCS15_PRKEY_USAGE_UNWRAP);
break;
case OPENSC_CKA_NON_REPUDIATION:
args.usage |= pkcs15_check_bool_cka(attr, SC_PKCS15_PRKEY_USAGE_NONREPUDIATION);
- break;
+ break;
default:
/* ignore unknown attrs, or flag error? */
continue;
@@ -2267,7 +2267,7 @@ static CK_RV pkcs15_set_attrib(struct sc_pkcs11_session *session,
set_attr_done:
sc_pkcs15init_unbind(profile);
sc_unlock(p11card->card);
-
+
return rv;
#endif
}
@@ -2331,7 +2331,7 @@ static CK_RV pkcs15_cert_get_attribute(struct sc_pkcs11_session *session,
*(CK_CERTIFICATE_TYPE*)attr->pValue = CKC_X_509;
break;
case CKA_ID:
- if (cert->cert_info->authority
+ if (cert->cert_info->authority
&& sc_pkcs11_conf.zero_ckaid_for_ca_certs) {
check_attribute_buffer(attr, 1);
*(unsigned char*)attr->pValue = 0;
@@ -2475,7 +2475,7 @@ static CK_RV pkcs15_prkey_get_attribute(struct sc_pkcs11_session *session,
* key, something PKCS#11 doesn't guarantee.
*/
if ((attr->type == CKA_MODULUS) || (attr->type == CKA_PUBLIC_EXPONENT) ||
- ((attr->type == CKA_MODULUS_BITS) && (prkey->prv_p15obj->type == SC_PKCS15_TYPE_PRKEY_EC)) ||
+ ((attr->type == CKA_MODULUS_BITS) && (prkey->prv_p15obj->type == SC_PKCS15_TYPE_PRKEY_EC)) ||
(attr->type == CKA_ECDSA_PARAMS)) {
/* First see if we have a associated public key */
if (prkey->prv_pubkey && prkey->prv_pubkey->pub_data)
@@ -2580,8 +2580,8 @@ static CK_RV pkcs15_prkey_get_attribute(struct sc_pkcs11_session *session,
switch (prkey->prv_p15obj->type) {
case SC_PKCS15_TYPE_PRKEY_EC:
if (key)
- *(CK_ULONG *) attr->pValue = key->u.ec.params.field_length;
- else
+ *(CK_ULONG *) attr->pValue = key->u.ec.params.field_length;
+ else
*(CK_ULONG *) attr->pValue = 384; /* TODO -DEE needs work */
return CKR_OK;
default:
@@ -2818,7 +2818,7 @@ static void pkcs15_pubkey_release(void *object)
struct sc_pkcs15_pubkey *key_data = pubkey->pub_data;
if (__pkcs15_release_object((struct pkcs15_any_object *) object) == 0) {
- if (key_data)
+ if (key_data)
sc_pkcs15_free_pubkey(key_data);
}
}
@@ -2848,7 +2848,7 @@ static CK_RV pkcs15_pubkey_get_attribute(struct sc_pkcs11_session *session,
case CKA_PUBLIC_EXPONENT:
case CKA_EC_PARAMS:
case CKA_EC_POINT:
- if (pubkey->pub_data == NULL)
+ if (pubkey->pub_data == NULL)
/* FIXME: check the return value? */
check_cert_data_read(fw_data, cert);
break;
@@ -2949,7 +2949,7 @@ static CK_RV pkcs15_pubkey_get_attribute(struct sc_pkcs11_session *session,
case CKA_VALUE:
if (pubkey->pub_data) {
/* TODO: -DEE Not all pubkeys have CKA_VALUE attribute. RSA and EC
- * for example don't. So why is this here?
+ * for example don't. So why is this here?
* Why checking for cert in this pkcs15_pubkey_get_attribute?
*/
check_attribute_buffer(attr, pubkey->pub_data->data.len);
@@ -2970,7 +2970,7 @@ static CK_RV pkcs15_pubkey_get_attribute(struct sc_pkcs11_session *session,
return get_ec_pubkey_params(pubkey->pub_data, attr);
case CKA_EC_POINT:
return get_ec_pubkey_point(pubkey->pub_data, attr);
-
+
default:
return CKR_ATTRIBUTE_TYPE_INVALID;
}
@@ -3002,7 +3002,7 @@ static CK_RV pkcs15_dobj_set_attribute(struct sc_pkcs11_session *session,
void *object, CK_ATTRIBUTE_PTR attr)
{
struct pkcs15_data_object *dobj = (struct pkcs15_data_object*) object;
-
+
return pkcs15_set_attrib(session, dobj->base.p15_object, attr);
}
@@ -3018,11 +3018,11 @@ static int pkcs15_dobj_get_value(struct sc_pkcs11_session *session,
if (!out_data)
return SC_ERROR_INVALID_ARGUMENTS;
-
+
rv = sc_lock(card);
if (rv < 0)
return sc_to_cryptoki_error(rv, "C_GetAttributeValue");
-
+
rv = sc_pkcs15_read_data_object(fw_data->p15_card, dobj->info, out_data);
sc_unlock(card);
@@ -3051,7 +3051,7 @@ static CK_RV pkcs15_dobj_get_attribute(struct sc_pkcs11_session *session,
{
struct pkcs15_data_object *dobj = (struct pkcs15_data_object*) object;
size_t len;
-
+
switch (attr->type) {
case CKA_CLASS:
check_attribute_buffer(attr, sizeof(CK_OBJECT_CLASS));
@@ -3090,7 +3090,7 @@ static CK_RV pkcs15_dobj_get_attribute(struct sc_pkcs11_session *session,
case CKA_OBJECT_ID:
{
len = sizeof(dobj->info->app_oid);
-
+
check_attribute_buffer(attr, len);
memcpy(attr->pValue, dobj->info->app_oid.value, len);
}
@@ -3099,7 +3099,7 @@ static CK_RV pkcs15_dobj_get_attribute(struct sc_pkcs11_session *session,
{
CK_RV rv;
struct sc_pkcs15_data *data = NULL;
-
+
rv = pkcs15_dobj_get_value(session, dobj, &data);
if (rv == CKR_OK)
rv = data_value_to_attr(attr, data);
@@ -3114,7 +3114,7 @@ static CK_RV pkcs15_dobj_get_attribute(struct sc_pkcs11_session *session,
default:
return CKR_ATTRIBUTE_TYPE_INVALID;
}
-
+
return CKR_OK;
}
@@ -3197,10 +3197,10 @@ static CK_RV
get_ec_pubkey_params(struct sc_pkcs15_pubkey *key, CK_ATTRIBUTE_PTR attr)
{
struct sc_ec_params * ecp;
-
+
if (key == NULL)
return CKR_ATTRIBUTE_TYPE_INVALID;
- if (key->alg_id == NULL)
+ if (key->alg_id == NULL)
return CKR_ATTRIBUTE_TYPE_INVALID;
ecp = (struct sc_ec_params *) key->alg_id->params;
@@ -3359,14 +3359,14 @@ static int register_gost_mechanisms(struct sc_pkcs11_card *p11card, int flags)
}
-static int register_ec_mechanisms(struct sc_pkcs11_card *p11card, int flags,
+static int register_ec_mechanisms(struct sc_pkcs11_card *p11card, int flags,
unsigned long ext_flags, CK_ULONG min_key_size, CK_ULONG max_key_size)
{
CK_MECHANISM_INFO mech_info;
sc_pkcs11_mechanism_type_t *mt;
CK_FLAGS ec_flags = 0;
int rc;
-
+
if (ext_flags & SC_ALGORITHM_EXT_EC_F_P)
ec_flags |= CKF_EC_F_P;
if (ext_flags & SC_ALGORITHM_EXT_EC_F_2M)
@@ -3410,8 +3410,8 @@ static int register_ec_mechanisms(struct sc_pkcs11_card *p11card, int flags,
rc = sc_pkcs11_register_mechanism(p11card, mt);
if (rc != CKR_OK)
return rc;
- }
-
+ }
+
#if 0
/* TODO: -DEE Add CKM_ECDH1_COFACTOR_DERIVE as PIV can do this */
@@ -3426,7 +3426,7 @@ static int register_ec_mechanisms(struct sc_pkcs11_card *p11card, int flags,
return CKR_OK;
}
-
+
/*
* Mechanism handling
@@ -3462,10 +3462,10 @@ static CK_RV register_mechanisms(struct sc_pkcs11_card *p11card)
* flags, based on the assumption that cards don't
* support different modes for different key sizes
* But we need to do this by type of key as
- * each has different min/max and different flags.
+ * each has different min/max and different flags.
*
- * TODO: -DEE This code assumed RSA, but the GOST
- * and EC code was forced in. There should be a
+ * TODO: -DEE This code assumed RSA, but the GOST
+ * and EC code was forced in. There should be a
* routine for each key type.
*/
num = card->algorithm_count;
@@ -3572,7 +3572,7 @@ static CK_RV register_mechanisms(struct sc_pkcs11_card *p11card)
rc = sc_pkcs11_register_mechanism(p11card, mt);
if (rc != CKR_OK)
return rc;
- }
+ }
}
return CKR_OK;
View
14 src/pkcs11/mechanism.c
@@ -437,23 +437,23 @@ sc_pkcs11_signature_size(sc_pkcs11_operation_t *operation, CK_ULONG_PTR pLength)
key = ((struct signature_data *) operation->priv_data)->key;
/*
* EC and GOSTR do not have CKA_MODULUS_BITS attribute.
- * But other code in framework treats them as if they do.
+ * But other code in framework treats them as if they do.
* So should do switch(key_type)
- * and then get what ever attributes are needed.
+ * and then get what ever attributes are needed.
*/
rv = key->ops->get_attribute(operation->session, key, &attr_key_type);
- if (rv == CKR_OK) {
+ if (rv == CKR_OK) {
switch(key_type) {
case CKK_RSA:
- rv = key->ops->get_attribute(operation->session, key, &attr);
+ rv = key->ops->get_attribute(operation->session, key, &attr);
/* convert bits to bytes */
if (rv == CKR_OK)
*pLength = (*pLength + 7) / 8;
break;
case CKK_EC:
/* TODO: -DEE we should use something other then CKA_MODULUS_BITS... */
rv = key->ops->get_attribute(operation->session, key, &attr);
- *pLength = ((*pLength + 7)/8) * 2 ; /* 2*nLen in bytes */
+ *pLength = ((*pLength + 7)/8) * 2 ; /* 2*nLen in bytes */
break;
case CKK_GOSTR3410:
rv = key->ops->get_attribute(operation->session, key, &attr);
@@ -864,8 +864,8 @@ sc_pkcs11_register_sign_and_hash_mechanism(struct sc_pkcs11_card *p11card,
info->hash_mech = hash_mech;
new_type = sc_pkcs11_new_fw_mechanism(mech, &mech_info, sign_type->key_type, info);
-
+
if (!new_type)
- return CKR_HOST_MEMORY;
+ return CKR_HOST_MEMORY;
return sc_pkcs11_register_mechanism(p11card, new_type);
}
View
2 src/pkcs11/misc.c
@@ -312,7 +312,7 @@ void load_pkcs11_parameters(struct sc_pkcs11_config *conf, sc_context_t * ctx)
conf->pin_unblock_style = SC_PKCS11_PIN_UNBLOCK_SCONTEXT_SETPIN;
else if (unblock_style && !strcmp(unblock_style, "init_pin_in_so_session"))
conf->pin_unblock_style = SC_PKCS11_PIN_UNBLOCK_SO_LOGGED_INITPIN;
-
+
conf->create_puk_slot = scconf_get_bool(conf_block, "create_puk_slot", conf->create_puk_slot);
conf->zero_ckaid_for_ca_certs = scconf_get_bool(conf_block, "zero_ckaid_for_ca_certs", conf->zero_ckaid_for_ca_certs);
View
2 src/pkcs11/openssl.c
@@ -460,7 +460,7 @@ CK_RV sc_pkcs11_verify_data(const unsigned char *pubkey, int pubkey_len,
RSA_free(rsa);
return CKR_DEVICE_MEMORY;
}
-
+
rsa_outlen = RSA_public_decrypt(signat_len, signat, rsa_out, rsa, pad);
RSA_free(rsa);
if(rsa_outlen <= 0) {
View
64 src/pkcs11/pkcs11-display.c
@@ -31,7 +31,7 @@
/*
* Netscape-defined object classes
- *
+ *
*/
#define CKO_NETSCAPE 0xCE534350
@@ -159,12 +159,12 @@ print_generic(FILE *f, CK_LONG type, CK_VOID_PTR value, CK_ULONG size, CK_VOID_P
*ascii_ptr = '.';
ascii_ptr++;
}
-
+
/* padd */
while (strlen(hex) < 3*16)
strcat(hex, " ");
fprintf(f, "\n %08X %s %s", offset, hex, ascii);
- }
+ }
else {
if (value != NULL)
fprintf(f, "EMPTY");
@@ -176,7 +176,7 @@ print_generic(FILE *f, CK_LONG type, CK_VOID_PTR value, CK_ULONG size, CK_VOID_P
#ifdef ENABLE_OPENSSL
-static void
+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);
@@ -197,7 +197,7 @@ print_dn(FILE *f, CK_LONG type, CK_VOID_PTR value, CK_ULONG size, CK_VOID_PTR ar
}
#endif
-void
+void
print_print(FILE *f, CK_LONG type, CK_VOID_PTR value, CK_ULONG size, CK_VOID_PTR arg)
{
CK_ULONG i, j;
@@ -207,15 +207,15 @@ print_print(FILE *f, CK_LONG type, CK_VOID_PTR value, CK_ULONG size, CK_VOID_PTR
fprintf(f, "%s\n ", buf_spec(value, size));
for(i = 0; i < size; i += j) {
for(j = 0; ((i + j < size) && (j < 32)); j++) {
- if (((j % 4) == 0) && (j != 0))
+ if (((j % 4) == 0) && (j != 0))
fprintf(f, " ");
c = ((CK_BYTE *)value)[i+j];
fprintf(f, "%02X", c);
}
fprintf(f, "\n ");
for(j = 0; ((i + j < size) && (j < 32)); j++) {
- if (((j % 4) == 0) && (j != 0))
+ if (((j % 4) == 0) && (j != 0))
fprintf(f, " ");
c = ((CK_BYTE *)value)[i + j];
if((c > 32) && (c < 128))
@@ -224,7 +224,7 @@ print_print(FILE *f, CK_LONG type, CK_VOID_PTR value, CK_ULONG size, CK_VOID_PTR
fprintf(f, " .");
}
}
- if(j == 32)
+ if(j == 32)
fprintf(f, "\n ");
}
else {
@@ -474,7 +474,7 @@ static enum_specs ck_mec_s[] = {
{ CKM_JUNIPER_WRAP , "CKM_JUNIPER_WRAP " },
{ CKM_FASTHASH , "CKM_FASTHASH " },
{ CKM_AES_KEY_GEN , "CKM_AES_KEY_GEN " },
- { CKM_AES_ECB , "CKM_AES_ECB " },
+ { CKM_AES_ECB , "CKM_AES_ECB " },
{ CKM_AES_CBC , "CKM_AES_CBC " },
{ CKM_AES_MAC , "CKM_AES_MAC " },
{ CKM_AES_MAC_GENERAL , "CKM_AES_MAC_GENERAL " },
@@ -573,13 +573,13 @@ static enum_specs ck_err_s[] = {
{ CKR_VENDOR_DEFINED, "CKR_VENDOR_DEFINED" }
};
-static enum_specs ck_usr_s[] = {
- { CKU_SO, "CKU_SO" },
+static enum_specs ck_usr_s[] = {
+ { CKU_SO, "CKU_SO" },
{ CKU_USER, "CKU_USER" },
{ CKU_CONTEXT_SPECIFIC, "CKU_CONTEXT_SPECIFIC" }
};
-static enum_specs ck_sta_s[] = {
+static enum_specs ck_sta_s[] = {
{ CKS_RO_PUBLIC_SESSION, "CKS_RO_PUBLIC_SESSION" },
{ CKS_RO_USER_FUNCTIONS, "CKS_RO_USER_FUNCTIONS" },
{ CKS_RW_PUBLIC_SESSION, "CKS_RW_PUBLIC_SESSION" },
@@ -612,13 +612,13 @@ type_spec ck_attribute_specs[] = {
{ CKA_VALUE , "CKA_VALUE ", print_generic, NULL },
{ CKA_OBJECT_ID , "CKA_OBJECT_ID ", print_generic, NULL },
{ CKA_CERTIFICATE_TYPE , "CKA_CERTIFICATE_TYPE ", print_enum, ck_crt_t },
-#ifdef ENABLE_OPENSSL
+#ifdef ENABLE_OPENSSL
{ CKA_ISSUER , "CKA_ISSUER ", print_dn, NULL },
#else
{ CKA_ISSUER , "CKA_ISSUER ", print_generic, NULL },
#endif
{ CKA_SERIAL_NUMBER , "CKA_SERIAL_NUMBER ", print_generic, NULL },
-#ifdef ENABLE_OPENSSL
+#ifdef ENABLE_OPENSSL
{ CKA_AC_ISSUER , "CKA_AC_ISSUER ", print_dn, NULL },
#else
{ CKA_AC_ISSUER , "CKA_AC_ISSUER ", print_generic, NULL },
@@ -633,7 +633,7 @@ type_spec ck_attribute_specs[] = {
{ CKA_HASH_OF_ISSUER_PUBLIC_KEY, "CKA_HASH_OF_ISSUER_PUBLIC_KEY ", print_generic, NULL },
{ CKA_CHECK_VALUE , "CKA_CHECK_VALUE ", print_generic, NULL },
{ CKA_KEY_TYPE , "CKA_KEY_TYPE ", print_enum, ck_key_t },
-#ifdef ENABLE_OPENSSL
+#ifdef ENABLE_OPENSSL
{ CKA_SUBJECT , "CKA_SUBJECT ", print_dn, NULL },
#else
{ CKA_SUBJECT , "CKA_SUBJECT ", print_generic, NULL },
@@ -750,23 +750,23 @@ const char *
lookup_enum(CK_ULONG type, CK_ULONG value)
{
CK_ULONG i;
-
+
for(i = 0; ck_types[i].type < ( sizeof(ck_types) / sizeof(enum_spec) ) ; i++)
if(ck_types[i].type == type)
return lookup_enum_spec(&(ck_types[i]), value);
return NULL;
}
-void
+void
show_error( FILE *f, char *str, CK_RV rc )
{
fprintf(f, "%s returned: %ld %s", str, (unsigned long) rc, lookup_enum ( RV_T, rc ));
fprintf(f, "\n");
}
-void
+void
print_ck_info(FILE *f, CK_INFO *info)
{
fprintf(f, " cryptokiVersion: %d.%d\n", info->cryptokiVersion.major, info->cryptokiVersion.minor );
@@ -777,22 +777,22 @@ print_ck_info(FILE *f, CK_INFO *info)
}
-void
+void
print_slot_list(FILE *f, CK_SLOT_ID_PTR pSlotList, CK_ULONG ulCount)
{
CK_ULONG i;
if(pSlotList) {
for (i = 0; i < ulCount; i++)
fprintf(f, "Slot %ld\n", pSlotList[i]);
- }
+ }
else {
fprintf(f, "Count is %ld\n", ulCount);
}
}
-void
+void
print_slot_info(FILE *f, CK_SLOT_INFO *info)
{
size_t i;
@@ -815,7 +815,7 @@ print_slot_info(FILE *f, CK_SLOT_INFO *info)
}
-void
+void
print_token_info(FILE *f, CK_TOKEN_INFO *info)
{
size_t i;
@@ -865,7 +865,7 @@ print_token_info(FILE *f, CK_TOKEN_INFO *info)
}
-void
+void
print_mech_list(FILE *f, CK_MECHANISM_TYPE_PTR pMechanismList, CK_ULONG ulMechCount)
{
CK_ULONG imech;
@@ -878,21 +878,21 @@ print_mech_list(FILE *f, CK_MECHANISM_TYPE_PTR pMechanismList, CK_ULONG ulMechCo
else
fprintf(f, " Unknown Mechanism (%08lx) \n", pMechanismList[imech]);
}
- }
+ }
else {
fprintf(f, "Count is %ld\n", ulMechCount);
}
}
-void
+void
print_mech_info(FILE *f, CK_MECHANISM_TYPE type, CK_MECHANISM_INFO_PTR minfo)
{
const char *name = lookup_enum(MEC_T, type);
CK_ULONG known_flags = CKF_HW | CKF_ENCRYPT | CKF_DECRYPT | CKF_DIGEST |
CKF_SIGN | CKF_SIGN_RECOVER | CKF_VERIFY | CKF_VERIFY_RECOVER |
CKF_GENERATE | CKF_GENERATE_KEY_PAIR | CKF_WRAP | CKF_UNWRAP | CKF_DERIVE;
-
+
if (name)
fprintf(f, "%s : ", name);
else
@@ -919,7 +919,7 @@ print_mech_info(FILE *f, CK_MECHANISM_TYPE type, CK_MECHANISM_INFO_PTR minfo)
}
-void
+void
print_attribute_list(FILE *f, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
{
CK_ULONG j, k;
@@ -950,12 +950,12 @@ print_attribute_list(FILE *f, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
}
-void
+void
print_attribute_list_req(FILE *f, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
{
CK_ULONG j, k;
int found;
-
+
for(j = 0; j < ulCount ; j++) {
found = 0;
for(k = 0; k < ck_attribute_num; k++) {
@@ -966,7 +966,7 @@ print_attribute_list_req(FILE *f, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
k = ck_attribute_num;
}
}
-
+
if (!found) {
fprintf(f, " CKA_? (0x%08lx) ", pTemplate[j].type);
fprintf(f, "%s\n", buf_spec(pTemplate[j].pValue, pTemplate[j].ulValueLen));
@@ -975,7 +975,7 @@ print_attribute_list_req(FILE *f, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
}
-void
+void
print_session_info(FILE *f, CK_SESSION_INFO *info)
{
size_t i;
@@ -989,7 +989,7 @@ print_session_info(FILE *f, CK_SESSION_INFO *info)
fprintf(f, " flags: %0lx\n", info->flags );
for(i = 0; i < sizeof (ck_flags) / sizeof (*ck_flags); i++) {
- if(info->flags & ck_flags[i].type)
+ if(info->flags & ck_flags[i].type)
fprintf(f, " %s\n", ck_flags[i].name);
}
fprintf(f, " ulDeviceError: %0lx\n", info->ulDeviceError );
View
32 src/pkcs11/pkcs11-global.c
@@ -150,7 +150,7 @@ static int sc_unlock_mutex(void *m)
return SC_SUCCESS;
else
return SC_ERROR_INTERNAL;
-
+
}
static int sc_destroy_mutex(void *m)
@@ -221,7 +221,7 @@ CK_RV C_Initialize(CK_VOID_PTR pInitArgs)
ctx_opts.ver = 0;
ctx_opts.app_name = "opensc-pkcs11";
ctx_opts.thread_ctx = &sc_thread_ctx;
-
+
rc = sc_context_create(&context, &ctx_opts);
if (rc != SC_SUCCESS) {
rv = CKR_GENERAL_ERROR;
@@ -234,11 +234,11 @@ CK_RV C_Initialize(CK_VOID_PTR pInitArgs)
/* List of sessions */
list_init(&sessions);
list_attributes_seeker(&sessions, session_list_seeker);
-
+
/* List of slots */
list_init(&virtual_slots);
list_attributes_seeker(&virtual_slots, slot_list_seeker);
-
+
/* Create a slot for a future "PnP" stuff. */
if (sc_pkcs11_conf.plug_and_play) {
create_slot(NULL);
@@ -254,7 +254,7 @@ CK_RV C_Initialize(CK_VOID_PTR pInitArgs)
slot->events = 0; /* Initially there are no events */
}
-out:
+out:
if (context != NULL)
sc_debug(context, SC_LOG_DEBUG_NORMAL, "C_Initialize() = %s", lookup_enum ( RV_T, rv ));
@@ -288,7 +288,7 @@ CK_RV C_Finalize(CK_VOID_PTR pReserved)
return rv;
sc_debug(context, SC_LOG_DEBUG_NORMAL, "C_Finalize()");
-
+
/* cancel pending calls */
in_finalize = 1;
sc_cancel(context);
@@ -342,7 +342,7 @@ CK_RV C_GetInfo(CK_INFO_PTR pInfo)
sc_pkcs11_unlock();
return rv;
-}
+}
CK_RV C_GetFunctionList(CK_FUNCTION_LIST_PTR_PTR ppFunctionList)
{
@@ -379,7 +379,7 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese
/* Trick NSS into updating the slot list by changing the hotplug slot ID */
sc_pkcs11_slot_t *hotplug_slot = list_get_at(&virtual_slots, 0);
hotplug_slot->id--;
- sc_ctx_detect_readers(context);
+ sc_ctx_detect_readers(context);
}
card_detect_all();
@@ -400,8 +400,8 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese
* - any slot with token;
* - without token(s), one empty slot per reader;
*/
- if ((!tokenPresent && !slot->reader)
- || (!tokenPresent && slot->reader != prev_reader)
+ if ((!tokenPresent && !slot->reader)
+ || (!tokenPresent && slot->reader != prev_reader)
|| (slot->slot_info.flags & CKF_TOKEN_PRESENT))
found[numMatches++] = slot->id;
prev_reader = slot->reader;
@@ -564,7 +564,7 @@ CK_RV C_InitToken(CK_SLOT_ID slotID,
rv = slot_get_token(slotID, &slot);
if (rv != CKR_OK)
goto out;
-
+
/* Make sure there's no open session for this token */
for (i=0; i<list_size(&sessions); i++) {
session = (struct sc_pkcs11_session*)list_get_at(&sessions, i);
@@ -600,7 +600,7 @@ CK_RV C_WaitForSlotEvent(CK_FLAGS flags, /* blocking/nonblocking flag */
CK_SLOT_ID slot_id;
CK_RV rv;
int r;
-
+
if (pReserved != NULL_PTR)
return CKR_ARGUMENTS_BAD;
@@ -633,7 +633,7 @@ CK_RV C_WaitForSlotEvent(CK_FLAGS flags, /* blocking/nonblocking flag */
Change the first hotplug slot id on every call to make this happen. */
sc_pkcs11_slot_t *hotplug_slot = list_get_at(&virtual_slots, 0);
*pSlot= hotplug_slot->id -1;
-
+
rv = sc_pkcs11_lock();
if (rv != CKR_OK)
return rv;
@@ -659,7 +659,7 @@ CK_RV C_WaitForSlotEvent(CK_FLAGS flags, /* blocking/nonblocking flag */
if (rv != CKR_OK)
goto again;
-out:
+out:
if (pSlot)
*pSlot = slot_id;
@@ -740,7 +740,7 @@ CK_RV sc_pkcs11_lock(void)
if (global_locking) {
while (global_locking->LockMutex(global_lock) != CKR_OK)
;
- }
+ }
return CKR_OK;
}
@@ -753,7 +753,7 @@ __sc_pkcs11_unlock(void *lock)
if (global_locking) {
while (global_locking->UnlockMutex(lock) != CKR_OK)
;
- }
+ }
}
void sc_pkcs11_unlock(void)
View
14 src/pkcs11/pkcs11-object.c
@@ -53,10 +53,10 @@ static sc_pkcs11_mechanism_type_t find_mechanism = {
static void sc_find_release(sc_pkcs11_operation_t *operation)
{
- struct sc_pkcs11_find_operation *fop =
+ struct sc_pkcs11_find_operation *fop =
(struct sc_pkcs11_find_operation *)operation;
- sc_debug(context, SC_LOG_DEBUG_NORMAL,"freeing %d handles used %d at %p",
+ sc_debug(context, SC_LOG_DEBUG_NORMAL,"freeing %d handles used %d at %p",
fop->allocated_handles, fop->num_handles, fop->handles);
if (fop->handles) {
free(fop->handles);
@@ -322,13 +322,13 @@ CK_RV C_FindObjectsInit(CK_SESSION_HANDLE hSession, /* the session's handle */
hide_private = 0;
if (slot->login_user != CKU_USER && (slot->token_info.flags & CKF_LOGIN_REQUIRED))
hide_private = 1;
-
+
/* For each object in token do */
for (i=0; i<list_size(&slot->objects); i++) {
object = (struct sc_pkcs11_object *)list_get_at(&slot->objects, i);
sc_debug(context, SC_LOG_DEBUG_NORMAL, "Object with handle 0x%lx", object->handle);
- /* User not logged in and private object? */
+ /* User not logged in and private object? */
if (hide_private) {
if (object->ops->get_attribute(session, object, &private_attribute) != CKR_OK)
continue;
@@ -365,7 +365,7 @@ CK_RV C_FindObjectsInit(CK_SESSION_HANDLE hSession, /* the session's handle */
operation->allocated_handles += SC_PKCS11_FIND_INC_HANDLES;
sc_debug(context, SC_LOG_DEBUG_NORMAL, "realloc for %d handles",
operation->allocated_handles);
- operation->handles = realloc(operation->handles,
+ operation->handles = realloc(operation->handles,
sizeof(CK_OBJECT_HANDLE) * operation->allocated_handles);
if (operation->handles == NULL) {
rv = CKR_HOST_MEMORY;
@@ -1002,15 +1002,15 @@ CK_RV C_DeriveKey(CK_SESSION_HANDLE hSession, /* the session's handle */
CK_ULONG ulAttributeCount, /* # of attributes in template */
CK_OBJECT_HANDLE_PTR phKey)
{ /* gets handle of derived key */
-/* TODO: -DEE ECDH with Cofactor on PIV is an example */
+/* TODO: -DEE ECDH with Cofactor on PIV is an example */
return CKR_FUNCTION_NOT_SUPPORTED;
}
CK_RV C_SeedRandom(CK_SESSION_HANDLE hSession, /* the session's handle */
CK_BYTE_PTR pSeed, /* the seed material */
CK_ULONG ulSeedLen)
{ /* count of bytes of seed material */
- return CKR_FUNCTION_NOT_SUPPORTED;
+ return CKR_FUNCTION_NOT_SUPPORTED;
}
CK_RV C_GenerateRandom(CK_SESSION_HANDLE hSession, /* the session's handle */
View
2 src/pkcs11/pkcs11-opensc.h
@@ -4,7 +4,7 @@
/* OpenSC specific extensions */
/*
* In PKCS#11 there is no CKA_ attribute dedicated to the NON-REPUDIATION flag.
- * We need this flag in PKCS#15/libopensc to make dinstinction between
+ * We need this flag in PKCS#15/libopensc to make dinstinction between
* 'signature' and 'qualified signature' key slots.
*/
#define OPENSC_CKA_NON_REPUDIATION (CKA_VENDOR_DEFINED | 1UL)
View
2 src/pkcs11/pkcs11-session.c
@@ -178,7 +178,7 @@ CK_RV C_GetSessionInfo(CK_SESSION_HANDLE hSession, /* the session's handle */
struct sc_pkcs11_slot *slot;
if (pInfo == NULL_PTR)
- return CKR_ARGUMENTS_BAD;
+ return CKR_ARGUMENTS_BAD;
rv = sc_pkcs11_lock();
if (rv != CKR_OK)
View
8 src/pkcs11/pkcs11-spy.c
@@ -137,7 +137,7 @@ static CK_RV init_spy(void)
return CKR_HOST_MEMORY;
}
- /*
+ /*
* Don't use getenv() as the last parameter for scconf_get_str(),
* as we want to be able to override configuration file via
* environment variables
@@ -148,8 +148,8 @@ static CK_RV init_spy(void)
}
#ifdef _WIN32
if (!spy_output) {
- /* try for the machine version first, as we may be runing
- * without a user during login
+ /* try for the machine version first, as we may be runing
+ * without a user during login
*/
rc = RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\OpenSC Project\\PKCS11-Spy",
0, KEY_QUERY_VALUE, &hKey );
@@ -177,7 +177,7 @@ static CK_RV init_spy(void)
#ifdef _WIN32
if (!module) {
/* try for the machine version first, as we may be runing
- * without a user during login
+ * without a user during login
*/
rc = RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\OpenSC Project\\PKCS11-Spy",
0, KEY_QUERY_VALUE, &hKey );
View
2 src/pkcs11/sc-pkcs11.h
@@ -38,7 +38,7 @@
#ifdef __cplusplus
extern "C" {
-#endif
+#endif
#if defined(_WIN32) || defined(USE_CYGWIN)
#define PKCS11_DEFAULT_MODULE_NAME "opensc-pkcs11.dll"
View
14 src/pkcs11/slot.c
@@ -45,7 +45,7 @@ static struct sc_pkcs11_slot * reader_get_slot(sc_reader_t *reader)
sc_pkcs11_slot_t *slot = (sc_pkcs11_slot_t *) list_get_at(&virtual_slots, i);
if (slot->reader == reader) {
return slot;
- }
+ }
}
return NULL;
}
@@ -72,7 +72,7 @@ static int object_list_seeker(const void *el, const void *key)
return 1;
return 0;
}
-
+
CK_RV create_slot(sc_reader_t *reader)
{
struct sc_pkcs11_slot *slot;
@@ -88,7 +88,7 @@ CK_RV create_slot(sc_reader_t *reader)
slot->login_user = -1;
slot->id = (CK_SLOT_ID) list_locate(&virtual_slots, slot);
sc_debug(context, SC_LOG_DEBUG_NORMAL, "Creating slot with id 0x%lx", slot->id);
-
+
list_init(&slot->objects);
list_attributes_seeker(&slot->objects, object_list_seeker);
@@ -172,7 +172,7 @@ CK_RV card_removed(sc_reader_t * reader)
free(card->mechanisms);
free(card);
}
-
+
return CKR_OK;
}
@@ -203,7 +203,7 @@ CK_RV card_detect(sc_reader_t *reader)
sc_debug(context, SC_LOG_DEBUG_NORMAL, "%s: Card changed\n", reader->name);
/* The following should never happen - but if it
* does we'll be stuck in an endless loop.
- * So better be fussy.
+ * So better be fussy.
if (!retry--)
return CKR_TOKEN_NOT_PRESENT; */
card_removed(reader);
@@ -272,7 +272,7 @@ CK_RV card_detect_all(void) {
initialize_reader(reader);
card_detect(sc_ctx_get_reader(context, i));
}
- return CKR_OK;
+ return CKR_OK;
}
/* Allocates an existing slot to a card */
@@ -317,7 +317,7 @@ CK_RV slot_get_token(CK_SLOT_ID id, struct sc_pkcs11_slot ** slot)
return rv;
if (!((*slot)->slot_info.flags & CKF_TOKEN_PRESENT)) {
- if ((*slot)->reader == NULL)
+ if ((*slot)->reader == NULL)
return CKR_TOKEN_NOT_PRESENT;
rv = card_detect((*slot)->reader);
if (rv != CKR_OK)
View
4 src/scconf/parse.c
@@ -72,7 +72,7 @@ static void scconf_parse_warning_expect(scconf_parser * parser, const char *toke
/* FIXME: save the warnings somewhere */
parser->warnings = 1;
- snprintf(parser->emesg, sizeof(parser->emesg),
+ snprintf(parser->emesg, sizeof(parser->emesg),
"Line %d: missing '%s', ignoring\n",
parser->line, token);
}
@@ -360,7 +360,7 @@ void scconf_parse_token(scconf_parser * parser, int token_type, const char *toke
scconf_parse_reset_state(parser);
break;
default:
- snprintf(parser->emesg, sizeof(parser->emesg),
+ snprintf(parser->emesg, sizeof(parser->emesg),
"Line %d: bad token ignoring\n",
parser->line);
}
View
4 src/scconf/test-conf.c
@@ -4,11 +4,11 @@
* Copyright (C) 2002
* Antti Tapaninen <aet@cc.hut.fi>
*
- * This program is free software; you can redistribute it and/or modify
+ * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
View
50 src/tools/cardos-tool.c
@@ -83,7 +83,7 @@ static int cardos_info(void)
if (verbose) {
printf("Card ATR:\n");
- util_hex_dump_asc(stdout, card->atr.value, card->atr.len, -1);
+ util_hex_dump_asc(stdout, card->atr.value, card->atr.len, -1);
} else {
char tmp[SC_MAX_ATR_SIZE*3];
sc_bin_to_hex(card->atr.value, card->atr.len, tmp, sizeof(tmp) - 1, ':');
@@ -170,9 +170,9 @@ static int cardos_info(void)
} else if (apdu.resp[0] == 0xc8 && apdu.resp[1] == 0x09) {
printf(" (that's CardOS M4.2B)\n");
} else if (apdu.resp[0] == 0xc8 && apdu.resp[1] == 0x0B) {
- printf(" (that's CardOS M4.2C)\n");
+ printf(" (that's CardOS M4.2C)\n");
} else if (apdu.resp[0] == 0xc8 && apdu.resp[1] == 0x0D) {
- printf(" (that's CardOS M4.4)\n");
+ printf(" (that's CardOS M4.4)\n");
} else {
printf(" (unknown Version)\n");
}
@@ -271,7 +271,7 @@ static int cardos_info(void)
} else {
printf("ATR Status: 0x%d unknown\n",rbuf[0]);
}
-
+
apdu.p2 = 0x88;
apdu.resplen = sizeof(rbuf);
r = sc_transmit_apdu(card, &apdu);
@@ -396,7 +396,7 @@ static int cardos_sm4h(const unsigned char *in, size_t inlen, unsigned char
plain_lc = 0;
if (inlen > 5)
plain_lc = in[4];
-
+
/* 4 + plain_lc plus 0..7 bytes of padding */
mac_input_len = 4 + plain_lc;
while (mac_input_len % 8) mac_input_len++;
@@ -413,7 +413,7 @@ static int cardos_sm4h(const unsigned char *in, size_t inlen, unsigned char
if (plain_lc) /* copy data from in APDU */
memcpy(&mac_input[4],&in[5],plain_lc);
/* calloc already did the ansi padding: rest is 00 */
-
+
/* prepare des key using first 8 bytes of key */
DES_set_key((const_DES_cblock*) &key[0], &ks_a);
/* prepare des key using second 8 bytes of key */
@@ -447,7 +447,7 @@ static int cardos_sm4h(const unsigned char *in, size_t inlen, unsigned char
printf("out of memory, aborting\n");
return 0;
}
- if (plain_lc)
+ if (plain_lc)
memcpy(&enc_input[0],&in[5],plain_lc);
for (i=0; i < 8; i++) enc_input[i+plain_lc] = des_out[i];
enc_input[plain_lc+8] = 0x80; /* iso padding */
@@ -470,7 +470,7 @@ static int cardos_sm4h(const unsigned char *in, size_t inlen, unsigned char
/* xor data and IV (8 bytes 00) to get input data */
for (i=0; i < 8; i++) des_in[i] = enc_input[i] ^ 00;
-
+
/* encrypt with des2 (tripple des, but using keys A-B-A) */
DES_ecb2_encrypt(&des_in, &des_out, &ks_a, &ks_b, 1);
@@ -481,7 +481,7 @@ static int cardos_sm4h(const unsigned char *in, size_t inlen, unsigned char
for (j=1; j < (enc_input_len / 8); j++) {
/* xor data and prev. result to get input data */
for (i=0; i < 8; i++) des_in[i] = enc_input[i+j*8] ^ des_out[i];
-
+
/* encrypt with des2 (tripple des, but using keys A-B-A) */
DES_ecb2_encrypt(&des_in, &des_out, &ks_a, &ks_b, 1);
@@ -506,7 +506,7 @@ static int cardos_format(const char *opt_startkey)
{
unsigned const char startkey[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
sc_apdu_t apdu;
u8 rbuf[256];
int r;
@@ -519,12 +519,12 @@ static int cardos_format(const char *opt_startkey)
/* with "ii" the startkey index as hex number and */
/* "vv" the 16 byte value in hex (32 chars) */
}
-
+
if (verbose) {
printf ("StartKey:\n");
util_hex_dump_asc(stdout, startkey, 16, -1);
}
-
+
/* use GET DATA for version - 00 ca 01 82
* returns e.g. c8 09 for 4.2B
*/
@@ -606,7 +606,7 @@ static int cardos_format(const char *opt_startkey)
if (apdu.resp[3] < 5) {
printf("startkey has only %d tries left. to be safe: aborting\n", apdu.resp[3]);
return 1;
- }
+ }
/* first run GET DATA for lifecycle 00 CA 01 83
* returns 34 MANUFACTURING 20 ADMINISTRATION 10 OPERATIONAL
@@ -657,7 +657,7 @@ static int cardos_format(const char *opt_startkey)
/* we should handle ERASE IN PROGRESS (29) too */
}
-
+
if (apdu.resp[0] == 0x20) {
printf("card in administrative state, ok\n");
goto admin_state;
@@ -722,7 +722,7 @@ static int cardos_format(const char *opt_startkey)
admin_state:
/* use GET DATA for packages - 00 ca 01 88
- * returns e1 LEN MM 04 ID ID ID ID 8f 01 SS
+ * returns e1 LEN MM 04 ID ID ID ID 8f 01 SS
* MM = Manufacturing ID (01 .. 3f = Siemens
* ID ID ID ID = Id of the package
* SS = License state (01 enabled, 00 disabled
@@ -781,7 +781,7 @@ static int cardos_format(const char *opt_startkey)
apdu.lc = rbuf[4];
apdu.data = &rbuf[5];
apdu.datalen = rbuf[4];
-
+
r = sc_transmit_apdu(card, &apdu);
if (r) {
fprintf(stderr, "APDU transmit failed: %s\n",
@@ -796,7 +796,7 @@ static int cardos_format(const char *opt_startkey)
return 1;
}
}
-
+
erase_state:
/* next we need to format the card. Our command is:
@@ -835,7 +835,7 @@ static int cardos_format(const char *opt_startkey)
apdu.lc = rbuf[4];
apdu.data = &rbuf[5];
apdu.datalen = rbuf[4];
-
+
r = sc_transmit_apdu(card, &apdu);
if (r) {
fprintf(stderr, "APDU transmit failed: %s\n",
@@ -877,13 +877,13 @@ static int cardos_change_startkey(const char *change_startkey_apdu)
sc_apdu_t apdu;
u8 rbuf[256];
int r;
-
+
if (verbose) {
printf ("Change StartKey APDU:\n");
util_hex_dump_asc(stdout, (unsigned char *)change_startkey_apdu,
strlen(change_startkey_apdu), -1);
}
-
+
/* use GET DATA for version - 00 ca 01 82
* returns e.g. c8 09 for 4.2B
*/
@@ -967,7 +967,7 @@ static int cardos_change_startkey(const char *change_startkey_apdu)
if (apdu.resp[3] < 5) {
printf("startkey has only %d tries left. to be safe: aborting\n", apdu.resp[3]);
return 1;
- }
+ }
/* now check if the correct APDU was passed */
if (sc_hex_to_bin(change_startkey_apdu, apdu_bin, &apdu_len) != 0) {
@@ -979,17 +979,17 @@ static int cardos_change_startkey(const char *change_startkey_apdu)
if (cardos_version[0] == 0xc8 && cardos_version[1] == 0x08) {
if (memcmp(checksum, cardos_43b_checksum, SHA_DIGEST_LENGTH) != 0) {
printf("change startkey apdu is wrong, checksum doesn't match\n");
- util_hex_dump_asc(stdout, checksum, SHA_DIGEST_LENGTH, -1);
- util_hex_dump_asc(stdout, cardos_43b_checksum, SHA_DIGEST_LENGTH, -1);
+ util_hex_dump_asc(stdout, checksum, SHA_DIGEST_LENGTH, -1);
+ util_hex_dump_asc(stdout, cardos_43b_checksum, SHA_DIGEST_LENGTH, -1);
printf("aborting\n");
return 1;
}
goto change_startkey;
}
-
+
printf("checksum for your card not yet implemented, aborting\n");
return 1;
-
+
change_startkey:
/* run change startkey apdu */
View
64 src/tools/cryptoflex-tool.c
@@ -89,7 +89,7 @@ static char *getpin(const char *prompt)
{
char *buf, pass[20];
int i;
-
+
printf("%s", prompt);
fflush(stdout);
if (fgets(pass, 20, stdin) == NULL)
@@ -116,7 +116,7 @@ static int verify_pin(int pin)
{
char prompt[50];
int r, tries_left = -1;
-
+
if (pincode == NULL) {
sprintf(prompt, "Please enter CHV%d: ", pin);
pincode = (u8 *) getpin(prompt);
@@ -168,15 +168,15 @@ static void invert_buf(u8 *dest, const u8 *src, size_t c)
size_t i;
for (i = 0; i < c; i++)
- dest[i] = src[c-1-i];
+ dest[i] = src[c-1-i];
}
static BIGNUM * cf2bn(const u8 *buf, size_t bufsize, BIGNUM *num)
{
u8 tmp[512];
-
+
invert_buf(tmp, buf, bufsize);
-
+
return BN_bin2bn(tmp, bufsize, num);
}
@@ -189,7 +189,7 @@ static int bn2cf(const BIGNUM *num, u8 *buf)
if (r <= 0)
return r;
invert_buf(buf, tmp, r);
-
+
return r;
}
@@ -198,7 +198,7 @@ static int parse_public_key(const u8 *key, size_t keysize, RSA *rsa)
const u8 *p = key;