Skip to content

Commit

Permalink
Fix checking in_len when signing
Browse files Browse the repository at this point in the history
  • Loading branch information
aveenismail committed Jan 29, 2024
1 parent 31d4580 commit e96e08f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/ykpiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1228,8 +1228,6 @@ static ykpiv_rc _general_authenticate(ykpiv_state *state,
}
break;
case YKPIV_ALGO_ECCP256:
case YKPIV_ALGO_ED25519:
case YKPIV_ALGO_X25519:
key_len = 32;
// fall through
case YKPIV_ALGO_ECCP384:
Expand All @@ -1243,6 +1241,16 @@ static ykpiv_rc _general_authenticate(ykpiv_state *state,
return YKPIV_SIZE_ERROR;
}
break;
case YKPIV_ALGO_X25519:
if(in_len != 32) {
return YKPIV_SIZE_ERROR;
}
break;
case YKPIV_ALGO_ED25519:
if(in_len > CB_BUF_MAX) {
return YKPIV_SIZE_ERROR;
}
break;
default:
return YKPIV_ALGORITHM_ERROR;
}
Expand Down

0 comments on commit e96e08f

Please sign in to comment.