All of lore.kernel.org
 help / color / mirror / Atom feed
* Encryption Support for GRUB
@ 2008-08-06 16:04 W. Michael Petullo
  2008-08-06 17:11 ` Colin D Bennett
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: W. Michael Petullo @ 2008-08-06 16:04 UTC (permalink / raw)
  To: grub-devel

I am interested in seeing support for encrypted partitions added to GRUB.
On the GRUB Wiki, encryption support is listed as a suggested project for
Google's Summer of Code 2008. Did anyone pick up this project? If not, I
would like to take a stab at it. Before I start looking closely at this, I
have two questions:

1.  How do I know exactly what subset of libc is available to me as a GRUB
developer? Obviously, system calls would not be expected to work because
the operating system has not yet been loaded, but I would expect libmath
routines to be usable by GRUB. What about other libraries?

2.  Does anyone have any tips on how this could be implemented? I have a
lot of experience working with encrypted root filesystems, but this is my
first shot at an encrypted boot filesystem. I would appreciate comments
from seasoned GRUB developers as I delve into the project's code myself.

Thanks!

Mike




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Encryption Support for GRUB
  2008-08-06 16:04 Encryption Support for GRUB W. Michael Petullo
@ 2008-08-06 17:11 ` Colin D Bennett
  2008-08-06 17:37   ` Javier Martín
  2008-08-06 20:01 ` Robert Millan
  2008-08-06 20:19 ` Michael Gorven
  2 siblings, 1 reply; 6+ messages in thread
From: Colin D Bennett @ 2008-08-06 17:11 UTC (permalink / raw)
  To: grub-devel

On Wed, 6 Aug 2008 11:04:16 -0500 (CDT)
"W. Michael Petullo" <mike@flyn.org> wrote:

> 1.  How do I know exactly what subset of libc is available to me as a
> GRUB developer? Obviously, system calls would not be expected to work
> because the operating system has not yet been loaded, but I would
> expect libmath routines to be usable by GRUB. What about other
> libraries?

No libc is available.  Only functions implemented by GRUB itself are
available.  See ``kern/misc.c`` and ``include/grub/misc.h`` in the GRUB
2 source tree for implementations of the most important things that are
normally provided by libc, such as strcpy (grub_strcpy), memcmp
(grub_memcmp), etc.

link to online svn for misc.c:
http://svn.savannah.gnu.org/viewvc/trunk/grub2/kern/misc.c?revision=1774&root=grub&view=markup

GRUB implements dynamic memory allocation through grub_malloc,
grub_free, grub_realloc.  See ``kern/mm.c``.

No math library is available, but I think you could create a 'math'
module in GRUB and implement the required math functions there.  The
main thing is to keep the GRUB core small.  It needs to fit in 32 KB, I
think.

GRUB has its own file I/O api (no stdio -- instead use grub_file_open,
grub_file_read, etc.).

If you want to see how to use the GRUB library stuff, look at some of
the built in commands such as ``commands/ls.c``, etc.

Regards,
Colin



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Encryption Support for GRUB
  2008-08-06 17:11 ` Colin D Bennett
@ 2008-08-06 17:37   ` Javier Martín
  0 siblings, 0 replies; 6+ messages in thread
From: Javier Martín @ 2008-08-06 17:37 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 2380 bytes --]

El mié, 06-08-2008 a las 10:11 -0700, Colin D Bennett escribió:
> On Wed, 6 Aug 2008 11:04:16 -0500 (CDT)
> "W. Michael Petullo" <mike@flyn.org> wrote:
> 
> > 1.  How do I know exactly what subset of libc is available to me as a
> > GRUB developer? Obviously, system calls would not be expected to work
> > because the operating system has not yet been loaded, but I would
> > expect libmath routines to be usable by GRUB. What about other
> > libraries?
> 
> No libc is available.  Only functions implemented by GRUB itself are
> available.  See ``kern/misc.c`` and ``include/grub/misc.h`` in the GRUB
> 2 source tree for implementations of the most important things that are
> normally provided by libc, such as strcpy (grub_strcpy), memcmp
> (grub_memcmp), etc.
Maybe we should separate those headers in ANSI-like files, following a
structure like:

include/grub/gstdlib.h - grub_malloc et al
include/grub/gstdio.h - grub_printf and friends
etc

Of course, most of them would not be complete (i.e. gstdlib.h would not
have process control functions) but at least we'd separate "support"
functions from "pure GRUB" and questions like the OP's would be fast to
answer: "look at gstd*.h".

Furthermore, such a separation would "force" us to "commit" to a
semi-permanent specification of which subset of libc is available to
module writers, which is good if people wants to write and maintain
modules outside the GRUB tree.

-Habbit


> 
> link to online svn for misc.c:
> http://svn.savannah.gnu.org/viewvc/trunk/grub2/kern/misc.c?revision=1774&root=grub&view=markup
> 
> GRUB implements dynamic memory allocation through grub_malloc,
> grub_free, grub_realloc.  See ``kern/mm.c``.
> 
> No math library is available, but I think you could create a 'math'
> module in GRUB and implement the required math functions there.  The
> main thing is to keep the GRUB core small.  It needs to fit in 32 KB, I
> think.
> 
> GRUB has its own file I/O api (no stdio -- instead use grub_file_open,
> grub_file_read, etc.).
> 
> If you want to see how to use the GRUB library stuff, look at some of
> the built in commands such as ``commands/ls.c``, etc.
> 
> Regards,
> Colin
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel

[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 827 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Encryption Support for GRUB
  2008-08-06 16:04 Encryption Support for GRUB W. Michael Petullo
  2008-08-06 17:11 ` Colin D Bennett
@ 2008-08-06 20:01 ` Robert Millan
  2008-08-06 20:23   ` Michael Gorven
  2008-08-06 20:19 ` Michael Gorven
  2 siblings, 1 reply; 6+ messages in thread
From: Robert Millan @ 2008-08-06 20:01 UTC (permalink / raw)
  To: The development of GRUB 2

On Wed, Aug 06, 2008 at 11:04:16AM -0500, W. Michael Petullo wrote:
> I am interested in seeing support for encrypted partitions added to GRUB.
> On the GRUB Wiki, encryption support is listed as a suggested project for
> Google's Summer of Code 2008. Did anyone pick up this project? If not, I
> would like to take a stab at it. Before I start looking closely at this, I
> have two questions:
> 
> 1.  How do I know exactly what subset of libc is available to me as a GRUB
> developer? Obviously, system calls would not be expected to work because
> the operating system has not yet been loaded, but I would expect libmath
> routines to be usable by GRUB. What about other libraries?
> 
> 2.  Does anyone have any tips on how this could be implemented? I have a
> lot of experience working with encrypted root filesystems, but this is my
> first shot at an encrypted boot filesystem. I would appreciate comments
> from seasoned GRUB developers as I delve into the project's code myself.

I think the first you should do is check the list archives.  IIRC there was
someone else already working on this (not sure if he's still active, though).

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Encryption Support for GRUB
  2008-08-06 16:04 Encryption Support for GRUB W. Michael Petullo
  2008-08-06 17:11 ` Colin D Bennett
  2008-08-06 20:01 ` Robert Millan
@ 2008-08-06 20:19 ` Michael Gorven
  2 siblings, 0 replies; 6+ messages in thread
From: Michael Gorven @ 2008-08-06 20:19 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

On Wednesday 06 August 2008 18:04:16 W. Michael Petullo wrote:
> I am interested in seeing support for encrypted partitions added to GRUB.
> On the GRUB Wiki, encryption support is listed as a suggested project for
> Google's Summer of Code 2008. Did anyone pick up this project? If not, I
> would like to take a stab at it. Before I start looking closely at this, I
> have two questions:

http://lists.gnu.org/archive/html/grub-devel/2008-07/msg00403.html
http://lists.gnu.org/archive/html/grub-devel/2008-05/msg00127.html
http://lists.gnu.org/archive/html/grub-devel/2008-05/msg00157.html

Michael

-- 
http://michael.gorven.za.net
PGP Key ID 6612FE85
S/MIME Key ID D33AEB31

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Encryption Support for GRUB
  2008-08-06 20:01 ` Robert Millan
@ 2008-08-06 20:23   ` Michael Gorven
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Gorven @ 2008-08-06 20:23 UTC (permalink / raw)
  To: The development of GRUB 2

On Wednesday 06 August 2008 22:01:29 Robert Millan wrote:
> I think the first you should do is check the list archives.  IIRC there was
> someone else already working on this (not sure if he's still active,
> though).

I'm basically waiting for my patch to be reviewed, and for a response 
regarding the code I've incorporated from other projects.

Michael

-- 
http://michael.gorven.za.net
PGP Key ID 6612FE85
S/MIME Key ID D33AEB31



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-08-06 20:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-06 16:04 Encryption Support for GRUB W. Michael Petullo
2008-08-06 17:11 ` Colin D Bennett
2008-08-06 17:37   ` Javier Martín
2008-08-06 20:01 ` Robert Millan
2008-08-06 20:23   ` Michael Gorven
2008-08-06 20:19 ` Michael Gorven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.