1210312Sjmallett/* 2210312Sjmallett * Octeon Crypto for OCF 3210312Sjmallett * 4210312Sjmallett * Written by David McCullough <david_mccullough@securecomputing.com> 5210312Sjmallett * Copyright (C) 2009 David McCullough 6210312Sjmallett * 7210312Sjmallett * LICENSE TERMS 8210312Sjmallett * 9210312Sjmallett * The free distribution and use of this software in both source and binary 10210312Sjmallett * form is allowed (with or without changes) provided that: 11210312Sjmallett * 12210312Sjmallett * 1. distributions of this source code include the above copyright 13210312Sjmallett * notice, this list of conditions and the following disclaimer; 14210312Sjmallett * 15210312Sjmallett * 2. distributions in binary form include the above copyright 16210312Sjmallett * notice, this list of conditions and the following disclaimer 17210312Sjmallett * in the documentation and/or other associated materials; 18210312Sjmallett * 19210312Sjmallett * 3. the copyright holder's name is not used to endorse products 20210312Sjmallett * built using this software without specific written permission. 21210312Sjmallett * 22210312Sjmallett * DISCLAIMER 23210312Sjmallett * 24210312Sjmallett * This software is provided 'as is' with no explicit or implied warranties 25210312Sjmallett * in respect of its properties, including, but not limited to, correctness 26210312Sjmallett * and/or fitness for purpose. 27210312Sjmallett * --------------------------------------------------------------------------- 28210312Sjmallett * 29210312Sjmallett * $FreeBSD$ 30210312Sjmallett */ 31210312Sjmallett 32210312Sjmallett#ifndef _MIPS_CAVIUM_CRYPTOCTEON_CRYPTOCTEONVAR_H_ 33210312Sjmallett#define _MIPS_CAVIUM_CRYPTOCTEON_CRYPTOCTEONVAR_H_ 34210312Sjmallett 35210312Sjmallettstruct octo_sess; 36210312Sjmallett 37210312Sjmalletttypedef int octo_encrypt_t(struct octo_sess *od, struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp); 38210312Sjmalletttypedef int octo_decrypt_t(struct octo_sess *od, struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp); 39210312Sjmallett 40210312Sjmallettstruct octo_sess { 41210312Sjmallett int octo_encalg; 42210312Sjmallett #define MAX_CIPHER_KEYLEN 64 43210312Sjmallett char octo_enckey[MAX_CIPHER_KEYLEN]; 44210312Sjmallett int octo_encklen; 45210312Sjmallett 46210312Sjmallett int octo_macalg; 47210312Sjmallett #define MAX_HASH_KEYLEN 64 48210312Sjmallett char octo_mackey[MAX_HASH_KEYLEN]; 49210312Sjmallett int octo_macklen; 50210312Sjmallett int octo_mackey_set; 51210312Sjmallett 52210312Sjmallett int octo_mlen; 53210312Sjmallett int octo_ivsize; 54210312Sjmallett 55210312Sjmallett octo_encrypt_t *octo_encrypt; 56210312Sjmallett octo_decrypt_t *octo_decrypt; 57210312Sjmallett 58210312Sjmallett uint64_t octo_hminner[3]; 59210312Sjmallett uint64_t octo_hmouter[3]; 60210312Sjmallett 61210312Sjmallett struct iovec octo_iov[UIO_MAXIOV]; 62210312Sjmallett}; 63210312Sjmallett 64210312Sjmallett#define dprintf(fmt, ...) \ 65210312Sjmallett do { \ 66210312Sjmallett if (cryptocteon_debug) \ 67210312Sjmallett printf("%s: " fmt, __func__, ## __VA_ARGS__); \ 68210312Sjmallett } while (0) 69210312Sjmallett 70210312Sjmallettextern int cryptocteon_debug; 71210312Sjmallett 72210312Sjmallettvoid octo_calc_hash(uint8_t, unsigned char *, uint64_t *, uint64_t *); 73210312Sjmallett 74210312Sjmallett/* XXX Actually just hashing functions, not encryption. */ 75210312Sjmallettocto_encrypt_t octo_null_md5_encrypt; 76210312Sjmallettocto_encrypt_t octo_null_sha1_encrypt; 77210312Sjmallett 78210312Sjmallettocto_encrypt_t octo_des_cbc_encrypt; 79210312Sjmallettocto_encrypt_t octo_des_cbc_md5_encrypt; 80210312Sjmallettocto_encrypt_t octo_des_cbc_sha1_encrypt; 81210312Sjmallett 82210312Sjmallettocto_decrypt_t octo_des_cbc_decrypt; 83210312Sjmallettocto_decrypt_t octo_des_cbc_md5_decrypt; 84210312Sjmallettocto_decrypt_t octo_des_cbc_sha1_decrypt; 85210312Sjmallett 86210312Sjmallettocto_encrypt_t octo_aes_cbc_encrypt; 87210312Sjmallettocto_encrypt_t octo_aes_cbc_md5_encrypt; 88210312Sjmallettocto_encrypt_t octo_aes_cbc_sha1_encrypt; 89210312Sjmallett 90210312Sjmallettocto_decrypt_t octo_aes_cbc_decrypt; 91210312Sjmallettocto_decrypt_t octo_aes_cbc_md5_decrypt; 92210312Sjmallettocto_decrypt_t octo_aes_cbc_sha1_decrypt; 93210312Sjmallett 94210312Sjmallett#endif /* !_MIPS_CAVIUM_CRYPTOCTEON_CRYPTOCTEONVAR_H_ */ 95