Switch sign_sig() and sign_setup() to using BN_CTX
authortb <tb@openbsd.org>
Sun, 2 Jul 2023 13:37:09 +0000 (13:37 +0000)
committertb <tb@openbsd.org>
Sun, 2 Jul 2023 13:37:09 +0000 (13:37 +0000)
commit6d4db1e3ad2c188bd584c2c731975dedfb4c6de3
tree23af339b1b1ed11f9ce92d15abd20ef1cceccfb2
parent9cb26fd53e9c5600c2f38ca940e1c400d9a2516e
Switch sign_sig() and sign_setup() to using BN_CTX

Both these functions use a BN_CTX internally to deal with the EC API
that usually requires one. However, they don't actually make use of it.
Get the BIGNUMs from the BN_CTX instead, which simplifies the cleanup.
Also defer allocation of the ECDSA_SIG to the very end. Instead of using
its internal r and s, use two local r and s variables and transfer those
to the ECDSA_SIG on success.

ok beck jsing
lib/libcrypto/ecdsa/ecs_ossl.c