-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does hex_string_to_byte require an even number of characters? #164
Comments
Hi! Sorry for the late reply! The assumption is, that the user input validation and correction is done at the client application, which is further the caller for the libnitrokey. It comes from the reasoning, that library should be limited to only one task and to do it good, which is in this case handling the behavior of multiple devices' models, with different firmware versions. Here the validation is only in the assert mode, to make sure the hex->bin converting code (which is as simple as possible) is working in the laid assumptions of the input data. Additionally when starting the data correction on the library side, it is hard to say what user wanted. It is true the This is especially true while it can be fixed easily, as you have mentioned. I am sorry it was missed from the documentation - this is indeed unwelcomed. I plan to work on the docs with the nearest release. Closing, for me it is |
BTW feel free to ping me, when needed. I remembered to respond to that, but had to take down some other tasks first. |
libnitrokey issue #164 (Nitrokey/libnitrokey#164) has been closed so the TODO we still have in the code is effectively dangling. Hence, this change removes it.
libnitrokey issue #164 (Nitrokey/libnitrokey#164) has been closed so the TODO we still have in the code is effectively dangling. Hence, this change removes it.
Below is the "head" of the
hex_string_to_byte
function:Can you please clarify why this function imposes a requirement that the provided
hexString
have an even number of characters? Isn't that an unnecessary limitation? Why wouldace
, for example, not be valid? Isn't it well defined that0xa == 0x0a
? Can we please adjust this function to be more friendly to user input?This restriction is causing issues with input to
nitrocli
, which invokeswrite_OTP_slot_no_authorize
as part of theotp set
command which in turn useshex_string_to_byte
internally.The text was updated successfully, but these errors were encountered: