format code
This commit is contained in:
parent
30b3a9a986
commit
d1d9566250
@ -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 */
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user