pubkey.c (meth__pss_encode): Fix the buffer allocation. 1.2.x
authorMark Wooding <mdw@distorted.org.uk>
Wed, 7 Jun 2023 08:28:46 +0000 (09:28 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 7 Jun 2023 08:41:18 +0000 (09:41 +0100)
commita5863770535658d7ead0489ee07fe2795f25f2b7
treeb89833892bc2d64cdb6898a569990104e480f188
parentf10533df6218917d3b97fbdef3b54b0fd5455200
pubkey.c (meth__pss_encode): Fix the buffer allocation.

The code overestimated the buffer length by one bit, which would be fine
except that it then uses the buffer estimate to validate the requested
salt length, which permits an overly large salt when NBITS == 1 (mod 8).
The underlying logic doesn't get this wrong, and returns a null pointer
as a rejection, which causes a later segfault.

Fix and add tests.
pubkey.c
t/t-pubkey.py