| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: crypto.c,v 1.52 2017/04/05 08:51:04 knakahara Exp $ */ | | 1 | /* $NetBSD: crypto.c,v 1.53 2017/04/06 09:39:12 knakahara Exp $ */ |
2 | /* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $ */ | | 2 | /* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $ */ |
3 | /* $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */ | | 3 | /* $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */ |
4 | | | 4 | |
5 | /*- | | 5 | /*- |
6 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 6 | * Copyright (c) 2008 The NetBSD Foundation, Inc. |
7 | * All rights reserved. | | 7 | * All rights reserved. |
8 | * | | 8 | * |
9 | * This code is derived from software contributed to The NetBSD Foundation | | 9 | * This code is derived from software contributed to The NetBSD Foundation |
10 | * by Coyote Point Systems, Inc. | | 10 | * by Coyote Point Systems, Inc. |
11 | * | | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | | 12 | * Redistribution and use in source and binary forms, with or without |
13 | * modification, are permitted provided that the following conditions | | 13 | * modification, are permitted provided that the following conditions |
14 | * are met: | | 14 | * are met: |
| @@ -43,27 +43,27 @@ | | | @@ -43,27 +43,27 @@ |
43 | * Permission to use, copy, and modify this software with or without fee | | 43 | * Permission to use, copy, and modify this software with or without fee |
44 | * is hereby granted, provided that this entire notice is included in | | 44 | * is hereby granted, provided that this entire notice is included in |
45 | * all source code copies of any software which is or includes a copy or | | 45 | * all source code copies of any software which is or includes a copy or |
46 | * modification of this software. | | 46 | * modification of this software. |
47 | * | | 47 | * |
48 | * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR | | 48 | * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR |
49 | * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY | | 49 | * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY |
50 | * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE | | 50 | * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE |
51 | * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR | | 51 | * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR |
52 | * PURPOSE. | | 52 | * PURPOSE. |
53 | */ | | 53 | */ |
54 | | | 54 | |
55 | #include <sys/cdefs.h> | | 55 | #include <sys/cdefs.h> |
56 | __KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.52 2017/04/05 08:51:04 knakahara Exp $"); | | 56 | __KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.53 2017/04/06 09:39:12 knakahara Exp $"); |
57 | | | 57 | |
58 | #include <sys/param.h> | | 58 | #include <sys/param.h> |
59 | #include <sys/reboot.h> | | 59 | #include <sys/reboot.h> |
60 | #include <sys/systm.h> | | 60 | #include <sys/systm.h> |
61 | #include <sys/malloc.h> | | 61 | #include <sys/malloc.h> |
62 | #include <sys/proc.h> | | 62 | #include <sys/proc.h> |
63 | #include <sys/pool.h> | | 63 | #include <sys/pool.h> |
64 | #include <sys/kthread.h> | | 64 | #include <sys/kthread.h> |
65 | #include <sys/once.h> | | 65 | #include <sys/once.h> |
66 | #include <sys/sysctl.h> | | 66 | #include <sys/sysctl.h> |
67 | #include <sys/intr.h> | | 67 | #include <sys/intr.h> |
68 | #include <sys/errno.h> | | 68 | #include <sys/errno.h> |
69 | #include <sys/module.h> | | 69 | #include <sys/module.h> |
| @@ -410,27 +410,27 @@ crypto_newsession(u_int64_t *sid, struct | | | @@ -410,27 +410,27 @@ crypto_newsession(u_int64_t *sid, struct |
410 | */ | | 410 | */ |
411 | | | 411 | |
412 | /* Call the driver initialization routine. */ | | 412 | /* Call the driver initialization routine. */ |
413 | lid = hid; /* Pass the driver ID. */ | | 413 | lid = hid; /* Pass the driver ID. */ |
414 | err = crypto_drivers[hid].cc_newsession( | | 414 | err = crypto_drivers[hid].cc_newsession( |
415 | crypto_drivers[hid].cc_arg, &lid, cri); | | 415 | crypto_drivers[hid].cc_arg, &lid, cri); |
416 | if (err == 0) { | | 416 | if (err == 0) { |
417 | (*sid) = hid; | | 417 | (*sid) = hid; |
418 | (*sid) <<= 32; | | 418 | (*sid) <<= 32; |
419 | (*sid) |= (lid & 0xffffffff); | | 419 | (*sid) |= (lid & 0xffffffff); |
420 | crypto_drivers[hid].cc_sessions++; | | 420 | crypto_drivers[hid].cc_sessions++; |
421 | } else { | | 421 | } else { |
422 | DPRINTF(("%s: crypto_drivers[%d].cc_newsession() failed. error=%d\n", | | 422 | DPRINTF(("%s: crypto_drivers[%d].cc_newsession() failed. error=%d\n", |
423 | __func__, hid, error)); | | 423 | __func__, hid, err)); |
424 | } | | 424 | } |
425 | goto done; | | 425 | goto done; |
426 | /*break;*/ | | 426 | /*break;*/ |
427 | } | | 427 | } |
428 | } | | 428 | } |
429 | done: | | 429 | done: |
430 | mutex_exit(&crypto_mtx); | | 430 | mutex_exit(&crypto_mtx); |
431 | return err; | | 431 | return err; |
432 | } | | 432 | } |
433 | | | 433 | |
434 | /* | | 434 | /* |
435 | * Delete an existing session (or a reserved session on an unregistered | | 435 | * Delete an existing session (or a reserved session on an unregistered |
436 | * driver). Must be called with crypto_mtx mutex held. | | 436 | * driver). Must be called with crypto_mtx mutex held. |