From: Daniel Kiper <daniel.kiper@oracle.com>
To: grub-devel@gnu.org
Cc: dpsmith.dev@gmail.com, eric.snowberg@oracle.com,
javierm@redhat.com, jonmccune@google.com,
kanth.ghatraju@oracle.com, keng-yu.lin@hpe.com,
konrad.wilk@oracle.com, leif.lindholm@linaro.org,
mjg59@srcf.ucam.org, phcoder@gmail.com,
philip.b.tricca@intel.com, ross.philipson@oracle.com
Subject: [PATCH v3 6/8] verifiers: Add the documentation
Date: Wed, 3 Oct 2018 11:36:53 +0200 [thread overview]
Message-ID: <1538559415-6233-7-git-send-email-daniel.kiper@oracle.com> (raw)
In-Reply-To: <1538559415-6233-1-git-send-email-daniel.kiper@oracle.com>
From: Vladimir Serbinenko <phcoder@gmail.com>
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
v3 - suggestions/fixes:
- improve the documentation.
---
docs/grub-dev.texi | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
index a9f4de6..ad72705 100644
--- a/docs/grub-dev.texi
+++ b/docs/grub-dev.texi
@@ -84,6 +84,7 @@ This edition documents version @value{VERSION}.
* Video Subsystem::
* PFF2 Font File Format::
* Graphical Menu Software Design::
+* Verifiers framework::
* Copying This Manual:: Copying This Manual
* Index::
@end menu
@@ -1949,6 +1950,62 @@ the graphics mode that was in use before @code{grub_video_setup()} was called
might fix some of the problems.
+@node Verifiers framework
+@chapter Verifiers framework
+
+To register your own verifier call @samp{grub_verifier_register} with a
+structure pointing to your functions.
+
+The interface is inspired by hash interface with @samp{init}/@samp{write}/@samp{fini}.
+
+There are eesntially 2 ways of using it: hashing and whole-file verification:
+
+With hashing approach:
+During @samp{init} you decide whether you want to check given file and init context.
+In @samp{write} you update you hashing state.
+In @samp{fini} you check that hash matches the expected value/passes some check/...
+
+With whole-file verification:
+During @samp{init} you decide whether you want to check given file and init context.
+In @samp{write} you verify file and return error if it fails.
+You don't have @samp{fini}.
+
+Additional @samp{verify_string} receives various strings like kernel parameters to
+verify. Returning no error means successful verification and an error stops the current
+action.
+
+Detailed description of API:
+
+Every time a file is opened your @samp{init} function is called with file descriptor
+and file type. Your function can have following outcomes:
+
+@itemize
+
+@item returning no error and setting @samp{*flags} to @samp{GRUB_VERIFY_FLAGS_DEFER}.
+In this case verification is deferred to others active verifiers. Verification fails if
+nobody cares or selected verifier fails
+
+@item returning no error and setting @samp{*flags} to @samp{GRUB_VERIFY_FLAGS_SKIP_VERIFICATION}.
+In this case your verifier will not be called anymore and your verifier is considered
+to have skipped verification
+
+@item returning error. Then opening of the file will fail due to failed verification.
+
+@item returning no error and not setting @samp{*flags} to @samp{GRUB_VERIFY_FLAGS_SKIP_VERIFICATION}
+In this case verification is done as described in following section
+
+@end itemize
+
+In the fourth case your @samp{write} will be called with chunks of file. If you need the whole file in a single
+chunk then during @samp{init} set bit @samp{GRUB_VERIFY_FLAGS_SINGLE_CHUNK} in @samp{*flags}.
+During @samp{init} you may set @samp{*context} if you need additional context. At every iteration you may return
+an error and the the file will be considered as having failed the verification. If you return no error then
+verification continues.
+
+Optionally at the end of the file @samp{fini} if it exists is called with just the context. If you return
+no error during any of @samp{init}, @samp{write} and @samp{fini} then the file is considered as having
+succeded verification.
+
@node Copying This Manual
@appendix Copying This Manual
--
1.7.10.4
next prev parent reply other threads:[~2018-10-03 9:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 9:36 [PATCH v3 0/8] verifiers: Framework and EFI shim lock verifier Daniel Kiper
2018-10-03 9:36 ` [PATCH v3 1/8] verifiers: File type for fine-grained signature-verification controlling Daniel Kiper
2018-10-03 17:33 ` Ross Philipson
2018-10-09 13:43 ` Daniel Kiper
2018-10-03 9:36 ` [PATCH v3 2/8] verifiers: Framework core Daniel Kiper
2018-10-03 17:55 ` Ross Philipson
2018-10-09 13:48 ` Daniel Kiper
2018-10-03 9:36 ` [PATCH v3 3/8] verifiers: Add possibility to verify kernel and modules command lines Daniel Kiper
2018-10-03 9:36 ` [PATCH v3 4/8] verifiers: Add possibility to defer verification to other verifiers Daniel Kiper
2018-10-05 16:09 ` Ross Philipson
2018-10-09 13:57 ` Daniel Kiper
2018-10-03 9:36 ` [PATCH v3 5/8] verifiers: Rename verify module to pgp module Daniel Kiper
2018-10-05 16:24 ` Ross Philipson
2018-10-09 14:11 ` Daniel Kiper
2018-10-09 14:17 ` Michel Hermier
2018-10-09 14:20 ` Michel Hermier
2018-10-09 14:44 ` Ross Philipson
2018-10-09 15:06 ` Konrad Rzeszutek Wilk
2018-10-03 9:36 ` Daniel Kiper [this message]
2018-10-05 16:43 ` [PATCH v3 6/8] verifiers: Add the documentation Ross Philipson
2018-10-09 14:26 ` Daniel Kiper
2018-10-09 14:46 ` Ross Philipson
2018-10-09 14:59 ` Ross Philipson
2018-10-03 9:36 ` [PATCH v3 7/8] dl: Add support for persistent modules Daniel Kiper
2018-10-03 9:36 ` [PATCH v3 8/8] efi: Add EFI shim lock verifier Daniel Kiper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1538559415-6233-7-git-send-email-daniel.kiper@oracle.com \
--to=daniel.kiper@oracle.com \
--cc=dpsmith.dev@gmail.com \
--cc=eric.snowberg@oracle.com \
--cc=grub-devel@gnu.org \
--cc=javierm@redhat.com \
--cc=jonmccune@google.com \
--cc=kanth.ghatraju@oracle.com \
--cc=keng-yu.lin@hpe.com \
--cc=konrad.wilk@oracle.com \
--cc=leif.lindholm@linaro.org \
--cc=mjg59@srcf.ucam.org \
--cc=phcoder@gmail.com \
--cc=philip.b.tricca@intel.com \
--cc=ross.philipson@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).