mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 07:15:58 +08:00
Update to FreeBSD head 2017-04-04
Git mirror commit 642b174daddbd0efd9bb5f242c43f4ab4db6869f.
This commit is contained in:
@@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/eventhandler.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kthread.h>
|
||||
#include <sys/linker.h>
|
||||
#include <rtems/bsd/sys/lock.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
@@ -76,6 +77,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <ddb/ddb.h>
|
||||
|
||||
#include <vm/uma.h>
|
||||
#include <crypto/intake.h>
|
||||
#include <opencrypto/cryptodev.h>
|
||||
#include <opencrypto/xform.h> /* XXX for M_XDATA */
|
||||
|
||||
@@ -188,6 +190,37 @@ SYSCTL_INT(_debug, OID_AUTO, crypto_timing, CTLFLAG_RW,
|
||||
&crypto_timing, 0, "Enable/disable crypto timing support");
|
||||
#endif
|
||||
|
||||
/* Try to avoid directly exposing the key buffer as a symbol */
|
||||
static struct keybuf *keybuf;
|
||||
|
||||
static struct keybuf empty_keybuf = {
|
||||
.kb_nents = 0
|
||||
};
|
||||
|
||||
/* Obtain the key buffer from boot metadata */
|
||||
static void
|
||||
keybuf_init(void)
|
||||
{
|
||||
caddr_t kmdp;
|
||||
|
||||
kmdp = preload_search_by_type("elf kernel");
|
||||
|
||||
if (kmdp == NULL)
|
||||
kmdp = preload_search_by_type("elf64 kernel");
|
||||
|
||||
keybuf = (struct keybuf *)preload_search_info(kmdp,
|
||||
MODINFO_METADATA | MODINFOMD_KEYBUF);
|
||||
|
||||
if (keybuf == NULL)
|
||||
keybuf = &empty_keybuf;
|
||||
}
|
||||
|
||||
/* It'd be nice if we could store these in some kind of secure memory... */
|
||||
struct keybuf * get_keybuf(void) {
|
||||
|
||||
return (keybuf);
|
||||
}
|
||||
|
||||
static int
|
||||
crypto_init(void)
|
||||
{
|
||||
@@ -240,6 +273,9 @@ crypto_init(void)
|
||||
error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
keybuf_init();
|
||||
|
||||
return 0;
|
||||
bad:
|
||||
crypto_destroy();
|
||||
@@ -289,7 +325,7 @@ crypto_destroy(void)
|
||||
|
||||
/* XXX flush queues??? */
|
||||
|
||||
/*
|
||||
/*
|
||||
* Reclaim dynamically allocated resources.
|
||||
*/
|
||||
if (crypto_drivers != NULL)
|
||||
|
Reference in New Issue
Block a user