From d1d95662505d9d76ecf2aa269c330a7536ee875a Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Sat, 30 Sep 2017 13:36:27 +0200 Subject: [PATCH] format code --- src/pk/asn1/der/bit/der_decode_raw_bit_string.c | 16 ++++++++-------- src/pk/asn1/der/bit/der_encode_raw_bit_string.c | 12 ++++++------ .../der_encode_subject_public_key_info.c | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/pk/asn1/der/bit/der_decode_raw_bit_string.c b/src/pk/asn1/der/bit/der_decode_raw_bit_string.c index f40d6e1..400f240 100644 --- a/src/pk/asn1/der/bit/der_decode_raw_bit_string.c +++ b/src/pk/asn1/der/bit/der_decode_raw_bit_string.c @@ -85,14 +85,14 @@ int der_decode_raw_bit_string(const unsigned char *in, unsigned long inlen, /* decode/store the bits */ for (y = 0; y < blen; y++) { - if (in[x] & (1 << (7 - (y & 7)))) { - SETBIT(out[y/8], 7-(y%8)); - } else { - CLRBIT(out[y/8], 7-(y%8)); - } - if ((y & 7) == 7) { - ++x; - } + if (in[x] & (1 << (7 - (y & 7)))) { + SETBIT(out[y/8], 7-(y%8)); + } else { + CLRBIT(out[y/8], 7-(y%8)); + } + if ((y & 7) == 7) { + ++x; + } } /* we done */ diff --git a/src/pk/asn1/der/bit/der_encode_raw_bit_string.c b/src/pk/asn1/der/bit/der_encode_raw_bit_string.c index 7e29d8c..298c4e3 100644 --- a/src/pk/asn1/der/bit/der_encode_raw_bit_string.c +++ b/src/pk/asn1/der/bit/der_encode_raw_bit_string.c @@ -21,7 +21,7 @@ /** Store a BIT STRING @param in The array of bits to store (8 per char) - @param inlen The number of bits tostore + @param inlen The number of bits to store @param out [out] The destination for the DER encoded BIT STRING @param outlen [in/out] The max size and resulting size of the DER BIT STRING @return CRYPT_OK if successful @@ -68,11 +68,11 @@ int der_encode_raw_bit_string(const unsigned char *in, unsigned long inlen, /* store the bits in big endian format */ for (y = buf = 0; y < inlen; y++) { - buf |= (getbit(in[y/8],7-y%8)?1:0) << (7 - (y & 7)); - if ((y & 7) == 7) { - out[x++] = buf; - buf = 0; - } + buf |= (getbit(in[y/8],7-y%8)?1:0) << (7 - (y & 7)); + if ((y & 7) == 7) { + out[x++] = buf; + buf = 0; + } } /* store last byte */ if (inlen & 7) { diff --git a/src/pk/asn1/der/sequence/der_encode_subject_public_key_info.c b/src/pk/asn1/der/sequence/der_encode_subject_public_key_info.c index 2ce8bd1..dcb869a 100644 --- a/src/pk/asn1/der/sequence/der_encode_subject_public_key_info.c +++ b/src/pk/asn1/der/sequence/der_encode_subject_public_key_info.c @@ -58,7 +58,7 @@ int der_encode_subject_public_key_info(unsigned char *out, unsigned long *outlen return der_encode_sequence_multi(out, outlen, LTC_ASN1_SEQUENCE, (unsigned long)sizeof(alg_id)/sizeof(alg_id[0]), alg_id, - LTC_ASN1_RAW_BIT_STRING, (unsigned long)(public_key_len*8), public_key, + LTC_ASN1_RAW_BIT_STRING, public_key_len*8U, public_key, LTC_ASN1_EOL, 0UL, NULL); }