Commit 297ac66
committed
SC: Compute MAC progressively block by block
osdp_compute_mac copies the entire packet buffer into stack to
perform the MAC computation. This implementaion is from LibOSDP's
initial days. Since then it has not been touched and is not an optimal
way to compute the MAC.
With the memory optimization pass, this got flagged up as a serious
stack user. So this patch rewrites the method to compute the MAC
progressively block-by-block.
Since we have a proper unit-test suite to excericise this path, we can
be fairly certain that this code does what it should.
Related-to: #281
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>1 parent e3e0236 commit 297ac66
1 file changed
Lines changed: 35 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
189 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
190 | 191 | | |
191 | 192 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | 193 | | |
198 | 194 | | |
199 | 195 | | |
| |||
202 | 198 | | |
203 | 199 | | |
204 | 200 | | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
210 | 230 | | |
211 | 231 | | |
212 | | - | |
213 | | - | |
214 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
215 | 235 | | |
216 | 236 | | |
217 | 237 | | |
| |||
0 commit comments