Index: stand/Makefile =================================================================== --- stand/Makefile +++ stand/Makefile @@ -22,6 +22,8 @@ S.yes+= man S.${MK_LOADER_GELI}+= geli +SUBDIR+= boot_crypto +SUBDIR+= man .include Index: stand/boot_crypto/Makefile =================================================================== --- /dev/null +++ stand/boot_crypto/Makefile @@ -0,0 +1,35 @@ +# $FreeBSD$ +# libboot_crypto + +MAN= + +.include +MK_SSP= no + +LIB= boot_crypto +INTERNALLIB= +MK_PROFILE= no +NO_PIC= + +WARNS?= 0 + +# sha256 and sha512 from sys/crypto +.PATH: ${SYSDIR}/crypto/sha2 +CFLAGS+= -DWEAK_REFS +SRCS+= sha256c.c sha512c.c + +# md5 from libmd +.PATH: ${SRCTOP}/lib/libmd +SRCS+= md5c.c + +# AES implementation from sys/crypto +.PATH: ${SYSDIR}/crypto/rijndael +CFLAGS+= -I${LDRSRC} +# Remove asserts +CFLAGS+= -DNDEBUG +SRCS+= rijndael-alg-fst.c rijndael-api-fst.c rijndael-api.c + +SRCS+= boot_crypto.c boot_crypto_aes.c + +.include +.include Index: stand/boot_crypto/boot_crypto.h =================================================================== --- /dev/null +++ stand/boot_crypto/boot_crypto.h @@ -0,0 +1,187 @@ +/*- + * Copyright (c) 2016 Eric McCorkle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _BOOT_CRYPTO_H_ +#define _BOOT_CRYPTO_H_ + +#include "boot_crypto_types.h" +#include "boot_crypto_aes.h" + +/* We want all the codes from cryptodev, but not the defs. Maybe + * these should be moved out to a separate file to allow them to be + * included separately? + */ + +/* Hash values */ +#define NULL_HASH_LEN 16 +#define MD5_HASH_LEN 16 +#define SHA1_HASH_LEN 20 +#define RIPEMD160_HASH_LEN 20 +#define SHA2_256_HASH_LEN 32 +#define SHA2_384_HASH_LEN 48 +#define SHA2_512_HASH_LEN 64 +#define MD5_KPDK_HASH_LEN 16 +#define SHA1_KPDK_HASH_LEN 20 +#define AES_GMAC_HASH_LEN 16 +/* Maximum hash algorithm result length */ +#define HASH_MAX_LEN SHA2_512_HASH_LEN /* Keep this updated */ + +/* HMAC values */ +#define NULL_HMAC_BLOCK_LEN 64 +#define MD5_HMAC_BLOCK_LEN 64 +#define SHA1_HMAC_BLOCK_LEN 64 +#define RIPEMD160_HMAC_BLOCK_LEN 64 +#define SHA2_256_HMAC_BLOCK_LEN 64 +#define SHA2_384_HMAC_BLOCK_LEN 128 +#define SHA2_512_HMAC_BLOCK_LEN 128 +/* Maximum HMAC block length */ +#define HMAC_MAX_BLOCK_LEN SHA2_512_HMAC_BLOCK_LEN /* Keep this updated */ +#define HMAC_IPAD_VAL 0x36 +#define HMAC_OPAD_VAL 0x5C +/* HMAC Key Length */ +#define NULL_HMAC_KEY_LEN 0 +#define MD5_HMAC_KEY_LEN 16 +#define SHA1_HMAC_KEY_LEN 20 +#define RIPEMD160_HMAC_KEY_LEN 20 +#define SHA2_256_HMAC_KEY_LEN 32 +#define SHA2_384_HMAC_KEY_LEN 48 +#define SHA2_512_HMAC_KEY_LEN 64 +#define AES_128_GMAC_KEY_LEN 16 +#define AES_192_GMAC_KEY_LEN 24 +#define AES_256_GMAC_KEY_LEN 32 + +/* Encryption algorithm block sizes */ +#define NULL_BLOCK_LEN 4 /* IPsec to maintain alignment */ +#define DES_BLOCK_LEN 8 +#define DES3_BLOCK_LEN 8 +#define BLOWFISH_BLOCK_LEN 8 +#define SKIPJACK_BLOCK_LEN 8 +#define CAST128_BLOCK_LEN 8 +#define RIJNDAEL128_BLOCK_LEN 16 +#define AES_BLOCK_LEN 16 +#define AES_ICM_BLOCK_LEN 1 +#define ARC4_BLOCK_LEN 1 +#define CAMELLIA_BLOCK_LEN 16 +#define EALG_MAX_BLOCK_LEN AES_BLOCK_LEN /* Keep this updated */ + +/* IV Lengths */ + +#define ARC4_IV_LEN 1 +#define AES_GCM_IV_LEN 12 +#define AES_XTS_IV_LEN 8 +#define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ + +/* Min and Max Encryption Key Sizes */ +#define NULL_MIN_KEY 0 +#define NULL_MAX_KEY 256 /* 2048 bits, max key */ +#define DES_MIN_KEY 8 +#define DES_MAX_KEY DES_MIN_KEY +#define TRIPLE_DES_MIN_KEY 24 +#define TRIPLE_DES_MAX_KEY TRIPLE_DES_MIN_KEY +#define BLOWFISH_MIN_KEY 5 +#define BLOWFISH_MAX_KEY 56 /* 448 bits, max key */ +#define CAST_MIN_KEY 5 +#define CAST_MAX_KEY 16 +#define SKIPJACK_MIN_KEY 10 +#define SKIPJACK_MAX_KEY SKIPJACK_MIN_KEY +#define RIJNDAEL_MIN_KEY 16 +#define RIJNDAEL_MAX_KEY 32 +#define AES_MIN_KEY RIJNDAEL_MIN_KEY +#define AES_MAX_KEY RIJNDAEL_MAX_KEY +#define AES_XTS_MIN_KEY (2 * AES_MIN_KEY) +#define AES_XTS_MAX_KEY (2 * AES_MAX_KEY) +#define ARC4_MIN_KEY 1 +#define ARC4_MAX_KEY 32 +#define CAMELLIA_MIN_KEY 8 +#define CAMELLIA_MAX_KEY 32 + +/* Maximum hash algorithm result length */ +#define AALG_MAX_RESULT_LEN 64 /* Keep this updated */ + +#define CRYPTO_ALGORITHM_MIN 1 +#define CRYPTO_DES_CBC 1 +#define CRYPTO_3DES_CBC 2 +#define CRYPTO_BLF_CBC 3 +#define CRYPTO_CAST_CBC 4 +#define CRYPTO_SKIPJACK_CBC 5 +#define CRYPTO_MD5_HMAC 6 +#define CRYPTO_SHA1_HMAC 7 +#define CRYPTO_RIPEMD160_HMAC 8 +#define CRYPTO_MD5_KPDK 9 +#define CRYPTO_SHA1_KPDK 10 +#define CRYPTO_RIJNDAEL128_CBC 11 /* 128 bit blocksize */ +#define CRYPTO_AES_CBC 11 /* 128 bit blocksize -- the same as above */ +#define CRYPTO_ARC4 12 +#define CRYPTO_MD5 13 +#define CRYPTO_SHA1 14 +#define CRYPTO_NULL_HMAC 15 +#define CRYPTO_NULL_CBC 16 +#define CRYPTO_DEFLATE_COMP 17 /* Deflate compression algorithm */ +#define CRYPTO_SHA2_256_HMAC 18 +#define CRYPTO_SHA2_384_HMAC 19 +#define CRYPTO_SHA2_512_HMAC 20 +#define CRYPTO_CAMELLIA_CBC 21 +#define CRYPTO_AES_XTS 22 +#define CRYPTO_AES_ICM 23 /* commonly known as CTR mode */ +#define CRYPTO_AES_NIST_GMAC 24 /* cipher side */ +#define CRYPTO_AES_NIST_GCM_16 25 /* 16 byte ICV */ +#define CRYPTO_AES_128_NIST_GMAC 26 /* auth side */ +#define CRYPTO_AES_192_NIST_GMAC 27 /* auth side */ +#define CRYPTO_AES_256_NIST_GMAC 28 /* auth side */ +#define CRYPTO_ALGORITHM_MAX 28 /* Keep updated - see below */ + +#define CRYPTO_ALGO_VALID(x) ((x) >= CRYPTO_ALGORITHM_MIN && \ + (x) <= CRYPTO_ALGORITHM_MAX) + +/* Algorithm flags */ +#define CRYPTO_ALG_FLAG_SUPPORTED 0x01 /* Algorithm is supported */ +#define CRYPTO_ALG_FLAG_RNG_ENABLE 0x02 /* Has HW RNG for DH/DSA */ +#define CRYPTO_ALG_FLAG_DSA_SHA 0x04 /* Can do SHA on msg */ + +struct symmetric_alg_t { + int (*ctxinit)(symmetric_alg_ctx_t *ctx, int enc, const u_char *key, + size_t keylen, u_char *iv); + int (*encrypt)(symmetric_alg_ctx_t *ctx, u_char *data, size_t len); + int (*decrypt)(symmetric_alg_ctx_t *ctx, u_char *data, size_t len); +}; + +union symmetric_alg_ctx_t { + struct aes_xts_ctx aes_xts; + struct aes_cbc_ctx aes_cbc; +}; + +/* Initalize a key and decrypt data */ +extern int decrypt_symmetric(const symmetric_alg_t *alg, u_char *data, + size_t datalen, const u_char *key, size_t keylen, + u_char *iv); +extern int encrypt_symmetric(const symmetric_alg_t *alg, u_char *data, + size_t datalen, const u_char *key, size_t keylen, + u_char *iv); +extern const symmetric_alg_t* get_symmetric_alg(int alg); + +#endif Index: stand/boot_crypto/boot_crypto.c =================================================================== --- /dev/null +++ stand/boot_crypto/boot_crypto.c @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2016 Eric McCorkle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +#include "boot_crypto.h" +#include "boot_crypto_aes.h" + +int decrypt_symmetric(const symmetric_alg_t *alg, u_char *data, size_t datalen, + const u_char *key, size_t keylen, u_char *iv) +{ + symmetric_alg_ctx_t ctx; + int res; + + res = alg->ctxinit(&ctx, 0, key, keylen, iv); + + if(0 != res) { + return (res); + } else { + return alg->decrypt(&ctx, data, datalen); + } +} + +int encrypt_symmetric(const symmetric_alg_t *alg, u_char *data, size_t datalen, + const u_char *key, size_t keylen, u_char *iv) +{ + symmetric_alg_ctx_t ctx; + int res; + + res = alg->ctxinit(&ctx, 1, key, keylen, iv); + + if(0 != res) { + return (res); + } else { + return alg->encrypt(&ctx, data, datalen); + } +} + +const symmetric_alg_t* get_symmetric_alg(int alg) { + switch(alg) { + case CRYPTO_AES_XTS: return &alg_aes_xts; + case CRYPTO_AES_CBC: return &alg_aes_cbc; + default: return NULL; + } +} Index: stand/boot_crypto/boot_crypto_aes.h =================================================================== --- /dev/null +++ stand/boot_crypto/boot_crypto_aes.h @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2016 Eric McCorkle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _BOOT_CRYPTO_AES_H_ +#define _BOOT_CRYPTO_AES_H_ + +#include "boot_crypto_types.h" + +#include + +#define AES_XTS_BLOCKSIZE 16 +#define AES_XTS_IVSIZE 8 +#define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ + +struct aes_xts_ctx { + rijndael_ctx key1; + rijndael_ctx key2; + u_int8_t tweak[AES_XTS_BLOCKSIZE]; +}; + +struct aes_cbc_ctx { + keyInstance aeskey; + cipherInstance cipher; +}; + +extern const symmetric_alg_t alg_aes_cbc; +extern const symmetric_alg_t alg_aes_xts; + +#endif Index: stand/boot_crypto/boot_crypto_aes.c =================================================================== --- /dev/null +++ stand/boot_crypto/boot_crypto_aes.c @@ -0,0 +1,207 @@ +/*- + * Copyright (c) 2016 Eric McCorkle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +#include "boot_crypto.h" +#include "boot_crypto_aes.h" + +static int +aes_xts_ctxinit(symmetric_alg_ctx_t *ptr, int enc __unused, + const u_char *key, size_t keylen, u_char *iv) +{ + struct aes_xts_ctx *ctx = &ptr->aes_xts; + u_int64_t blocknum; + size_t xts_len = keylen << 1; + u_int i; + + rijndael_set_key(&(ctx->key1), key, xts_len / 2); + rijndael_set_key(&(ctx->key2), key + (xts_len / 16), xts_len / 2); + /* + * Prepare tweak as E_k2(IV). IV is specified as LE representation + * of a 64-bit block number which we allow to be passed in directly. + */ + bcopy(iv, &blocknum, AES_XTS_IVSIZE); + for (i = 0; i < AES_XTS_IVSIZE; i++) { + ctx->tweak[i] = blocknum & 0xff; + blocknum >>= 8; + } + /* Last 64 bits of IV are always zero */ + bzero(ctx->tweak + AES_XTS_IVSIZE, AES_XTS_IVSIZE); + rijndael_encrypt(&ctx->key2, ctx->tweak, ctx->tweak); + + return (0); +} + +static int +aes_xts_decrypt_block(symmetric_alg_ctx_t *ptr, u_char *data) +{ + struct aes_xts_ctx *ctx = &ptr->aes_xts; + u_int8_t block[AES_XTS_BLOCKSIZE]; + u_int i, carry_in, carry_out; + + for (i = 0; i < AES_XTS_BLOCKSIZE; i++) + block[i] = data[i] ^ ctx->tweak[i]; + + rijndael_decrypt(&ctx->key1, block, data); + + for (i = 0; i < AES_XTS_BLOCKSIZE; i++) + data[i] ^= ctx->tweak[i]; + + /* Exponentiate tweak */ + carry_in = 0; + for (i = 0; i < AES_XTS_BLOCKSIZE; i++) { + carry_out = ctx->tweak[i] & 0x80; + ctx->tweak[i] = (ctx->tweak[i] << 1) | (carry_in ? 1 : 0); + carry_in = carry_out; + } + if (carry_in) + ctx->tweak[0] ^= AES_XTS_ALPHA; + bzero(block, sizeof(block)); + + return (0); +} + +static int +aes_xts_decrypt(symmetric_alg_ctx_t *ctx, u_char *data, size_t len) +{ + u_int i; + + for (i = 0; i < len; i += AES_XTS_BLOCKSIZE) { + aes_xts_decrypt_block(ctx, data + i); + } + + return (0); +} + +static int +aes_xts_encrypt_block(symmetric_alg_ctx_t *ptr, u_char *data) +{ + struct aes_xts_ctx *ctx = &ptr->aes_xts; + u_int8_t block[AES_XTS_BLOCKSIZE]; + u_int i, carry_in, carry_out; + + for (i = 0; i < AES_XTS_BLOCKSIZE; i++) + block[i] = data[i] ^ ctx->tweak[i]; + + rijndael_encrypt(&ctx->key1, block, data); + + for (i = 0; i < AES_XTS_BLOCKSIZE; i++) + data[i] ^= ctx->tweak[i]; + + /* Exponentiate tweak */ + carry_in = 0; + for (i = 0; i < AES_XTS_BLOCKSIZE; i++) { + carry_out = ctx->tweak[i] & 0x80; + ctx->tweak[i] = (ctx->tweak[i] << 1) | (carry_in ? 1 : 0); + carry_in = carry_out; + } + if (carry_in) + ctx->tweak[0] ^= AES_XTS_ALPHA; + bzero(block, sizeof(block)); + + return (0); +} + +static int +aes_xts_encrypt(symmetric_alg_ctx_t *ctx, u_char *data, size_t len) +{ + u_int i; + + for (i = 0; i < len; i += AES_XTS_BLOCKSIZE) { + aes_xts_encrypt_block(ctx, data + i); + } + + return (0); +} + +static int +aes_cbc_ctxinit(symmetric_alg_ctx_t *ptr, int enc, const u_char *key, + size_t keylen, u_char *iv) +{ + struct aes_cbc_ctx *ctx = &ptr->aes_cbc; + int err; + + err = rijndael_makeKey(&ctx->aeskey, !enc, keylen, + (const char *)key); + if (err < 0) { + return (err); + } + + err = rijndael_cipherInit(&ctx->cipher, MODE_CBC, iv); + if (err < 0) { + return (err); + } + + return (0); +} + +static int +aes_cbc_decrypt(symmetric_alg_ctx_t *ptr, u_char *data, size_t len) +{ + struct aes_cbc_ctx *ctx = &ptr->aes_cbc; + int blks; + + blks = rijndael_blockDecrypt(&ctx->cipher, &ctx->aeskey, data, + len * 8, data); + + if (len != (blks / 8)) { + return (1); + } else { + return (0); + } +} + +static int +aes_cbc_encrypt(symmetric_alg_ctx_t *ptr, u_char *data, size_t len) +{ + struct aes_cbc_ctx *ctx = &ptr->aes_cbc; + int blks; + + blks = rijndael_blockEncrypt(&ctx->cipher, &ctx->aeskey, data, + len * 8, data); + + if (len != (blks / 8)) { + return (1); + } else { + return (0); + } +} + +const symmetric_alg_t alg_aes_xts = { + .ctxinit = aes_xts_ctxinit, + .decrypt = aes_xts_decrypt, + .encrypt = aes_xts_encrypt +}; + +const symmetric_alg_t alg_aes_cbc = { + .ctxinit = aes_cbc_ctxinit, + .decrypt = aes_cbc_decrypt, + .encrypt = aes_cbc_encrypt +}; Index: stand/boot_crypto/boot_crypto_types.h =================================================================== --- /dev/null +++ stand/boot_crypto/boot_crypto_types.h @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2016 Eric McCorkle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _BOOT_CRYPTO_TYPES_H_ +#define _BOOT_CRYPTO_TYPES_H_ + +#include + +typedef struct symmetric_alg_t symmetric_alg_t; +typedef union symmetric_alg_ctx_t symmetric_alg_ctx_t; + +#endif