trim trailing spaces

This commit is contained in:
Steffen Jaeckel 2014-08-26 17:38:45 +02:00
parent b06270645e
commit ddede01d16
2 changed files with 17 additions and 17 deletions

View File

@ -44,9 +44,9 @@ static int qsort_helper(const void *a, const void *b)
{ {
ltc_asn1_list *A = (ltc_asn1_list *)a, *B = (ltc_asn1_list *)b; ltc_asn1_list *A = (ltc_asn1_list *)a, *B = (ltc_asn1_list *)b;
int r; int r;
r = ltc_to_asn1(A->type) - ltc_to_asn1(B->type); r = ltc_to_asn1(A->type) - ltc_to_asn1(B->type);
/* for QSORT the order is UNDEFINED if they are "equal" which means it is NOT DETERMINISTIC. So we force it to be :-) */ /* for QSORT the order is UNDEFINED if they are "equal" which means it is NOT DETERMINISTIC. So we force it to be :-) */
if (r == 0) { if (r == 0) {
/* their order in the original list now determines the position */ /* their order in the original list now determines the position */
@ -54,13 +54,13 @@ static int qsort_helper(const void *a, const void *b)
} else { } else {
return r; return r;
} }
} }
/* /*
Encode a SET type Encode a SET type
@param list The list of items to encode @param list The list of items to encode
@param inlen The number of items in the list @param inlen The number of items in the list
@param out [out] The destination @param out [out] The destination
@param outlen [in/out] The size of the output @param outlen [in/out] The size of the output
@return CRYPT_OK on success @return CRYPT_OK on success
*/ */
@ -70,30 +70,30 @@ int der_encode_set(ltc_asn1_list *list, unsigned long inlen,
ltc_asn1_list *copy; ltc_asn1_list *copy;
unsigned long x; unsigned long x;
int err; int err;
/* make copy of list */ /* make copy of list */
copy = XCALLOC(inlen, sizeof(*copy)); copy = XCALLOC(inlen, sizeof(*copy));
if (copy == NULL) { if (copy == NULL) {
return CRYPT_MEM; return CRYPT_MEM;
} }
/* fill in used member with index so we can fully sort it */ /* fill in used member with index so we can fully sort it */
for (x = 0; x < inlen; x++) { for (x = 0; x < inlen; x++) {
copy[x] = list[x]; copy[x] = list[x];
copy[x].used = x; copy[x].used = x;
} }
/* sort it by the "type" field */ /* sort it by the "type" field */
XQSORT(copy, inlen, sizeof(*copy), &qsort_helper); XQSORT(copy, inlen, sizeof(*copy), &qsort_helper);
/* call der_encode_sequence_ex() */ /* call der_encode_sequence_ex() */
err = der_encode_sequence_ex(copy, inlen, out, outlen, LTC_ASN1_SET); err = der_encode_sequence_ex(copy, inlen, out, outlen, LTC_ASN1_SET);
/* free list */ /* free list */
XFREE(copy); XFREE(copy);
return err; return err;
} }
#endif #endif

View File

@ -40,7 +40,7 @@ int der_decode_teletex_string(const unsigned char *in, unsigned long inlen,
return CRYPT_INVALID_PACKET; return CRYPT_INVALID_PACKET;
} }
/* check for 0x13 */ /* check for 0x14 */
if ((in[0] & 0x1F) != 0x14) { if ((in[0] & 0x1F) != 0x14) {
return CRYPT_INVALID_PACKET; return CRYPT_INVALID_PACKET;
} }
@ -87,7 +87,7 @@ int der_decode_teletex_string(const unsigned char *in, unsigned long inlen,
return CRYPT_OK; return CRYPT_OK;
} }
#endif #endif
/* $Source$ */ /* $Source$ */