xnu: Supply random seed.
Now we're able to load kernels up to El Capitan.
This commit is contained in:
parent
e72de13b9e
commit
22aa31bcc3
2 changed files with 32 additions and 2 deletions
|
@ -1685,8 +1685,17 @@ module = {
|
|||
x86 = loader/i386/xnu.c;
|
||||
x86 = loader/xnu.c;
|
||||
|
||||
enable = x86;
|
||||
}
|
||||
/* Code is pretty generic but relies on RNG which
|
||||
is available only on few platforms. It's not a
|
||||
big deal as xnu needs ACPI anyway and we have
|
||||
RNG on all platforms with ACPI.
|
||||
*/
|
||||
enable = i386_multiboot;
|
||||
enable = i386_coreboot;
|
||||
enable = i386_pc;
|
||||
enable = i386_efi;
|
||||
enable = x86_64_efi;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = random;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <grub/i18n.h>
|
||||
#include <grub/bitmap_scale.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/random.h>
|
||||
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
|
@ -577,11 +578,31 @@ static grub_err_t
|
|||
grub_cpu_xnu_fill_devicetree (grub_uint64_t *fsbfreq_out)
|
||||
{
|
||||
struct grub_xnu_devtree_key *efikey;
|
||||
struct grub_xnu_devtree_key *chosenkey;
|
||||
struct grub_xnu_devtree_key *cfgtablekey;
|
||||
struct grub_xnu_devtree_key *curval;
|
||||
struct grub_xnu_devtree_key *runtimesrvkey;
|
||||
struct grub_xnu_devtree_key *platformkey;
|
||||
unsigned i, j;
|
||||
grub_err_t err;
|
||||
|
||||
chosenkey = grub_xnu_create_key (&grub_xnu_devtree_root, "chosen");
|
||||
if (! chosenkey)
|
||||
return grub_errno;
|
||||
|
||||
/* Random seed. */
|
||||
curval = grub_xnu_create_value (&(chosenkey->first_child), "random-seed");
|
||||
if (! curval)
|
||||
return grub_errno;
|
||||
curval->datasize = 64;
|
||||
curval->data = grub_malloc (curval->datasize);
|
||||
if (! curval->data)
|
||||
return grub_errno;
|
||||
/* Our random is not peer-reviewed but xnu uses this seed only for
|
||||
ASLR in kernel. */
|
||||
err = grub_crypto_get_random (curval->data, curval->datasize);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* The value "model". */
|
||||
/* FIXME: may this value be sometimes different? */
|
||||
|
|
Loading…
Reference in a new issue