3. 配置内核

为了使用 Cryptoloop,您需要激活一些内核选项。您可以选择将这些要求编译为模块,或者直接编译到内核中。以下步骤将它们作为模块启用。如果您不熟悉构建 2.6 内核,您应该参考 Linux Kernel HOWTO。以下说明仅提供最基本步骤。

  1. 转到包含您的内核源代码树的目录(通常是/usr/src/linux/),并开始配置

    make menuconfig
  2. 启用通用环回设备支持。激活 “环回设备支持”

    Device Drivers -> Block Devices -> Loopback device support
  3. 在同一部分启用 Cryptoloop 支持。一旦您启用通用环回支持,该选项应该就会出现。

  4. 通过从主菜单转到 “加密选项” 来启用加密 API。您可以安全地在此处启用大多数算法。我建议您启用以下选项

        -- Cryptographic API
         <*>   HMAC support  
         < >   Null algorithms
         <*>   MD4 digest algorithm
         <*>   MD5 digest algorithm
         <*>   SHA1 digest algorithm
         <*>   SHA256 digest algorithm
         <*>   SHA384 and SHA512 digest algorithms
         <*>   DES and Triple DES EDE cipher algorithms
         <*>   Blowfish cipher algorithm
         <*>   Twofish cipher algorithm
         <*>   Serpent cipher algorithm 
         <*>   AES cipher algorithms
         <*>   CAST5 (CAST-128) cipher algorithm
         <*>   CAST6 (CAST-256) cipher algorithm 
         <*>   Deflate compression algorithm
         < >   Testing module
            

    如果您决定将它们作为模块,请确保在继续之前在启动时加载相应的模块(cryptoloop、aes 等)。

  5. 编译您的内核和模块并安装它们。例如,如果您在 x86 机器上使用 lilo,可以这样做

         make
         make modules_install
         cp arch/i386/boot/bzImage /boot/kernel-2.6.1
         lilo
            
  6. 在启动时加载所需的模块。这在不同的发行版中处理方式不同。例如,在 Gentoo 上,这些模块可以添加到/etc/modules.autoload/kernel-2.6。如果您已将 Cryptoloop 编译为模块,则必须首先加载它。它也会自动加载基本的环回设备模块。您可以手动加载模块,使用命令

    modprobe cryptoloop