sec.c (c03414326909ed7a740be3ba63fbbef01fe513a8) sec.c (29fe41ddd714bae92a09fd4098fad614945bedf5)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (C) 2008-2009 Semihalf, Piotr Ziecik
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 1271 unchanged lines hidden (view full) ---

1280 }
1281
1282 /* Prepare descriptor */
1283 desc = SEC_GET_FREE_DESC(sc);
1284 desc->sd_lt_used = 0;
1285 desc->sd_error = 0;
1286 desc->sd_crp = crp;
1287
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (C) 2008-2009 Semihalf, Piotr Ziecik
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 1271 unchanged lines hidden (view full) ---

1280 }
1281
1282 /* Prepare descriptor */
1283 desc = SEC_GET_FREE_DESC(sc);
1284 desc->sd_lt_used = 0;
1285 desc->sd_error = 0;
1286 desc->sd_crp = crp;
1287
1288 if (csp->csp_cipher_alg != 0) {
1289 if (crp->crp_flags & CRYPTO_F_IV_GENERATE) {
1290 arc4rand(desc->sd_desc->shd_iv, csp->csp_ivlen, 0);
1291 crypto_copyback(crp, crp->crp_iv_start, csp->csp_ivlen,
1292 desc->sd_desc->shd_iv);
1293 } else if (crp->crp_flags & CRYPTO_F_IV_SEPARATE)
1294 memcpy(desc->sd_desc->shd_iv, crp->crp_iv,
1295 csp->csp_ivlen);
1296 else
1297 crypto_copydata(crp, crp->crp_iv_start, csp->csp_ivlen,
1298 desc->sd_desc->shd_iv);
1299 }
1288 if (csp->csp_cipher_alg != 0)
1289 crypto_read_iv(crp, desc->sd_desc->shd_iv);
1300
1301 if (crp->crp_cipher_key != NULL)
1302 memcpy(ses->ss_key, crp->crp_cipher_key, csp->csp_cipher_klen);
1303
1304 if (crp->crp_auth_key != NULL)
1305 memcpy(ses->ss_mkey, crp->crp_auth_key, csp->csp_auth_klen);
1306
1307 memcpy(desc->sd_desc->shd_key, ses->ss_key, csp->csp_cipher_klen);

--- 364 unchanged lines hidden ---
1290
1291 if (crp->crp_cipher_key != NULL)
1292 memcpy(ses->ss_key, crp->crp_cipher_key, csp->csp_cipher_klen);
1293
1294 if (crp->crp_auth_key != NULL)
1295 memcpy(ses->ss_mkey, crp->crp_auth_key, csp->csp_auth_klen);
1296
1297 memcpy(desc->sd_desc->shd_key, ses->ss_key, csp->csp_cipher_klen);

--- 364 unchanged lines hidden ---