padlock_hash.c (192883) | padlock_hash.c (208834) |
---|---|
1/*- 2 * Copyright (c) 2006 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) 2006 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_hash.c 192883 2009-05-27 09:52:12Z vanhu $"); | 28__FBSDID("$FreeBSD: head/sys/crypto/via/padlock_hash.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/malloc.h> 35#include <sys/libkern.h> 36#include <sys/endian.h> | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/module.h> 34#include <sys/malloc.h> 35#include <sys/libkern.h> 36#include <sys/endian.h> |
37#include <sys/pcpu.h> |
|
37#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) 38#include <machine/cpufunc.h> 39#include <machine/cputypes.h> 40#include <machine/md_var.h> 41#include <machine/specialreg.h> 42#endif | 38#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) 39#include <machine/cpufunc.h> 40#include <machine/cputypes.h> 41#include <machine/md_var.h> 42#include <machine/specialreg.h> 43#endif |
44#include <machine/pcb.h> |
|
43 44#include <opencrypto/cryptodev.h> 45#include <opencrypto/cryptosoft.h> /* for hmac_ipad_buffer and hmac_opad_buffer */ 46#include <opencrypto/xform.h> 47 48#include <crypto/via/padlock.h> 49 50/* --- 307 unchanged lines hidden (view full) --- 358 } 359 return (0); 360} 361 362int 363padlock_hash_process(struct padlock_session *ses, struct cryptodesc *maccrd, 364 struct cryptop *crp) 365{ | 45 46#include <opencrypto/cryptodev.h> 47#include <opencrypto/cryptosoft.h> /* for hmac_ipad_buffer and hmac_opad_buffer */ 48#include <opencrypto/xform.h> 49 50#include <crypto/via/padlock.h> 51 52/* --- 307 unchanged lines hidden (view full) --- 360 } 361 return (0); 362} 363 364int 365padlock_hash_process(struct padlock_session *ses, struct cryptodesc *maccrd, 366 struct cryptop *crp) 367{ |
368 struct thread *td; |
|
366 int error; 367 | 369 int error; 370 |
371 td = curthread; 372 error = fpu_kern_enter(td, &ses->ses_fpu_ctx, FPU_KERN_NORMAL); 373 if (error != 0) 374 return (error); |
|
368 if ((maccrd->crd_flags & CRD_F_KEY_EXPLICIT) != 0) 369 padlock_hash_key_setup(ses, maccrd->crd_key, maccrd->crd_klen); 370 371 error = padlock_authcompute(ses, maccrd, crp->crp_buf, crp->crp_flags); | 375 if ((maccrd->crd_flags & CRD_F_KEY_EXPLICIT) != 0) 376 padlock_hash_key_setup(ses, maccrd->crd_key, maccrd->crd_klen); 377 378 error = padlock_authcompute(ses, maccrd, crp->crp_buf, crp->crp_flags); |
379 fpu_kern_leave(td, &ses->ses_fpu_ctx); |
|
372 return (error); 373} 374 375void 376padlock_hash_free(struct padlock_session *ses) 377{ 378 379 if (ses->ses_ictx != NULL) { --- 12 unchanged lines hidden --- | 380 return (error); 381} 382 383void 384padlock_hash_free(struct padlock_session *ses) 385{ 386 387 if (ses->ses_ictx != NULL) { --- 12 unchanged lines hidden --- |