padlock.c (188171) | padlock.c (208834) |
---|---|
1/*- 2 * Copyright (c) 2005-2008 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2005-2008 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/crypto/via/padlock.c 188171 2009-02-05 19:30:28Z imp $"); | 28__FBSDID("$FreeBSD: head/sys/crypto/via/padlock.c 208834 2010-06-05 16:00:53Z kib $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/module.h> 34#include <sys/lock.h> 35#include <sys/rwlock.h> 36#include <sys/malloc.h> --- 127 unchanged lines hidden (view full) --- 164} 165 166static int 167padlock_newsession(device_t dev, uint32_t *sidp, struct cryptoini *cri) 168{ 169 struct padlock_softc *sc = device_get_softc(dev); 170 struct padlock_session *ses = NULL; 171 struct cryptoini *encini, *macini; | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/module.h> 34#include <sys/lock.h> 35#include <sys/rwlock.h> 36#include <sys/malloc.h> --- 127 unchanged lines hidden (view full) --- 164} 165 166static int 167padlock_newsession(device_t dev, uint32_t *sidp, struct cryptoini *cri) 168{ 169 struct padlock_softc *sc = device_get_softc(dev); 170 struct padlock_session *ses = NULL; 171 struct cryptoini *encini, *macini; |
172 struct thread *td; |
|
172 int error; 173 174 if (sidp == NULL || cri == NULL) 175 return (EINVAL); 176 177 encini = macini = NULL; 178 for (; cri != NULL; cri = cri->cri_next) { 179 switch (cri->cri_alg) { --- 51 unchanged lines hidden (view full) --- 231 232 error = padlock_cipher_setup(ses, encini); 233 if (error != 0) { 234 padlock_freesession_one(sc, ses, 0); 235 return (error); 236 } 237 238 if (macini != NULL) { | 173 int error; 174 175 if (sidp == NULL || cri == NULL) 176 return (EINVAL); 177 178 encini = macini = NULL; 179 for (; cri != NULL; cri = cri->cri_next) { 180 switch (cri->cri_alg) { --- 51 unchanged lines hidden (view full) --- 232 233 error = padlock_cipher_setup(ses, encini); 234 if (error != 0) { 235 padlock_freesession_one(sc, ses, 0); 236 return (error); 237 } 238 239 if (macini != NULL) { |
239 error = padlock_hash_setup(ses, macini); | 240 td = curthread; 241 error = fpu_kern_enter(td, &ses->ses_fpu_ctx, FPU_KERN_NORMAL); 242 if (error == 0) { 243 error = padlock_hash_setup(ses, macini); 244 fpu_kern_leave(td, &ses->ses_fpu_ctx); 245 } |
240 if (error != 0) { 241 padlock_freesession_one(sc, ses, 0); 242 return (error); 243 } 244 } 245 246 *sidp = ses->ses_id; 247 return (0); --- 163 unchanged lines hidden --- | 246 if (error != 0) { 247 padlock_freesession_one(sc, ses, 0); 248 return (error); 249 } 250 } 251 252 *sidp = ses->ses_id; 253 return (0); --- 163 unchanged lines hidden --- |