Skip to content

Commit

Permalink
Increase user password buffer in IsAESSupported command
Browse files Browse the repository at this point in the history
The IsAESSupported command struct has a 20 byte buffer size for storing
the user password. That is in contrast to, say, the EnablePasswordSafe
struct which uses a 30 byte buffer. Such a smaller buffer can cause
string length errors to be emitted for a legitimate user PIN as has been
found as part of the investigation for d-e-s-o/nitrocli#85. That is, the
nitrokey allows for setting a user PIN of 21 characters. Retrieving an
OTP using such a PIN works fine, whereas inquiring the PWS status does
not, as it first tries to cram the supplied password into 20 characters,
which fails.
This change increases the buffer size in the IsAESSupported command
struct to 30 bytes.
  • Loading branch information
d-e-s-o committed May 27, 2019
1 parent 4a0da78 commit 9072748
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libnitrokey/stick10_commands.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2018 Nitrokey UG
* Copyright (c) 2015-2019 Nitrokey UG
*
* This file is part of libnitrokey.
*
Expand Down Expand Up @@ -815,7 +815,7 @@ class ChangeUserPin : Command<CommandID::CHANGE_USER_PIN> {
class IsAESSupported : Command<CommandID::DETECT_SC_AES> {
public:
struct CommandPayload {
uint8_t user_password[20];
uint8_t user_password[30];
std::string dissect() const {
std::stringstream ss;
print_to_ss_volatile(user_password);
Expand Down

0 comments on commit 9072748

Please sign in to comment.