Validate PIN before verification

_validate_pin was not being called at all during a PIN verification.

After this tools report correctly when the PIN length is invalid, even on pkcs11 layer.

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
This commit is contained in:
Nuno Goncalves 2017-02-01 11:16:46 +01:00 committed by Frank Morgner
parent 9eb706ba29
commit c6a9201b62
1 changed files with 4 additions and 0 deletions

View File

@ -295,6 +295,10 @@ sc_pkcs15_verify_pin(struct sc_pkcs15_card *p15card, struct sc_pkcs15_object *pi
LOG_FUNC_CALLED(ctx);
r = _validate_pin(p15card, (struct sc_pkcs15_auth_info *)pin_obj->data, pinlen);
if (r)
LOG_FUNC_RETURN(ctx, r);
r = _sc_pkcs15_verify_pin(p15card, pin_obj, pincode, pinlen);
if (r == SC_SUCCESS)
sc_pkcs15_pincache_add(p15card, pin_obj, pincode, pinlen);