lib/hcrypto: mpz2BN return NULL if mp_ubin_size(s) returns zero
commit31d5c3897686a2e2055a2f14acb76fec1f5c6305
authorJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 24 Jan 2022 15:14:17 +0000 (24 10:14 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 24 Jan 2022 15:14:17 +0000 (24 10:14 -0500)
tree0610064fb588d9af9878139f628bf80886f58e53
parentd8dcb3f7a4966106145c9cb487b910ef721caa40
lib/hcrypto: mpz2BN return NULL if mp_ubin_size(s) returns zero

If mp_ubin_size(s) returns zero then mp_to_ubin() will fail and
not return MP_OKAY.  If MP_OKAY is not returned, NULL is returned
to the caller of mpz2BN().

This change avoids the unnecessary memory allocation and function
calls.  It also removes a dereference after null warning from
coverity.

Change-Id: I52ff2c166964e41cb4eef1dac637904bf2bf13bf
lib/hcrypto/rsa-ltm.c