/* * Cryptographic API. * * Copyright (c) 2004 Michal Ludvig * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * */ #ifndef _CRYPTO_PADLOCK_H #define _CRYPTO_PADLOCK_H #define AES_MIN_KEY_SIZE 16 /* in u8 units */ #define AES_MAX_KEY_SIZE 32 /* ditto */ #define AES_BLOCK_SIZE 16 /* ditto */ #define AES_EXTENDED_KEY_SIZE 64 /* in u32 units */ #define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(u32)) struct aes_ctx { u32 e_data[AES_EXTENDED_KEY_SIZE+4]; u32 d_data[AES_EXTENDED_KEY_SIZE+4]; int key_length; u32 *E; u32 *D; }; #define E_KEY ctx->E #define D_KEY ctx->D /* Control word. */ #if 1 union cword { u32 cword[4]; struct { int rounds:4; int algo:3; int keygen:1; int interm:1; int encdec:1; int ksize:2; } b; }; #else union cword { u32 cword[4]; struct { unsigned rounds:4, algo:3, keygen:1, interm:1, encdec:1, ksize:2; } b; }; #endif #define PFX "padlock: " void padlock_aligner(u8 *out_arg, const u8 *in_arg, const u8 *iv_arg, void *key, union cword *cword, size_t nbytes, size_t blocksize, int encdec, int mode); int padlock_init_aes(void); void padlock_fini_aes(void); #endif /* _CRYPTO_PADLOCK_H */