merge from trunk
This commit is contained in:
commit
7d1468e4b6
243 changed files with 8862 additions and 3935 deletions
|
@ -19,14 +19,6 @@
|
|||
|
||||
#include <config.h>
|
||||
|
||||
#if defined(HAVE_NCURSES_CURSES_H)
|
||||
# include <ncurses/curses.h>
|
||||
#elif defined(HAVE_NCURSES_H)
|
||||
# include <ncurses.h>
|
||||
#elif defined(HAVE_CURSES_H)
|
||||
# include <curses.h>
|
||||
#endif
|
||||
|
||||
/* For compatibility. */
|
||||
#ifndef A_NORMAL
|
||||
# define A_NORMAL 0
|
||||
|
@ -39,6 +31,14 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
#if defined(HAVE_NCURSES_CURSES_H)
|
||||
# include <ncurses/curses.h>
|
||||
#elif defined(HAVE_NCURSES_H)
|
||||
# include <ncurses.h>
|
||||
#elif defined(HAVE_CURSES_H)
|
||||
# include <curses.h>
|
||||
#endif
|
||||
|
||||
static int grub_console_attr = A_NORMAL;
|
||||
|
||||
grub_uint8_t grub_console_cur_color = 7;
|
||||
|
@ -367,8 +367,7 @@ static struct grub_term_output grub_ncurses_term_output =
|
|||
.setcolor = grub_ncurses_setcolor,
|
||||
.getcolor = grub_ncurses_getcolor,
|
||||
.setcursor = grub_ncurses_setcursor,
|
||||
.refresh = grub_ncurses_refresh,
|
||||
.flags = 0,
|
||||
.refresh = grub_ncurses_refresh
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -376,8 +375,6 @@ grub_console_init (void)
|
|||
{
|
||||
grub_term_register_output ("console", &grub_ncurses_term_output);
|
||||
grub_term_register_input ("console", &grub_ncurses_term_input);
|
||||
grub_term_set_current_output (&grub_ncurses_term_output);
|
||||
grub_term_set_current_input (&grub_ncurses_term_input);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -361,9 +361,8 @@ main (int argc, char *argv[])
|
|||
int chrp = 0;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-editenv.c - tool to edit environment block. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -46,9 +46,6 @@ grub_refresh (void)
|
|||
fflush (stdout);
|
||||
}
|
||||
|
||||
struct grub_handler_class grub_term_input_class;
|
||||
struct grub_handler_class grub_term_output_class;
|
||||
|
||||
int
|
||||
grub_getkey (void)
|
||||
{
|
||||
|
@ -256,9 +253,8 @@ main (int argc, char *argv[])
|
|||
char *command;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -159,9 +159,8 @@ main (int argc, char *argv[])
|
|||
int opt;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
while ((opt = getopt_long (argc, argv, "r:d:m:vH:hV", options, 0)) != -1)
|
||||
switch (opt)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-fstest.c - debug tool for filesystem driver */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -384,9 +384,8 @@ main (int argc, char *argv[])
|
|||
int i, cmd, num_opts, image_index, num_disks = 1;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
/* Find the first non option entry. */
|
||||
for (num_opts = 1; num_opts < argc; num_opts++)
|
||||
|
|
|
@ -88,9 +88,11 @@ fi
|
|||
|
||||
INSTALL_DEVICE can be a GRUB device name or a system device filename.
|
||||
|
||||
grub-install copies GRUB images into the DIR/boot directory specified by
|
||||
--root-directory, and uses grub-setup to install grub into the boot
|
||||
sector.
|
||||
grub-install copies GRUB images into /boot/grub (or /grub on NetBSD and
|
||||
OpenBSD), and uses grub-setup to install grub into the boot sector.
|
||||
|
||||
If the --root-directory option is used, then grub-install will copy
|
||||
images into the operating system installation rooted at that directory.
|
||||
|
||||
Report bugs to <bug-grub@gnu.org>.
|
||||
EOF
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-mkdevicemap.c - make a device map file automatically */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -112,9 +112,8 @@ main (int argc, char *argv[])
|
|||
int floppy_disks = 1;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -59,10 +59,12 @@ struct grub_font_info
|
|||
char* name;
|
||||
int style;
|
||||
int desc;
|
||||
int asce;
|
||||
int size;
|
||||
int max_width;
|
||||
int max_height;
|
||||
int min_y;
|
||||
int max_y;
|
||||
int flags;
|
||||
int num_range;
|
||||
grub_uint32_t *ranges;
|
||||
|
@ -77,6 +79,7 @@ static struct option options[] =
|
|||
{"range", required_argument, 0, 'r'},
|
||||
{"size", required_argument, 0, 's'},
|
||||
{"desc", required_argument, 0, 'd'},
|
||||
{"asce", required_argument, 0, 'c'},
|
||||
{"bold", no_argument, 0, 'b'},
|
||||
{"no-bitmap", no_argument, 0, 0x100},
|
||||
{"no-hinting", no_argument, 0, 0x101},
|
||||
|
@ -104,6 +107,7 @@ Usage: %s [OPTIONS] FONT_FILES\n\
|
|||
-n, --name=S set font family name\n\
|
||||
-s, --size=N set font size\n\
|
||||
-d, --desc=N set font descent\n\
|
||||
-c, --asce=N set font ascent\n\
|
||||
-b, --bold convert to bold font\n\
|
||||
-a, --force-autohint force autohint\n\
|
||||
--no-hinting disable hinting\n\
|
||||
|
@ -193,9 +197,12 @@ add_char (struct grub_font_info *font_info, FT_Face face,
|
|||
if (height > font_info->max_height)
|
||||
font_info->max_height = height;
|
||||
|
||||
if (glyph_info->y_ofs < font_info->min_y)
|
||||
if (glyph_info->y_ofs < font_info->min_y && glyph_info->y_ofs > -font_info->size)
|
||||
font_info->min_y = glyph_info->y_ofs;
|
||||
|
||||
if (glyph_info->y_ofs + height > font_info->max_y)
|
||||
font_info->max_y = glyph_info->y_ofs + height;
|
||||
|
||||
mask = 0;
|
||||
data = &glyph_info->bitmap[0] - 1;
|
||||
for (j = 0; j < height; j++)
|
||||
|
@ -284,8 +291,8 @@ print_glyphs (struct grub_font_info *font_info)
|
|||
xmin = 0;
|
||||
|
||||
ymax = glyph->y_ofs + glyph->height;
|
||||
if (ymax < font_info->size - font_info->desc)
|
||||
ymax = font_info->size - font_info->desc;
|
||||
if (ymax < font_info->asce)
|
||||
ymax = font_info->asce;
|
||||
|
||||
ymin = glyph->y_ofs;
|
||||
if (ymin > - font_info->desc)
|
||||
|
@ -316,7 +323,7 @@ print_glyphs (struct grub_font_info *font_info)
|
|||
else if ((x >= 0) &&
|
||||
(x < glyph->device_width) &&
|
||||
(y >= - font_info->desc) &&
|
||||
(y < font_info->size - font_info->desc))
|
||||
(y < font_info->asce))
|
||||
{
|
||||
line[line_pos++] = ((x == 0) || (y == 0)) ? '+' : '.';
|
||||
}
|
||||
|
@ -392,7 +399,15 @@ write_font (struct grub_font_info *font_info, char *output_file)
|
|||
font_info->desc = - font_info->min_y;
|
||||
}
|
||||
|
||||
write_be16_section ("ASCE", font_info->size - font_info->desc, &offset, file);
|
||||
if (! font_info->asce)
|
||||
{
|
||||
if (font_info->max_y <= 0)
|
||||
font_info->asce = 1;
|
||||
else
|
||||
font_info->asce = font_info->max_y;
|
||||
}
|
||||
|
||||
write_be16_section ("ASCE", font_info->asce, &offset, file);
|
||||
write_be16_section ("DESC", font_info->desc, &offset, file);
|
||||
|
||||
if (font_verbosity > 0)
|
||||
|
@ -400,7 +415,7 @@ write_font (struct grub_font_info *font_info, char *output_file)
|
|||
printf ("Font name: %s\n", font_name);
|
||||
printf ("Max width: %d\n", font_info->max_width);
|
||||
printf ("Max height: %d\n", font_info->max_height);
|
||||
printf ("Font ascent: %d\n", font_info->size - font_info->desc);
|
||||
printf ("Font ascent: %d\n", font_info->asce);
|
||||
printf ("Font descent: %d\n", font_info->desc);
|
||||
}
|
||||
|
||||
|
@ -476,9 +491,8 @@ main (int argc, char *argv[])
|
|||
memset (&font_info, 0, sizeof (font_info));
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
@ -561,6 +575,10 @@ main (int argc, char *argv[])
|
|||
font_info.desc = strtoul (optarg, NULL, 0);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
font_info.asce = strtoul (optarg, NULL, 0);
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
usage (0);
|
||||
break;
|
||||
|
|
341
util/grub-mkpasswd-pbkdf2.c
Normal file
341
util/grub-mkpasswd-pbkdf2.c
Normal file
|
@ -0,0 +1,341 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1992-1999,2001,2003,2004,2005,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <termios.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
/* Few functions to make crypto happy. */
|
||||
void *
|
||||
grub_memmove (void *dest, const void *src, grub_size_t n)
|
||||
{
|
||||
return memmove (dest, src, n);
|
||||
}
|
||||
|
||||
void *
|
||||
grub_memset (void *s, int c, grub_size_t n)
|
||||
{
|
||||
return memset (s, c, n);
|
||||
}
|
||||
|
||||
int
|
||||
grub_vprintf (const char *fmt, va_list args)
|
||||
{
|
||||
return vprintf (fmt, args);
|
||||
}
|
||||
|
||||
int
|
||||
grub_vsprintf (char *str, const char *fmt, va_list args)
|
||||
{
|
||||
return vsprintf (str, fmt, args);
|
||||
}
|
||||
|
||||
void
|
||||
grub_abort (void)
|
||||
{
|
||||
abort ();
|
||||
}
|
||||
|
||||
static struct option options[] =
|
||||
{
|
||||
{"iteration_count", required_argument, 0, 'c'},
|
||||
{"buflen", required_argument, 0, 'l'},
|
||||
{"saltlen", required_argument, 0, 's'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
};
|
||||
|
||||
static void
|
||||
usage (int status)
|
||||
{
|
||||
if (status)
|
||||
fprintf (stderr, "Try ``grub-scrypt --help'' for more information.\n");
|
||||
else
|
||||
printf ("\
|
||||
Usage: grub-scrypt [OPTIONS]\n\
|
||||
\nOptions:\n\
|
||||
-c number, --iteration-count=number Number of PBKDF2 iterations\n\
|
||||
-l number, --buflen=number Length of generated hash\n\
|
||||
-s number, --salt=number Length of salt\n\
|
||||
\n\
|
||||
Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
|
||||
|
||||
exit (status);
|
||||
}
|
||||
|
||||
static void
|
||||
hexify (char *hex, grub_uint8_t *bin, grub_size_t n)
|
||||
{
|
||||
while (n--)
|
||||
{
|
||||
if (((*bin & 0xf0) >> 4) < 10)
|
||||
*hex = ((*bin & 0xf0) >> 4) + '0';
|
||||
else
|
||||
*hex = ((*bin & 0xf0) >> 4) + 'A' - 10;
|
||||
hex++;
|
||||
|
||||
if ((*bin & 0xf) < 10)
|
||||
*hex = (*bin & 0xf) + '0';
|
||||
else
|
||||
*hex = (*bin & 0xf) + 'A' - 10;
|
||||
hex++;
|
||||
bin++;
|
||||
}
|
||||
*hex = 0;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
unsigned int c = 10000, buflen = 64, saltlen = 64;
|
||||
char *pass1, *pass2;
|
||||
char *bufhex, *salthex;
|
||||
gcry_err_code_t gcry_err;
|
||||
grub_uint8_t *buf, *salt;
|
||||
ssize_t nr;
|
||||
FILE *in, *out;
|
||||
struct termios s, t;
|
||||
int tty_changed;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
{
|
||||
int c = getopt_long (argc, argv, "c:l:s:hvV", options, 0);
|
||||
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 'c':
|
||||
c = strtoul (optarg, NULL, 0);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
buflen = strtoul (optarg, NULL, 0);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
saltlen = strtoul (optarg, NULL, 0);
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
usage (0);
|
||||
return 0;
|
||||
|
||||
case 'V':
|
||||
printf ("%s (%s) %s\n", program_name,
|
||||
PACKAGE_NAME, PACKAGE_VERSION);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
usage (1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
bufhex = malloc (buflen * 2 + 1);
|
||||
if (!bufhex)
|
||||
grub_util_error ("Out of memory");
|
||||
buf = malloc (buflen);
|
||||
if (!buf)
|
||||
{
|
||||
free (bufhex);
|
||||
grub_util_error ("Out of memory");
|
||||
}
|
||||
|
||||
salt = malloc (saltlen);
|
||||
if (!salt)
|
||||
{
|
||||
free (bufhex);
|
||||
free (buf);
|
||||
grub_util_error ("Out of memory");
|
||||
}
|
||||
salthex = malloc (saltlen * 2 + 1);
|
||||
if (!salthex)
|
||||
{
|
||||
free (salt);
|
||||
free (bufhex);
|
||||
free (buf);
|
||||
grub_util_error ("Out of memory");
|
||||
}
|
||||
|
||||
/* Disable echoing. Based on glibc. */
|
||||
in = fopen ("/dev/tty", "w+c");
|
||||
if (in == NULL)
|
||||
{
|
||||
in = stdin;
|
||||
out = stderr;
|
||||
}
|
||||
else
|
||||
out = in;
|
||||
|
||||
if (tcgetattr (fileno (in), &t) == 0)
|
||||
{
|
||||
/* Save the old one. */
|
||||
s = t;
|
||||
/* Tricky, tricky. */
|
||||
t.c_lflag &= ~(ECHO|ISIG);
|
||||
tty_changed = (tcsetattr (fileno (in), TCSAFLUSH, &t) == 0);
|
||||
}
|
||||
else
|
||||
tty_changed = 0;
|
||||
|
||||
printf ("Enter password: ");
|
||||
pass1 = NULL;
|
||||
{
|
||||
grub_size_t n;
|
||||
nr = getline (&pass1, &n, stdin);
|
||||
}
|
||||
if (nr < 0 || !pass1)
|
||||
{
|
||||
free (buf);
|
||||
free (bufhex);
|
||||
free (salthex);
|
||||
free (salt);
|
||||
/* Restore the original setting. */
|
||||
if (tty_changed)
|
||||
(void) tcsetattr (fileno (in), TCSAFLUSH, &s);
|
||||
grub_util_error ("Failure to read password");
|
||||
}
|
||||
if (nr >= 1 && pass1[nr-1] == '\n')
|
||||
pass1[nr-1] = 0;
|
||||
|
||||
printf ("\nReenter password: ");
|
||||
pass2 = NULL;
|
||||
{
|
||||
grub_size_t n;
|
||||
nr = getline (&pass2, &n, stdin);
|
||||
}
|
||||
/* Restore the original setting. */
|
||||
if (tty_changed)
|
||||
(void) tcsetattr (fileno (in), TCSAFLUSH, &s);
|
||||
printf ("\n");
|
||||
|
||||
if (nr < 0 || !pass2)
|
||||
{
|
||||
memset (pass1, 0, strlen (pass1));
|
||||
free (pass1);
|
||||
free (buf);
|
||||
free (bufhex);
|
||||
free (salthex);
|
||||
free (salt);
|
||||
grub_util_error ("Failure to read password");
|
||||
}
|
||||
if (nr >= 1 && pass2[nr-1] == '\n')
|
||||
pass2[nr-1] = 0;
|
||||
|
||||
if (strcmp (pass1, pass2) != 0)
|
||||
{
|
||||
memset (pass1, 0, strlen (pass1));
|
||||
memset (pass2, 0, strlen (pass2));
|
||||
free (pass1);
|
||||
free (pass2);
|
||||
free (buf);
|
||||
free (bufhex);
|
||||
free (salthex);
|
||||
free (salt);
|
||||
grub_util_error ("Passwords don't match");
|
||||
}
|
||||
memset (pass2, 0, strlen (pass2));
|
||||
free (pass2);
|
||||
|
||||
#if ! defined (__linux__) && ! defined (__FreeBSD__)
|
||||
printf ("WARNING: your random generator isn't known to be secure\n");
|
||||
#endif
|
||||
|
||||
{
|
||||
FILE *f;
|
||||
size_t rd;
|
||||
f = fopen ("/dev/random", "rb");
|
||||
if (!f)
|
||||
{
|
||||
memset (pass1, 0, strlen (pass1));
|
||||
free (pass1);
|
||||
free (buf);
|
||||
free (bufhex);
|
||||
free (salthex);
|
||||
free (salt);
|
||||
fclose (f);
|
||||
grub_util_error ("Couldn't retrieve random data for salt");
|
||||
}
|
||||
rd = fread (salt, 1, saltlen, f);
|
||||
if (rd != saltlen)
|
||||
{
|
||||
fclose (f);
|
||||
memset (pass1, 0, strlen (pass1));
|
||||
free (pass1);
|
||||
free (buf);
|
||||
free (bufhex);
|
||||
free (salthex);
|
||||
free (salt);
|
||||
fclose (f);
|
||||
grub_util_error ("Couldn't retrieve random data for salt");
|
||||
}
|
||||
fclose (f);
|
||||
}
|
||||
|
||||
gcry_err = grub_crypto_pbkdf2 (GRUB_MD_SHA512,
|
||||
(grub_uint8_t *) pass1, strlen (pass1),
|
||||
salt, saltlen,
|
||||
c, buf, buflen);
|
||||
memset (pass1, 0, strlen (pass1));
|
||||
free (pass1);
|
||||
|
||||
if (gcry_err)
|
||||
{
|
||||
memset (buf, 0, buflen);
|
||||
memset (bufhex, 0, 2 * buflen);
|
||||
free (buf);
|
||||
free (bufhex);
|
||||
memset (salt, 0, saltlen);
|
||||
memset (salthex, 0, 2 * saltlen);
|
||||
free (salt);
|
||||
free (salthex);
|
||||
grub_util_error ("Cryptographic error number %d", gcry_err);
|
||||
}
|
||||
|
||||
hexify (bufhex, buf, buflen);
|
||||
hexify (salthex, salt, saltlen);
|
||||
|
||||
printf ("Your PBKDF2 is grub.pbkdf2.sha512.%d.%s.%s\n", c, salthex, bufhex);
|
||||
memset (buf, 0, buflen);
|
||||
memset (bufhex, 0, 2 * buflen);
|
||||
free (buf);
|
||||
free (bufhex);
|
||||
memset (salt, 0, saltlen);
|
||||
memset (salthex, 0, 2 * saltlen);
|
||||
free (salt);
|
||||
free (salthex);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-mkrelpath.c - make a system path relative to its root */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -56,9 +56,8 @@ main (int argc, char *argv[])
|
|||
char *argument, *relpath;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-probe.c - probe device information for a given path */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -338,9 +338,8 @@ main (int argc, char *argv[])
|
|||
char *argument;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
# grub-mkconfig helper script.
|
||||
# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
#
|
||||
# GRUB is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -73,17 +73,19 @@ menuentry "${OS}" {
|
|||
EOF
|
||||
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
|
||||
cat << EOF
|
||||
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}
|
||||
echo $(gettext "Loading GNU Mach ...")
|
||||
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
|
||||
cat << EOF
|
||||
module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
|
||||
echo $(gettext "Loading the Hurd ...")
|
||||
module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
|
||||
--multiboot-command-line='\${kernel-command-line}' \\
|
||||
--host-priv-port='\${host-port}' \\
|
||||
--device-master-port='\${device-port}' \\
|
||||
--exec-server-task='\${exec-task}' -T typed '\${root}' \\
|
||||
'\$(task-create)' '\$(task-resume)'
|
||||
module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)'
|
||||
module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)'
|
||||
}
|
||||
EOF
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
# grub-mkconfig helper script.
|
||||
# Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
#
|
||||
# GRUB is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -45,12 +45,13 @@ kfreebsd_entry ()
|
|||
fi
|
||||
printf '%s\n' "${prepare_boot_cache}"
|
||||
cat << EOF
|
||||
kfreebsd ${rel_dirname}/${basename}
|
||||
echo $(printf "$(gettext "Loading kernel of FreeBSD %s ...")" ${version})
|
||||
kfreebsd ${rel_dirname}/${basename}
|
||||
EOF
|
||||
|
||||
if test -n "${devices}" ; then
|
||||
cat << EOF
|
||||
kfreebsd_loadenv ${devices_rel_dirname}/${devices_basename}
|
||||
kfreebsd_loadenv ${devices_rel_dirname}/${devices_basename}
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
# grub-mkconfig helper script.
|
||||
# Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
#
|
||||
# GRUB is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -65,10 +65,12 @@ linux_entry ()
|
|||
fi
|
||||
printf '%s\n' "${prepare_boot_cache}"
|
||||
cat << EOF
|
||||
echo $(printf "$(gettext "Loading Linux %s ...")" ${version})
|
||||
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
|
||||
EOF
|
||||
if test -n "${initrd}" ; then
|
||||
cat << EOF
|
||||
echo $(gettext "Loading initial ramdisk ...")
|
||||
initrd ${rel_dirname}/${initrd}
|
||||
EOF
|
||||
fi
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* hostfs.c - Dummy filesystem to provide access to the hosts filesystem */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
# Make GRUB rescue floppy
|
||||
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# GRUB is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# GRUB is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Initialize some variables.
|
||||
transform="@program_transform_name@"
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
bindir=@bindir@
|
||||
libdir=@libdir@
|
||||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
target_cpu=@target_cpu@
|
||||
platform=@platform@
|
||||
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
usage () {
|
||||
cat <<EOF
|
||||
Usage: $0 [OPTION] output_image
|
||||
Make GRUB rescue floppy.
|
||||
|
||||
-h, --help print this message and exit
|
||||
-v, --version print the version information and exit
|
||||
--modules=MODULES pre-load specified modules MODULES
|
||||
--output=FILE save output in FILE
|
||||
|
||||
$0 generates a bootable rescue floppy.
|
||||
|
||||
Report bugs to <bug-grub@gnu.org>.
|
||||
EOF
|
||||
}
|
||||
|
||||
input_dir=${pkglibdir}
|
||||
|
||||
# Check the arguments.
|
||||
for option in "$@"; do
|
||||
case "$option" in
|
||||
-h | --help)
|
||||
usage
|
||||
exit 0 ;;
|
||||
-v | --version)
|
||||
echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
|
||||
exit 0 ;;
|
||||
--modules=*)
|
||||
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||
--output=*)
|
||||
output_image=`echo "$option" | sed 's/--output=//'` ;;
|
||||
-*)
|
||||
echo "Unrecognized option \`$option'" 1>&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
if test "x$output_image" != x; then
|
||||
echo "Unrecognized option \`$option'" 1>&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
output_image="${option}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "x$output_image" = x; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
aux_dir=`mktemp -d`
|
||||
mkdir -p ${aux_dir}/boot/grub
|
||||
|
||||
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
|
||||
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
|
||||
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
|
||||
if test -f "$file"; then
|
||||
cp -f "$file" ${aux_dir}/boot/grub/
|
||||
fi
|
||||
done
|
||||
|
||||
modules="$(cat ${input_dir}/partmap.lst) ${modules}"
|
||||
for i in ${modules} ; do
|
||||
echo "insmod $i"
|
||||
done > ${aux_dir}/boot/grub/grub.cfg
|
||||
|
||||
# build memdisk
|
||||
memdisk_img=`mktemp`
|
||||
tar -C ${aux_dir} -cf ${memdisk_img} boot
|
||||
rm -rf ${aux_dir}
|
||||
|
||||
# build core.img
|
||||
core_img=`mktemp`
|
||||
grub-mkimage -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk tar biosdisk
|
||||
rm -f ${memdisk_img}
|
||||
|
||||
# build floppy image
|
||||
cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > ${output_image}
|
||||
rm -f ${core_img}
|
||||
|
||||
exit 0
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-mkimage.c - make a bootable image */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,6 +33,7 @@
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define _GNU_SOURCE 1
|
||||
#include <getopt.h>
|
||||
|
@ -212,10 +213,17 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
|
||||
boot_img = grub_util_read_image (boot_path);
|
||||
|
||||
/* i386 is a little endian architecture. */
|
||||
*((grub_uint16_t *) (boot_img + GRUB_DISK_SECTOR_SIZE
|
||||
- GRUB_BOOT_MACHINE_LIST_SIZE + 8))
|
||||
= grub_cpu_to_le16 (num);
|
||||
{
|
||||
struct grub_boot_blocklist *block;
|
||||
block = (struct grub_boot_blocklist *) (boot_img
|
||||
+ GRUB_DISK_SECTOR_SIZE
|
||||
- sizeof (*block));
|
||||
block->len = grub_host_to_target16 (num);
|
||||
|
||||
/* This is filled elsewhere. Verify it just in case. */
|
||||
assert (block->segment == grub_host_to_target16 (GRUB_BOOT_MACHINE_KERNEL_SEG
|
||||
+ (GRUB_DISK_SECTOR_SIZE >> 4)));
|
||||
}
|
||||
|
||||
grub_util_write_image (boot_img, boot_size, out);
|
||||
free (boot_img);
|
||||
|
@ -351,9 +359,8 @@ main (int argc, char *argv[])
|
|||
FILE *fp = stdout;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-setup.c - make GRUB usable */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -48,6 +48,7 @@ static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_P
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <assert.h>
|
||||
#include "progname.h"
|
||||
|
||||
#define _GNU_SOURCE 1
|
||||
|
@ -56,14 +57,6 @@ static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_P
|
|||
#define DEFAULT_BOOT_FILE "boot.img"
|
||||
#define DEFAULT_CORE_FILE "core.img"
|
||||
|
||||
/* This is the blocklist used in the diskboot image. */
|
||||
struct boot_blocklist
|
||||
{
|
||||
grub_uint64_t start;
|
||||
grub_uint16_t len;
|
||||
grub_uint16_t segment;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
void
|
||||
grub_putchar (int c)
|
||||
{
|
||||
|
@ -99,7 +92,7 @@ setup (const char *dir,
|
|||
grub_uint8_t *boot_drive;
|
||||
grub_disk_addr_t *kernel_sector;
|
||||
grub_uint16_t *boot_drive_check;
|
||||
struct boot_blocklist *first_block, *block;
|
||||
struct grub_boot_blocklist *first_block, *block;
|
||||
grub_int32_t *install_dos_part, *install_bsd_part;
|
||||
grub_int32_t dos_part, bsd_part;
|
||||
char *tmp_img;
|
||||
|
@ -171,7 +164,7 @@ setup (const char *dir,
|
|||
void NESTED_FUNC_ATTR save_blocklists (grub_disk_addr_t sector, unsigned offset,
|
||||
unsigned length)
|
||||
{
|
||||
struct boot_blocklist *prev = block + 1;
|
||||
struct grub_boot_blocklist *prev = block + 1;
|
||||
|
||||
grub_util_info ("saving <%llu,%u,%u> with the segment 0x%x",
|
||||
sector, offset, length, (unsigned) current_segment);
|
||||
|
@ -226,9 +219,9 @@ setup (const char *dir,
|
|||
core_img = grub_util_read_image (core_path);
|
||||
|
||||
/* Have FIRST_BLOCK to point to the first blocklist. */
|
||||
first_block = (struct boot_blocklist *) (core_img
|
||||
+ GRUB_DISK_SECTOR_SIZE
|
||||
- sizeof (*block));
|
||||
first_block = (struct grub_boot_blocklist *) (core_img
|
||||
+ GRUB_DISK_SECTOR_SIZE
|
||||
- sizeof (*block));
|
||||
|
||||
install_dos_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE
|
||||
+ GRUB_KERNEL_MACHINE_INSTALL_DOS_PART);
|
||||
|
@ -389,10 +382,11 @@ setup (const char *dir,
|
|||
|
||||
/* The first blocklist contains the whole sectors. */
|
||||
first_block->start = grub_cpu_to_le64 (embed_region.start + 1);
|
||||
first_block->len = grub_cpu_to_le16 (core_sectors - 1);
|
||||
first_block->segment
|
||||
= grub_cpu_to_le16 (GRUB_BOOT_MACHINE_KERNEL_SEG
|
||||
+ (GRUB_DISK_SECTOR_SIZE >> 4));
|
||||
|
||||
/* These are filled elsewhere. Verify them just in case. */
|
||||
assert (first_block->len == grub_host_to_target16 (core_sectors - 1));
|
||||
assert (first_block->segment == grub_host_to_target16 (GRUB_BOOT_MACHINE_KERNEL_SEG
|
||||
+ (GRUB_DISK_SECTOR_SIZE >> 4)));
|
||||
|
||||
/* Make sure that the second blocklist is a terminator. */
|
||||
block = first_block - 1;
|
||||
|
@ -641,9 +635,8 @@ main (int argc, char *argv[])
|
|||
int must_embed = 0, force = 0, fs_probe = 1;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
|
|
@ -61,12 +61,30 @@ mdblocksizes = {"_gcry_digest_spec_crc32" : 64,
|
|||
"_gcry_digest_spec_tiger" : 64,
|
||||
"_gcry_digest_spec_whirlpool" : 64}
|
||||
|
||||
cryptolist = open (os.path.join (cipher_dir_out, "crypto.lst"), "w")
|
||||
|
||||
# rijndael is the only cipher using aliases. So no need for mangling, just
|
||||
# hardcode it
|
||||
cryptolist.write ("RIJNDAEL: gcry_rijndael\n");
|
||||
cryptolist.write ("RIJNDAEL192: gcry_rijndael\n");
|
||||
cryptolist.write ("RIJNDAEL256: gcry_rijndael\n");
|
||||
cryptolist.write ("AES128: gcry_rijndael\n");
|
||||
cryptolist.write ("AES-128: gcry_rijndael\n");
|
||||
cryptolist.write ("AES-192: gcry_rijndael\n");
|
||||
cryptolist.write ("AES-256: gcry_rijndael\n");
|
||||
|
||||
for cipher_file in cipher_files:
|
||||
infile = os.path.join (cipher_dir_in, cipher_file)
|
||||
outfile = os.path.join (cipher_dir_out, cipher_file)
|
||||
if cipher_file == "ChangeLog":
|
||||
continue
|
||||
chlognew = " * %s" % cipher_file
|
||||
if re.match ("(Manifest|Makefile\.am|ac\.c|cipher\.c|hash-common\.c|hmac-tests\.c|md\.c|pubkey\.c)$", cipher_file):
|
||||
chlog = "%s%s: Removed\n" % (chlog, chlognew)
|
||||
continue
|
||||
# Autogenerated files. Not even worth mentionning in ChangeLog
|
||||
if re.match ("Makefile\.in$", cipher_file):
|
||||
continue
|
||||
nch = False
|
||||
if re.match (".*\.[ch]$", cipher_file):
|
||||
isc = re.match (".*\.c$", cipher_file)
|
||||
|
@ -80,8 +98,21 @@ for cipher_file in cipher_files:
|
|||
skip = False
|
||||
skip2 = False
|
||||
ismd = False
|
||||
iscryptostart = False
|
||||
iscomma = False
|
||||
isglue = False
|
||||
skip_statement = False
|
||||
if isc:
|
||||
modname = cipher_file [0:len(cipher_file) - 2]
|
||||
if re.match (".*-glue$", modname):
|
||||
modname = modname.replace ("-glue", "")
|
||||
isglue = True
|
||||
modname = "gcry_%s" % modname
|
||||
for line in f:
|
||||
if skip_statement:
|
||||
if not re.search (";", line) is None:
|
||||
skip_statement = False
|
||||
continue
|
||||
if skip:
|
||||
if line[0] == "}":
|
||||
skip = False
|
||||
|
@ -90,6 +121,12 @@ for cipher_file in cipher_files:
|
|||
if not re.search (" *};", line) is None:
|
||||
skip2 = False
|
||||
continue
|
||||
if iscryptostart:
|
||||
s = re.search (" *\"([A-Z0-9_a-z]*)\"", line)
|
||||
if not s is None:
|
||||
sg = s.groups()[0]
|
||||
cryptolist.write (("%s: %s\n") % (sg, modname))
|
||||
iscryptostart = False
|
||||
if ismd:
|
||||
if not re.search (" *};", line) is None:
|
||||
if not mdblocksizes.has_key (mdname):
|
||||
|
@ -100,10 +137,22 @@ for cipher_file in cipher_files:
|
|||
fw.write (" .blocksize = %s\n" % mdblocksizes [mdname])
|
||||
ismd = False
|
||||
iscomma = not re.search (",$", line) is None
|
||||
# Used only for selftests.
|
||||
m = re.match ("(static byte|static unsigned char) (weak_keys_chksum)\[[0-9]*\] =", line)
|
||||
if not m is None:
|
||||
skip = True
|
||||
fname = m.groups ()[1]
|
||||
chmsg = "(%s): Removed." % fname
|
||||
if nch:
|
||||
chlognew = "%s\n %s" % (chlognew, chmsg)
|
||||
else:
|
||||
chlognew = "%s %s" % (chlognew, chmsg)
|
||||
nch = True
|
||||
continue
|
||||
if hold:
|
||||
hold = False
|
||||
# We're optimising for size.
|
||||
if not re.match ("(run_selftests|selftest|_gcry_aes_c.._..c|_gcry_[a-z0-9]*_hash_buffer)", line) is None:
|
||||
if not re.match ("(run_selftests|selftest|_gcry_aes_c.._..c|_gcry_[a-z0-9]*_hash_buffer|tripledes_set2keys|do_tripledes_set_extra_info)", line) is None:
|
||||
skip = True
|
||||
fname = re.match ("[a-zA-Z0-9_]*", line).group ()
|
||||
chmsg = "(%s): Removed." % fname
|
||||
|
@ -127,16 +176,20 @@ for cipher_file in cipher_files:
|
|||
continue
|
||||
m = re.match ("gcry_cipher_spec_t", line)
|
||||
if isc and not m is None:
|
||||
assert (not iscryptostart)
|
||||
ciphername = line [len ("gcry_cipher_spec_t"):].strip ()
|
||||
ciphername = re.match("[a-zA-Z0-9_]*",ciphername).group ()
|
||||
ciphernames.append (ciphername)
|
||||
iscryptostart = True
|
||||
m = re.match ("gcry_md_spec_t", line)
|
||||
if isc and not m is None:
|
||||
assert (not ismd)
|
||||
assert (not iscryptostart)
|
||||
mdname = line [len ("gcry_md_spec_t"):].strip ()
|
||||
mdname = re.match("[a-zA-Z0-9_]*",mdname).group ()
|
||||
mdnames.append (mdname)
|
||||
ismd = True
|
||||
iscryptostart = True
|
||||
m = re.match ("static const char \*selftest.*;$", line)
|
||||
if not m is None:
|
||||
fname = line[len ("static const char \*"):]
|
||||
|
@ -148,11 +201,18 @@ for cipher_file in cipher_files:
|
|||
chlognew = "%s %s" % (chlognew, chmsg)
|
||||
nch = True
|
||||
continue
|
||||
m = re.match ("(static const char( |)\*|static gpg_err_code_t|void)$", line)
|
||||
m = re.match ("(static const char( |)\*|static gpg_err_code_t|void|static int|static gcry_err_code_t)$", line)
|
||||
if not m is None:
|
||||
hold = True
|
||||
holdline = line
|
||||
continue
|
||||
m = re.match ("static int tripledes_set2keys \(.*\);", line)
|
||||
if not m is None:
|
||||
continue
|
||||
m = re.match ("static int tripledes_set2keys \(", line)
|
||||
if not m is None:
|
||||
skip_statement = True
|
||||
continue
|
||||
m = re.match ("cipher_extra_spec_t", line)
|
||||
if isc and not m is None:
|
||||
skip2 = True
|
||||
|
@ -179,14 +239,11 @@ for cipher_file in cipher_files:
|
|||
continue
|
||||
fw.write (line)
|
||||
if len (ciphernames) > 0 or len (mdnames) > 0:
|
||||
modname = cipher_file [0:len(cipher_file) - 2]
|
||||
if re.match (".*-glue$", modname):
|
||||
modfiles = "libgcrypt-grub/cipher/%s libgcrypt-grub/cipher/%s" \
|
||||
if isglue:
|
||||
modfiles = "lib/libgcrypt-grub/cipher/%s lib/libgcrypt-grub/cipher/%s" \
|
||||
% (cipher_file, cipher_file.replace ("-glue.c", ".c"))
|
||||
modname = modname.replace ("-glue", "")
|
||||
else:
|
||||
modfiles = "libgcrypt-grub/cipher/%s" % cipher_file
|
||||
modname = "gcry_%s" % modname
|
||||
modfiles = "lib/libgcrypt-grub/cipher/%s" % cipher_file
|
||||
chmsg = "(GRUB_MOD_INIT(%s)): New function\n" % modname
|
||||
if nch:
|
||||
chlognew = "%s\n %s" % (chlognew, chmsg)
|
||||
|
@ -220,7 +277,7 @@ for cipher_file in cipher_files:
|
|||
conf.write ("pkglib_MODULES += %s.mod\n" % modname)
|
||||
conf.write ("%s_mod_SOURCES = %s\n" %\
|
||||
(modname, modfiles))
|
||||
conf.write ("%s_mod_CFLAGS = $(COMMON_CFLAGS) -Wno-missing-field-initializers -Wno-error\n" % modname)
|
||||
conf.write ("%s_mod_CFLAGS = $(COMMON_CFLAGS) -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap\n" % modname)
|
||||
conf.write ("%s_mod_LDFLAGS = $(COMMON_LDFLAGS)\n\n" % modname)
|
||||
elif isc and cipher_file != "camellia.c":
|
||||
print ("WARNING: C file isn't a module: %s" % cipher_file)
|
||||
|
@ -229,26 +286,22 @@ for cipher_file in cipher_files:
|
|||
if nch:
|
||||
chlog = "%s%s\n" % (chlog, chlognew)
|
||||
continue
|
||||
if re.match ("(Manifest|Makefile\.am)$", cipher_file):
|
||||
chlog = "%s%sRemoved\n" % (chlog, chlognew)
|
||||
continue
|
||||
# Autogenerated files. Not even worth mentionning in ChangeLog
|
||||
if re.match ("Makefile\.in$", cipher_file):
|
||||
chlog = "%s%sRemoved\n" % (chlog, chlognew)
|
||||
continue
|
||||
chlog = "%s%sSkipped unknown file\n" % (chlog, chlognew)
|
||||
print ("WARNING: unknown file %s" % cipher_file)
|
||||
|
||||
cryptolist.close ()
|
||||
chlog = "%s * crypto.lst: New file.\n" % chlog
|
||||
|
||||
outfile = os.path.join (cipher_dir_out, "types.h")
|
||||
fw=open (outfile, "w")
|
||||
fw.write ("#include <grub/types.h>\n")
|
||||
fw.write ("#include <grub/cipher_wrap.h>\n")
|
||||
fw.write ("#include <cipher_wrap.h>\n")
|
||||
chlog = "%s * types.h: New file.\n" % chlog
|
||||
fw.close ()
|
||||
|
||||
outfile = os.path.join (cipher_dir_out, "memory.h")
|
||||
fw=open (outfile, "w")
|
||||
fw.write ("#include <grub/cipher_wrap.h>\n")
|
||||
fw.write ("#include <cipher_wrap.h>\n")
|
||||
chlog = "%s * memory.h: New file.\n" % chlog
|
||||
fw.close ()
|
||||
|
||||
|
@ -256,13 +309,13 @@ fw.close ()
|
|||
outfile = os.path.join (cipher_dir_out, "cipher.h")
|
||||
fw=open (outfile, "w")
|
||||
fw.write ("#include <grub/crypto.h>\n")
|
||||
fw.write ("#include <grub/cipher_wrap.h>\n")
|
||||
fw.write ("#include <cipher_wrap.h>\n")
|
||||
chlog = "%s * cipher.h: Likewise.\n" % chlog
|
||||
fw.close ()
|
||||
|
||||
outfile = os.path.join (cipher_dir_out, "g10lib.h")
|
||||
fw=open (outfile, "w")
|
||||
fw.write ("#include <grub/cipher_wrap.h>\n")
|
||||
fw.write ("#include <cipher_wrap.h>\n")
|
||||
chlog = "%s * g10lib.h: Likewise.\n" % chlog
|
||||
fw.close ()
|
||||
|
||||
|
|
36
util/misc.c
36
util/misc.c
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -38,6 +38,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
|
@ -478,6 +479,19 @@ fail:
|
|||
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
char *
|
||||
canonicalize_file_name (const char *path)
|
||||
{
|
||||
char *ret;
|
||||
#ifdef PATH_MAX
|
||||
ret = xmalloc (PATH_MAX);
|
||||
(void) realpath (path, ret);
|
||||
#else
|
||||
ret = realpath (path, NULL);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* This function never prints trailing slashes (so that its output
|
||||
can be appended a slash unconditionally). */
|
||||
char *
|
||||
|
@ -490,15 +504,11 @@ make_system_path_relative_to_its_root (const char *path)
|
|||
size_t len;
|
||||
|
||||
/* canonicalize. */
|
||||
p = realpath (path, NULL);
|
||||
p = canonicalize_file_name (path);
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
if (errno != EINVAL)
|
||||
grub_util_error ("failed to get realpath of %s", path);
|
||||
else
|
||||
grub_util_error ("realpath not supporting (path, NULL)");
|
||||
}
|
||||
grub_util_error ("failed to get canonical path of %s", path);
|
||||
|
||||
len = strlen (p) + 1;
|
||||
buf = strdup (p);
|
||||
free (p);
|
||||
|
@ -566,3 +576,13 @@ make_system_path_relative_to_its_root (const char *path)
|
|||
|
||||
return buf3;
|
||||
}
|
||||
|
||||
void
|
||||
grub_util_init_nls (void)
|
||||
{
|
||||
#if ENABLE_NLS
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
#endif /* ENABLE_NLS */
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define PREPARER_DEFAULT NULL
|
||||
#define PUBLISHER_DEFAULT NULL
|
||||
#ifndef APPID_DEFAULT
|
||||
#define APPID_DEFAULT "MKISOFS ISO 9660 FILESYSTEM BUILDER"
|
||||
#define APPID_DEFAULT PACKAGE_NAME " ISO 9660 filesystem builder"
|
||||
#endif
|
||||
#define COPYRIGHT_DEFAULT NULL
|
||||
#define BIBLIO_DEFAULT NULL
|
||||
|
@ -17,38 +17,4 @@
|
|||
#define VOLUME_ID_DEFAULT "CDROM"
|
||||
#define BOOT_CATALOG_DEFAULT "boot.catalog"
|
||||
#define BOOT_IMAGE_DEFAULT NULL
|
||||
#ifdef __QNX__
|
||||
#define SYSTEM_ID_DEFAULT "QNX"
|
||||
#endif
|
||||
|
||||
#ifdef __osf__
|
||||
#define SYSTEM_ID_DEFAULT "OSF"
|
||||
#endif
|
||||
|
||||
#ifdef __sun
|
||||
#ifdef __SVR4
|
||||
#define SYSTEM_ID_DEFAULT "Solaris"
|
||||
#else
|
||||
#define SYSTEM_ID_DEFAULT "SunOS"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __hpux
|
||||
#define SYSTEM_ID_DEFAULT "HP-UX"
|
||||
#endif
|
||||
|
||||
#ifdef __sgi
|
||||
#define SYSTEM_ID_DEFAULT "SGI"
|
||||
#endif
|
||||
|
||||
#ifdef _AIX
|
||||
#define SYSTEM_ID_DEFAULT "AIX"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN
|
||||
#define SYSTEM_ID_DEFAULT "Win32"
|
||||
#endif /* _WIN */
|
||||
|
||||
#ifndef SYSTEM_ID_DEFAULT
|
||||
#define SYSTEM_ID_DEFAULT "LINUX"
|
||||
#endif
|
||||
#define SYSTEM_ID_DEFAULT "GNU"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
Copyright 1993 Yggdrasil Computing, Incorporated
|
||||
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009,2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,12 +26,7 @@
|
|||
#include "config.h"
|
||||
#include "mkisofs.h"
|
||||
#include "match.h"
|
||||
|
||||
#ifdef linux
|
||||
#include <getopt.h>
|
||||
#else
|
||||
#include "getopt.h"
|
||||
#endif
|
||||
|
||||
#include "iso9660.h"
|
||||
#include <ctype.h>
|
||||
|
@ -490,7 +485,7 @@ void usage(){
|
|||
int comma;
|
||||
int len;
|
||||
unsigned int j;
|
||||
char *arg;
|
||||
const char *arg;
|
||||
|
||||
printf (" ");
|
||||
|
||||
|
@ -645,9 +640,11 @@ int FDECL2(main, int, argc, char **, argv){
|
|||
char *log_file = 0;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
#if ENABLE_NLS
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
#endif /* ENABLE_NLS */
|
||||
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
@ -912,7 +909,7 @@ int FDECL2(main, int, argc, char **, argv){
|
|||
exit (0);
|
||||
break;
|
||||
case OPTION_VERSION:
|
||||
printf ("%s (%s %s)\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
printf ("%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION);
|
||||
exit (0);
|
||||
break;
|
||||
case OPTION_NOSPLIT_SL_COMPONENT:
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
Copyright 1993 Yggdrasil Computing, Incorporated
|
||||
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009,2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,8 +30,21 @@
|
|||
#include <prototyp.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <locale.h>
|
||||
#include <libintl.h>
|
||||
#if ENABLE_NLS
|
||||
|
||||
# include <locale.h>
|
||||
# include <libintl.h>
|
||||
|
||||
#else /* ! ENABLE_NLS */
|
||||
|
||||
/* Disabled NLS.
|
||||
The casts to 'const char *' serve the purpose of producing warnings
|
||||
for invalid uses of the value returned from these functions.
|
||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
||||
contain "#define const". */
|
||||
# define gettext(Msgid) ((const char *) (Msgid))
|
||||
#endif /* ENABLE_NLS */
|
||||
|
||||
#define _(str) gettext(str)
|
||||
#define N_(str) str
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
Copyright 1993 Yggdrasil Computing, Incorporated
|
||||
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009,2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -306,7 +306,7 @@ int deep_opt;
|
|||
* the symbolic link won't fit into one SL System Use Field
|
||||
* print an error message and continue with splited one
|
||||
*/
|
||||
fprintf(stderr, _("symbolic link ``%s'' to long for one SL System Use Field, splitting"), cpnt);
|
||||
fprintf (stderr, _("symbolic link ``%s'' too long for one SL System Use Field, splitting"), cpnt);
|
||||
}
|
||||
if(MAYBE_ADD_CE_ENTRY(SL_SIZE + sl_bytes)) add_CE_entry();
|
||||
}
|
||||
|
|
|
@ -1437,7 +1437,9 @@ static int FDECL1(padblock_write, FILE *, outfile)
|
|||
if (! fp)
|
||||
error (1, errno, _("Unable to open %s"), boot_image_embed);
|
||||
|
||||
fread (buffer, 2048 * PADBLOCK_SIZE, 1, fp);
|
||||
if (fread (buffer, 1, 2048 * PADBLOCK_SIZE, fp) == 0)
|
||||
error (1, errno, _("cannot read %d bytes from %s"),
|
||||
2048 * PADBLOCK_SIZE, boot_image_embed);
|
||||
if (fgetc (fp) != EOF)
|
||||
error (1, 0, _("%s is too big for embed area"), boot_image_embed);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-mkimage.c - make a bootable image */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -222,9 +222,8 @@ main (int argc, char *argv[])
|
|||
FILE *fp = stdout;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-ofpathname.c - Find OpenBOOT path for a given device */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -29,9 +29,8 @@ int main(int argc, char **argv)
|
|||
char *of_path;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-setup.c - make GRUB usable */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -620,9 +620,8 @@ main (int argc, char *argv[])
|
|||
struct grub_setup_info ginfo;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
init_info (&ginfo);
|
||||
if (!parse_options (&ginfo, argc, argv))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue