OpenSC/OpenSC — pull request #273 by consp (2014-08-15 09:58:35+00:00)
Title: Fixed error in padding for pkcs15, it would fail due to incorrect flags.

The file pkcs15-sec contains (probably) a simple error:
On line 450 the pkcs1 encoding function is called with pad_flags, while the
pkcs1_encode function also requires information about the hashing algorithm. Using
the pad_flags variable instead of the flags variable results in an error when
a specific hash function is specified by for instance the command
"pkcs11-tool --module opensc-pkcs11.so -s -m SHA256-RSA-PKCS -l -i test.dat".

Switching to 'flags' instead of 'pad_flags' provides the information required.

Another option would be to include the algo->flags in the call but since the entire flags uint is bitwise encoded it should not be a problem.