Release: 1.2.2
Environment
i686, GNU/Linux, gentoo
Description
When performing a gcry_pk_sign operation, the hash methods are hard coded into the C code in pubkey.c (sexp_data_to_mpi). Thus, if a coder wishes to use another hash (which has been dynamically registered), gcry_pk_sign will return "Invalid Digest Algorithm" as an error.
By using the gcry_md_map_name() call to discover the algorithm type, the same functionality can be retained, but dynamically registered hashes can also be handled.
You can also program round this by pushing the PKCS-1 padding up to the calling program, and using a single MPI "blob" as the data to be signed, but this then violates the library layers - anyway, the blob signing is marked as legacy behaviour in the text.
I've included a small patch to pubkey.c which (I think) changes the behaviour such that it will work with all hashes.
Fix
Patch against 1.2.2 attached