I noticed a few small typos, documentation inconsistencies, and formatting issues.
These are all minor cleanup items, but fixing them would improve consistency and readability:
ltc_pkcs_1_pss_encode_mgf1.c:72: remove the unnecessary blank line
hmac_init.c:67: remove extra spaces
hash_memory.c: hash_descriptor[hash].hashsize is accessed multiple times. It could be stored in a local variable (like in hmac_done.c) after validating the hash, and then reused throughout the function:
unsigned long hashsize;
/* ... */
if ((err = hash_is_valid(hash)) != CRYPT_OK) {
return err;
}
hashsize = hash_descriptor[hash].hashsize;
der_decode_choice.c:111+112: align the calculation lines
der_decode_integer.c:75: remove the unnecessary blank line
der_decode_short_integer.c:62: remove the unnecessary blank line
der_decode_utctime.c:74-81: align the comment
der_decode_generalizedtime.c:91-98: align the comment
s_der_decode_sequence_flexi.c: The XMALLOC, XCALLOC and XREALLOC calls use a code style that differs from the rest of the codebase. I would prefer to write them as separate assignment and NULL-check statements, for example:
l->data = XMALLOC(len);
if(l->data == NULL) {
err = CRYPT_MEM;
goto error;
}
instead of:
if ((l->data = XMALLOC(len)) == NULL) {
err = CRYPT_MEM;
goto error;
}
I noticed a few small typos, documentation inconsistencies, and formatting issues.
These are all minor cleanup items, but fixing them would improve consistency and readability:
ltc_pkcs_1_pss_encode_mgf1.c:72: remove the unnecessary blank linehmac_init.c:67: remove extra spaceshash_memory.c:hash_descriptor[hash].hashsizeis accessed multiple times. It could be stored in a local variable (like inhmac_done.c) after validating the hash, and then reused throughout the function:der_decode_choice.c:111+112: align the calculation linesder_decode_integer.c:75: remove the unnecessary blank lineder_decode_short_integer.c:62: remove the unnecessary blank lineder_decode_utctime.c:74-81: align the commentder_decode_generalizedtime.c:91-98: align the comments_der_decode_sequence_flexi.c: TheXMALLOC,XCALLOCandXREALLOCcalls use a code style that differs from the rest of the codebase. I would prefer to write them as separate assignment and NULL-check statements, for example:instead of: