Commit 22d5836
committed
Skip trailing newlines in pin-source files
Text editors usually append '\n' to the last line when saving a text
file. Also 'echo "mypin" > ~/pinfile.txt' appends a newline. It's
therefore likely we encounter PIN files where the PIN is delimited with
'\n'. Currently, PIN validation would fail in such a case since libp11
passes on the newline to PKCS#11 modules as if it was part of the PIN.
We now ignore trailing newlines. There's no specification mandating
this, but since PINs are meant for interactive input it seems safe to
assume PINs will never be allowed to contain a trailing newline.
Further, the pkcs11-provider project is doing the same in their
src/util.c:get_pin_file.
The change is backwards compatible. PIN files without trailing newline
will work as well.1 parent 8b89cad commit 22d5836
1 file changed
+13
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
734 | 734 | | |
735 | 735 | | |
736 | 736 | | |
737 | | - | |
738 | 737 | | |
739 | 738 | | |
740 | 739 | | |
| 740 | + | |
741 | 741 | | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
742 | 754 | | |
743 | 755 | | |
744 | 756 | | |
| |||
0 commit comments