Enhanced integer parsing in OSSL_PARAM_allocate_from_text
authorPetr Gotthard <petr.gotthard@centrum.cz>
Sat, 6 Feb 2021 20:47:20 +0000 (21:47 +0100)
committerRichard Levitte <levitte@openssl.org>
Tue, 9 Feb 2021 10:15:55 +0000 (11:15 +0100)
commit604b86d8d360e36fc2fc0d1611d05bf38699d297
tree5969f02f05293556906af2a19a4a3066b331f8ad
parente60a748a13a244e8b13bacca18bad9bb3505aa90
Enhanced integer parsing in OSSL_PARAM_allocate_from_text

Fixes #14041 and additional bugs discovered by the newly created
tests.

This patch:
 - Introduces support for 0x prefixed integers
 - Fixes parsing of negative integers (negative numbers were
   shifted by -2)
 - Fixes ability to parse maximal unsigned numbers ("too small
   buffer" error used to be reported incorrectly)
 - Fixes a memory leak when OSSL_PARAM_allocate_from_text fails
   leaving a temporary BN allocated

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14093)
crypto/params_from_text.c
doc/man3/OSSL_PARAM_allocate_from_text.pod
test/params_test.c