- Fixed a bug in sc_pkcs15init_bind()

- Added PIN code padding in do_verify_pin()


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@461 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
jey 2002-04-05 14:00:27 +00:00
parent 3938287c71
commit 41b184855b
1 changed files with 10 additions and 1 deletions

View File

@ -141,6 +141,7 @@ sc_pkcs15init_bind(struct sc_card *card, const char *name,
|| (r = sc_profile_load(profile, driver)) < 0
|| (r = sc_profile_finish(profile)) < 0)
sc_profile_free(profile);
*result = profile;
return r;
}
@ -837,8 +838,16 @@ do_verify_pin(struct sc_profile *pro, struct sc_card *card,
sc_profile_set_secret(pro, SC_AC_SYMBOLIC, pin_id,
pinbuf, pinsize);
}
if (r >= 0) {
if (type == SC_AC_CHV) {
int left = pro->pin_maxlen - pinsize;
if (left > 0) {
memset(pinbuf + pinsize, pro->pin_pad_char,
left);
pinsize = pro->pin_maxlen;
}
}
r = sc_verify(card, type, reference, pinbuf, pinsize, NULL);
if (r) {
p15init_error("Failed to verify %s (ref=0x%x)",