Commit e05b311
smb: client: Use HMAC-SHA256 library for SMB2 signature calculation
Convert smb2_calc_signature() to use the HMAC-SHA256 library instead of
a "hmac(sha256)" crypto_shash. This is simpler and faster. With the
library there's no need to allocate memory, no need to handle errors,
and the HMAC-SHA256 code is accessed directly without inefficient
indirect calls and other unnecessary API overhead.
To make this possible, make __cifs_calc_signature() support both the
HMAC-SHA256 library and crypto_shash. (crypto_shash is still needed for
HMAC-MD5 and AES-CMAC. A later commit will switch HMAC-MD5 from shash
to the library. I'd like to eventually do the same for AES-CMAC, but it
doesn't have a library API yet. So for now, shash is still needed.)
Also remove the unnecessary 'sigptr' variable.
For now smb3_crypto_shash_allocate() still allocates a "hmac(sha256)"
crypto_shash. It will be removed in a later commit.
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>1 parent 4b4c6fd commit e05b311
3 files changed
Lines changed: 53 additions & 61 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | | - | |
29 | | - | |
| 29 | + | |
| 30 | + | |
30 | 31 | | |
31 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
32 | 52 | | |
33 | 53 | | |
34 | | - | |
| 54 | + | |
35 | 55 | | |
36 | 56 | | |
37 | 57 | | |
| |||
42 | 62 | | |
43 | 63 | | |
44 | 64 | | |
45 | | - | |
46 | | - | |
| 65 | + | |
| 66 | + | |
47 | 67 | | |
48 | 68 | | |
49 | 69 | | |
50 | 70 | | |
51 | | - | |
52 | | - | |
| 71 | + | |
| 72 | + | |
53 | 73 | | |
54 | 74 | | |
55 | 75 | | |
56 | 76 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 77 | + | |
| 78 | + | |
60 | 79 | | |
61 | 80 | | |
62 | 81 | | |
| |||
82 | 101 | | |
83 | 102 | | |
84 | 103 | | |
85 | | - | |
86 | | - | |
| 104 | + | |
87 | 105 | | |
88 | 106 | | |
89 | 107 | | |
90 | 108 | | |
91 | 109 | | |
92 | 110 | | |
93 | 111 | | |
94 | | - | |
| 112 | + | |
95 | 113 | | |
96 | 114 | | |
97 | 115 | | |
98 | | - | |
| 116 | + | |
99 | 117 | | |
100 | 118 | | |
101 | 119 | | |
| |||
134 | 152 | | |
135 | 153 | | |
136 | 154 | | |
137 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
138 | 158 | | |
139 | 159 | | |
140 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
635 | | - | |
636 | | - | |
637 | | - | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
638 | 641 | | |
639 | 642 | | |
640 | 643 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
258 | 257 | | |
259 | 258 | | |
260 | | - | |
| 259 | + | |
261 | 260 | | |
262 | 261 | | |
263 | 262 | | |
| |||
272 | 271 | | |
273 | 272 | | |
274 | 273 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| 274 | + | |
299 | 275 | | |
300 | 276 | | |
301 | 277 | | |
| |||
306 | 282 | | |
307 | 283 | | |
308 | 284 | | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 285 | + | |
317 | 286 | | |
318 | 287 | | |
319 | 288 | | |
320 | 289 | | |
321 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
322 | 293 | | |
323 | | - | |
| 294 | + | |
324 | 295 | | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | 296 | | |
329 | 297 | | |
330 | 298 | | |
| |||
542 | 510 | | |
543 | 511 | | |
544 | 512 | | |
545 | | - | |
546 | 513 | | |
547 | 514 | | |
548 | 515 | | |
| |||
603 | 570 | | |
604 | 571 | | |
605 | 572 | | |
606 | | - | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
607 | 576 | | |
608 | | - | |
| 577 | + | |
609 | 578 | | |
610 | 579 | | |
611 | 580 | | |
| |||
0 commit comments