cesa.c (c03414326909ed7a740be3ba63fbbef01fe513a8) cesa.c (29fe41ddd714bae92a09fd4098fad614945bedf5)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (C) 2009-2011 Semihalf.
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

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

1786
1787 /* Prepare request */
1788 cr->cr_crp = crp;
1789 cr->cr_cs = cs;
1790
1791 CESA_LOCK(sc, sessions);
1792 cesa_sync_desc(sc, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
1793
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (C) 2009-2011 Semihalf.
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

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

1786
1787 /* Prepare request */
1788 cr->cr_crp = crp;
1789 cr->cr_cs = cs;
1790
1791 CESA_LOCK(sc, sessions);
1792 cesa_sync_desc(sc, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
1793
1794 if (csp->csp_cipher_alg != 0) {
1795 if (crp->crp_flags & CRYPTO_F_IV_GENERATE) {
1796 arc4rand(cr->cr_csd->csd_iv, csp->csp_ivlen, 0);
1797 crypto_copyback(crp, crp->crp_iv_start, csp->csp_ivlen,
1798 cr->cr_csd->csd_iv);
1799 } else if (crp->crp_flags & CRYPTO_F_IV_SEPARATE)
1800 memcpy(cr->cr_csd->csd_iv, crp->crp_iv, csp->csp_ivlen);
1801 else
1802 crypto_copydata(crp, crp->crp_iv_start, csp->csp_ivlen,
1803 cr->cr_csd->csd_iv);
1804 }
1794 if (csp->csp_cipher_alg != 0)
1795 crypto_read_iv(crp, cr->cr_csd->csd_iv);
1805
1806 if (crp->crp_cipher_key != NULL) {
1807 memcpy(cs->cs_key, crp->crp_cipher_key,
1808 csp->csp_cipher_klen);
1809 if (csp->csp_cipher_alg == CRYPTO_AES_CBC)
1810 error = cesa_prep_aes_key(cs, csp);
1811 }
1812

--- 30 unchanged lines hidden ---
1796
1797 if (crp->crp_cipher_key != NULL) {
1798 memcpy(cs->cs_key, crp->crp_cipher_key,
1799 csp->csp_cipher_klen);
1800 if (csp->csp_cipher_alg == CRYPTO_AES_CBC)
1801 error = cesa_prep_aes_key(cs, csp);
1802 }
1803

--- 30 unchanged lines hidden ---