*** /usr/src/sys/geom/eli/g_eli.c.orig  Tue Dec 21 18:09:25 2010
--- /usr/src/sys/geom/eli/g_eli.c       Tue Sep 13 09:46:22 2011
***************
*** 24,34 ****
   * SUCH DAMAGE.
   */
  
  #include <sys/cdefs.h>
  __FBSDID("$FreeBSD: src/sys/geom/eli/g_eli.c,v 1.44.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $");
! 
  #include <sys/param.h>
  #include <sys/systm.h>
  #include <sys/kernel.h>
  #include <sys/linker.h>
  #include <sys/module.h>
--- 24,34 ----
   * SUCH DAMAGE.
   */
  
  #include <sys/cdefs.h>
  __FBSDID("$FreeBSD: src/sys/geom/eli/g_eli.c,v 1.44.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $");
! #include "opt_geom.h"
  #include <sys/param.h>
  #include <sys/systm.h>
  #include <sys/kernel.h>
  #include <sys/linker.h>
  #include <sys/module.h>
***************
*** 975,997 ****
        struct g_eli_softc *sc;
  
        sc = gp->softc;
        return (g_eli_destroy(sc, FALSE));
  }
  
  static int
  g_eli_keyfiles_load(struct hmac_ctx *ctx, const char *provider)
  {
        u_char *keyfile, *data, *size;
        char *file, name[64];
        int i;
  
!       for (i = 0; ; i++) {
                snprintf(name, sizeof(name), "%s:geli_keyfile%d", provider, i);
                keyfile = preload_search_by_type(name);
                if (keyfile == NULL)
!                       return (i);     /* Return number of loaded keyfiles. */
                data = preload_search_info(keyfile, MODINFO_ADDR);
                if (data == NULL) {
                        G_ELI_DEBUG(0, "Cannot find key file data for %s.",
                            name);
                        return (0);
--- 975,1011 ----
        struct g_eli_softc *sc;
  
        sc = gp->softc;
        return (g_eli_destroy(sc, FALSE));
  }
+ #ifdef GELI_KEY_SIZE
+ char _geli_key[GELI_KEY_SIZE] = "GELI_KEY_HERE";
+ #endif
  
  static int
  g_eli_keyfiles_load(struct hmac_ctx *ctx, const char *provider)
  {
        u_char *keyfile, *data, *size;
        char *file, name[64];
        int i;
  
!       int did_it = 0;
! #if defined(GELI_KEY_SIZE) && defined(GELI_PROVIDER)
!       if (!strcmp(provider, GELI_PROVIDER)) {
!               did_it++;
!               g_eli_crypto_hmac_update(ctx, _geli_key, GELI_KEY_SIZE);
!       }
!       snprintf(name, sizeof(name), "%s:geli_keyfile0", GELI_PROVIDER);
! #else
! #error "GELI STUFF NOT DEFINED"
! #endif
! for (i = 0; ; i++) {
                snprintf(name, sizeof(name), "%s:geli_keyfile%d", provider, i);
                keyfile = preload_search_by_type(name);
                if (keyfile == NULL)
!                       return (i + did_it);    /* Return number of loaded keyfiles. */
                data = preload_search_info(keyfile, MODINFO_ADDR);
                if (data == NULL) {
                        G_ELI_DEBUG(0, "Cannot find key file data for %s.",
                            name);
                        return (0);

MichaelSchöne/g_eli.c.diff (last edited 2011-09-13 14:19:21 by MichaelSchöne)