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:
Tobias Brunner
2026-07-24 08:47:39 +02:00
parent 322d947a04
commit 0ffc3f3fd6
@@ -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;
}