Commit e6e19c4
authored
cshake: fix zero padding when data already aligns to block boundary (#834)
When the buffer already aligns with the block boundary, the existing
implementation adds an additional block of zeros to the input. This
occurs when the total length of the function name and customization
string is a multiple of the block size.
This isn't compliant with the "bytepad" algorithm in section 2.3.3 of
[SP 800-185]. If the buffer already aligns with the block boundary,
skip the padding.
[SP 800-185]: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-185.pdf1 parent 70eae76 commit e6e19c4
4 files changed
Lines changed: 7 additions & 2 deletions
File tree
- cshake
- src
- tests
- data
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
Binary file not shown.
Binary file not shown.
0 commit comments