2 * \brief Glue code for AES OpenSSL functions.
4 * \author Carsten Weinhold <weinhold@os.inf.tu-dresden.de>
7 * Copyright (C) 2006 Carsten Weinhold <weinhold@os.inf.tu-dresden.de>
8 * Technische Universitaet Dresden, Operating Systems Research Group
10 * This file is part of the libcrypto package, which is distributed under
11 * the terms of the GNU General Public Licence 2. Please see the
12 * COPYING file for details.
15 /* L4-specific includes */
19 * Unfortunately, we need wrapper functions here ...
22 static int set_key(void *ctx, const unsigned char *key, unsigned int len, unsigned int flags) {
26 ret = AES_set_encrypt_key(key, len * 8, &((crypto_aes_ctx_t *) ctx)->__aes_openssl.__enc);
30 return AES_set_decrypt_key(key, len * 8, &((crypto_aes_ctx_t *) ctx)->__aes_openssl.__dec);
33 static void encrypt(void *ctx, unsigned char *out, const unsigned char *in) {
35 AES_encrypt(in, out, &((crypto_aes_ctx_t *) ctx)->__aes_openssl.__enc);
38 static void decrypt(void *ctx, unsigned char *out, const unsigned char *in) {
40 AES_decrypt(in, out, &((crypto_aes_ctx_t *) ctx)->__aes_openssl.__dec);
43 crypto_cipher_set_key_fn_t aes_cipher_set_key = (crypto_cipher_set_key_fn_t) set_key;
44 crypto_cipher_encrypt_fn_t aes_cipher_encrypt = (crypto_cipher_encrypt_fn_t) encrypt;
45 crypto_cipher_decrypt_fn_t aes_cipher_decrypt = (crypto_cipher_decrypt_fn_t) decrypt;