Improve robustness and help lint.
* cipher/rsa.c (rsa_encrypt): Check for !DATA. * cipher/md.c (search_oid): Check early for !OID. (md_copy): Use gpg_err_code_from_syserror. Replace chains of if(!err) tests. * cipher/cipher.c (search_oid): Check early for !OID. * src/misc.c (do_printhex): Allow for BUFFER==NULL even with LENGTH>0. * mpi/mpicoder.c (onecompl): Allow for A==NULL to help static analyzers.
The change for md_copy is to help static analyzers which have no idea
that gpg_err_code_from_syserror will never return 0. A gcc attribute
returns_nonzero would be a nice to have.
Some changes are due to the fact the macros like mpi_is_immutable
gracefully handle a NULL arg but a static analyzer the considers that
the function allows for a NULL arg.
- Signed-off-by: Werner Koch <wk@gnupg.org>