| 256 | } |
| 257 | |
| 258 | static void |
| 259 | padlock_hash_key_setup(struct padlock_session *ses, const uint8_t *key, |
| 260 | int klen) |
| 261 | { |
| 262 | struct auth_hash *axf; |
| 263 | |
| 264 | axf = ses->ses_axf; |
| 265 | |
| 266 | /* |
| 267 | * Try to free contexts before using them, because |
| 268 | * padlock_hash_key_setup() can be called twice - once from |
| 269 | * padlock_newsession() and again from padlock_process(). |
| 270 | */ |
| 271 | padlock_free_ctx(axf, ses->ses_ictx); |
| 272 | padlock_free_ctx(axf, ses->ses_octx); |
| 273 | |
| 274 | hmac_init_ipad(axf, key, klen, ses->ses_ictx); |
| 275 | hmac_init_opad(axf, key, klen, ses->ses_octx); |
| 276 | } |
| 277 | |
| 278 | /* |
| 279 | * Compute keyed-hash authenticator. |
no test coverage detected