Make the management of pinentry.pin more explicit.
authorNeal H. Walfield <neal@gnu.org>
Wed, 13 May 2015 11:52:03 +0000 (13:52 +0200)
committerNeal H. Walfield <neal@gnu.org>
Wed, 13 May 2015 12:22:05 +0000 (14:22 +0200)
commitbdd81974633f8e31d582b62999ef9b004bc3b95e
tree24940d7e028adf6d3f4612dc05b095504303f5f0
parentae7dfae00df81a683adf0292a52b63632491319e
Make the management of pinentry.pin more explicit.

* pinentry/pinentry.c: Include <assert.h>.
(pinentry): Set pin_len to 0.
(pinentry_setbufferlen): If len is less than 2048, set it to 2048.
Add an assertion.
(pinentry_setbuffer_clear): New function that releases the pin buffer.
(pinentry_setbuffer_init): New function that initializes the pin
buffer.
(cmd_getpin): Use pinentry_setbuffer_init and pinentry_setbuffer_clear
instead of manual memory management.
(cmd_confirm): Use pinentry_setbuffer_clear instead of manual memory
management.
pinentry/pinentry.c