add gcry to utils
This commit is contained in:
parent
f3470f4eb5
commit
dcd73ec05e
6 changed files with 56 additions and 9 deletions
|
@ -135,3 +135,4 @@ widthspec.bin
|
|||
widthspec.h
|
||||
docs/stamp-1
|
||||
docs/version-dev.texi
|
||||
Makefile.utilgcry.def
|
||||
|
|
|
@ -21,12 +21,16 @@ library = {
|
|||
common = grub-core/kern/list.c;
|
||||
common = grub-core/kern/misc.c;
|
||||
common = grub-core/kern/partition.c;
|
||||
common = grub-core/lib/crypto.c;
|
||||
common = grub-core/disk/luks.c;
|
||||
common = grub-core/disk/AFSplitter.c;
|
||||
common = grub-core/lib/pbkdf2.c;
|
||||
common = grub-core/commands/extcmd.c;
|
||||
common = grub-core/lib/arg.c;
|
||||
};
|
||||
|
||||
library = {
|
||||
name = libgrubmods.a;
|
||||
cflags = '$(CFLAGS_GCRY)';
|
||||
cppflags = '$(CPPFLAGS_GCRY)';
|
||||
|
||||
common_nodist = grub_script.tab.c;
|
||||
common_nodist = grub_script.yy.c;
|
||||
|
@ -35,7 +39,6 @@ library = {
|
|||
common_nodist = grub_script.tab.h;
|
||||
|
||||
common = grub-core/commands/blocklist.c;
|
||||
common = grub-core/commands/extcmd.c;
|
||||
common = grub-core/commands/ls.c;
|
||||
common = grub-core/disk/dmraid_nvidia.c;
|
||||
common = grub-core/disk/loopback.c;
|
||||
|
@ -75,15 +78,10 @@ library = {
|
|||
common = grub-core/fs/zfs/zfs_lzjb.c;
|
||||
common = grub-core/fs/zfs/zfs_sha256.c;
|
||||
common = grub-core/fs/zfs/zfs_fletcher.c;
|
||||
common = grub-core/lib/arg.c;
|
||||
common = grub-core/lib/crypto.c;
|
||||
common = grub-core/lib/envblk.c;
|
||||
common = grub-core/lib/hexdump.c;
|
||||
common = grub-core/lib/libgcrypt-grub/cipher/sha512.c;
|
||||
common = grub-core/lib/libgcrypt-grub/cipher/crc.c;
|
||||
common = grub-core/lib/LzFind.c;
|
||||
common = grub-core/lib/LzmaEnc.c;
|
||||
common = grub-core/lib/pbkdf2.c;
|
||||
common = grub-core/lib/crc.c;
|
||||
common = grub-core/normal/datetime.c;
|
||||
common = grub-core/normal/misc.c;
|
||||
|
@ -123,6 +121,7 @@ program = {
|
|||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBLZMA)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
|
@ -173,6 +172,7 @@ program = {
|
|||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
cflags = '$(CFLAGS_GCRY)';
|
||||
|
@ -211,6 +211,7 @@ program = {
|
|||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
@ -257,6 +258,7 @@ program = {
|
|||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
|
|
@ -26,7 +26,7 @@ if [ "x${GRUB_CONTRIB}" != x ]; then
|
|||
[ "${GRUB_CONTRIB}" = grub-core/contrib ] || ln -s ../contrib grub-core/contrib
|
||||
fi
|
||||
|
||||
UTIL_DEFS=Makefile.util.def
|
||||
UTIL_DEFS='Makefile.util.def Makefile.utilgcry.def'
|
||||
CORE_DEFS='grub-core/Makefile.core.def grub-core/Makefile.gcry.def'
|
||||
|
||||
for extra in contrib/*/Makefile.util.def; do
|
||||
|
|
|
@ -274,4 +274,10 @@ grub_password_get (char buf[], unsigned buf_size);
|
|||
|
||||
extern void (*grub_crypto_autoload_hook) (const char *name);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
void grub_gcry_init_all (void);
|
||||
void grub_gcry_fini_all (void);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -393,6 +393,7 @@ main (int argc, char *argv[])
|
|||
|
||||
/* Initialize all modules. */
|
||||
grub_init_all ();
|
||||
grub_gcry_init_all ();
|
||||
|
||||
grub_lvm_fini ();
|
||||
grub_mdraid09_fini ();
|
||||
|
@ -410,6 +411,7 @@ main (int argc, char *argv[])
|
|||
probe (argument, NULL);
|
||||
|
||||
/* Free resources. */
|
||||
grub_gcry_fini_all ();
|
||||
grub_fini_all ();
|
||||
grub_util_biosdisk_fini ();
|
||||
|
||||
|
|
|
@ -42,7 +42,15 @@ except:
|
|||
cipher_files = os.listdir (cipher_dir_in)
|
||||
conf = open (os.path.join ("grub-core", "Makefile.gcry.def"), "w")
|
||||
conf.write ("AutoGen definitions Makefile.tpl;\n\n")
|
||||
confutil = open ("Makefile.utilgcry.def", "w")
|
||||
confutil.write ("AutoGen definitions Makefile.tpl;\n\n")
|
||||
confutil.write ("library = {\n");
|
||||
confutil.write (" name = libgrubgcry.a;\n");
|
||||
confutil.write (" cflags = '$(CFLAGS_GCRY)';\n");
|
||||
confutil.write (" cppflags = '$(CPPFLAGS_GCRY)';\n");
|
||||
confutil.write ("\n");
|
||||
chlog = ""
|
||||
modules = []
|
||||
|
||||
# Strictly speaking CRC32/CRC24 work on bytes so this value should be 1
|
||||
# But libgcrypt uses 64. Let's keep the value for compatibility. Since
|
||||
|
@ -249,6 +257,7 @@ for cipher_file in cipher_files:
|
|||
% (cipher_file, cipher_file.replace ("-glue.c", ".c"))
|
||||
else:
|
||||
modfiles = "lib/libgcrypt-grub/cipher/%s" % cipher_file
|
||||
modules.append (modname)
|
||||
chmsg = "(GRUB_MOD_INIT(%s)): New function\n" % modname
|
||||
if nch:
|
||||
chlognew = "%s\n %s" % (chlognew, chmsg)
|
||||
|
@ -283,6 +292,7 @@ for cipher_file in cipher_files:
|
|||
conf.write (" name = %s;\n" % modname)
|
||||
for src in modfiles.split():
|
||||
conf.write (" common = %s;\n" % src)
|
||||
confutil.write (" common = grub-core/%s;\n" % src)
|
||||
conf.write (" cflags = '$(CFLAGS_GCRY)';\n");
|
||||
conf.write (" cppflags = '$(CPPFLAGS_GCRY)';\n");
|
||||
conf.write ("};\n\n")
|
||||
|
@ -329,6 +339,32 @@ fw.close ()
|
|||
infile = os.path.join (cipher_dir_in, "ChangeLog")
|
||||
outfile = os.path.join (cipher_dir_out, "ChangeLog")
|
||||
|
||||
conf.close ();
|
||||
|
||||
initfile = open (os.path.join (cipher_dir_out, "init.c"), "w")
|
||||
for module in modules:
|
||||
initfile.write ("extern void grub_%s_init (void);\n" % module)
|
||||
initfile.write ("extern void grub_%s_fini (void);\n" % module)
|
||||
initfile.write ("\n")
|
||||
initfile.write ("void\n")
|
||||
initfile.write ("grub_gcry_init_all (void)\n")
|
||||
initfile.write ("{\n")
|
||||
for module in modules:
|
||||
initfile.write (" grub_%s_init ();\n" % module)
|
||||
initfile.write ("}\n")
|
||||
initfile.write ("\n")
|
||||
initfile.write ("void\n")
|
||||
initfile.write ("grub_gcry_fini_all (void)\n")
|
||||
initfile.write ("{\n")
|
||||
for module in modules:
|
||||
initfile.write (" grub_%s_fini ();\n" % module)
|
||||
initfile.write ("}\n")
|
||||
initfile.close ()
|
||||
|
||||
confutil.write (" common = grub-core/lib/libgcrypt-grub/cipher/init.c;\n")
|
||||
confutil.write ("};\n");
|
||||
confutil.close ();
|
||||
|
||||
|
||||
f=open (infile, "r")
|
||||
fw=open (outfile, "w")
|
||||
|
|
Loading…
Reference in a new issue