PIV Security Changes

Add return code if "out" is smaller then received data.

Remove extra blanks.
This commit is contained in:
Doug Engert 2018-06-03 14:39:40 -05:00 committed by Jakub Jelen
parent 3e5a9a42c3
commit 384626533e
1 changed files with 4 additions and 4 deletions

View File

@ -2369,15 +2369,15 @@ static int piv_validate_general_authentication(sc_card_t *card,
r = piv_general_io(card, 0x87, real_alg_id, priv->key_ref,
sbuf, p - sbuf, &rbuf, &rbuflen);
if ( r >= 0) {
body = sc_asn1_find_tag(card->ctx, rbuf, rbuflen, 0x7c, &bodylen);
if (r >= 0) {
body = sc_asn1_find_tag(card->ctx, rbuf, rbuflen, 0x7c, &bodylen);
if (body) {
tag = sc_asn1_find_tag(card->ctx, body, bodylen, 0x82, &taglen);
if (tag) {
memcpy(out, tag, taglen);
r = taglen;
}
} else
r = SC_ERROR_INVALID_DATA;
} else
r = SC_ERROR_INVALID_DATA;
}