gcrypt: Fix zeroing padding when extracting RSA value from S-expression
When left-padding a value shorter than the RSA key, the code previously
calculated the length incorrectly so that some bytes might have been
cleared if the value was shorter than half the required length.
Fixes: a2f1bb238e ("enforce correct RSA signature lenght in gcrypt")
This commit is contained in:
@@ -78,7 +78,7 @@ chunk_t gcrypt_rsa_find_token(gcry_sexp_t sexp, char *name, gcry_sexp_t key)
|
||||
{
|
||||
tmp = chunk_alloc(len);
|
||||
len -= data.len;
|
||||
memset(tmp.ptr, 0, tmp.len - len);
|
||||
memset(tmp.ptr, 0, len);
|
||||
memcpy(tmp.ptr + len, data.ptr, data.len);
|
||||
data = tmp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user