55c97c66a7
on-board USB controller. It is not currently enabled because there are known problems with device communication and until those are fixed I am not certain that it won't destabilize the system. [1] o) Add the "cryptocteon" opencrypto device based on the OCF device written by David McCullough. It is not currently enabled because until support for saving/restoring coprocessor 2 state on context switch is available, it runs with interrupts disabled, which tends to pessimize performance over using a software crypto facility. Tests using this driver which are not negatively affected by it running with interrupts disabled show it to be substantially faster than software for large blocks. Submitted by: hps [1]
95 lines
2.9 KiB
C
95 lines
2.9 KiB
C
/*
|
|
* Octeon Crypto for OCF
|
|
*
|
|
* Written by David McCullough <david_mccullough@securecomputing.com>
|
|
* Copyright (C) 2009 David McCullough
|
|
*
|
|
* LICENSE TERMS
|
|
*
|
|
* The free distribution and use of this software in both source and binary
|
|
* form is allowed (with or without changes) provided that:
|
|
*
|
|
* 1. distributions of this source code include the above copyright
|
|
* notice, this list of conditions and the following disclaimer;
|
|
*
|
|
* 2. distributions in binary form include the above copyright
|
|
* notice, this list of conditions and the following disclaimer
|
|
* in the documentation and/or other associated materials;
|
|
*
|
|
* 3. the copyright holder's name is not used to endorse products
|
|
* built using this software without specific written permission.
|
|
*
|
|
* DISCLAIMER
|
|
*
|
|
* This software is provided 'as is' with no explicit or implied warranties
|
|
* in respect of its properties, including, but not limited to, correctness
|
|
* and/or fitness for purpose.
|
|
* ---------------------------------------------------------------------------
|
|
*
|
|
* $FreeBSD$
|
|
*/
|
|
|
|
#ifndef _MIPS_CAVIUM_CRYPTOCTEON_CRYPTOCTEONVAR_H_
|
|
#define _MIPS_CAVIUM_CRYPTOCTEON_CRYPTOCTEONVAR_H_
|
|
|
|
struct octo_sess;
|
|
|
|
typedef 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);
|
|
typedef 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);
|
|
|
|
struct octo_sess {
|
|
int octo_encalg;
|
|
#define MAX_CIPHER_KEYLEN 64
|
|
char octo_enckey[MAX_CIPHER_KEYLEN];
|
|
int octo_encklen;
|
|
|
|
int octo_macalg;
|
|
#define MAX_HASH_KEYLEN 64
|
|
char octo_mackey[MAX_HASH_KEYLEN];
|
|
int octo_macklen;
|
|
int octo_mackey_set;
|
|
|
|
int octo_mlen;
|
|
int octo_ivsize;
|
|
|
|
octo_encrypt_t *octo_encrypt;
|
|
octo_decrypt_t *octo_decrypt;
|
|
|
|
uint64_t octo_hminner[3];
|
|
uint64_t octo_hmouter[3];
|
|
|
|
struct iovec octo_iov[UIO_MAXIOV];
|
|
};
|
|
|
|
#define dprintf(fmt, ...) \
|
|
do { \
|
|
if (cryptocteon_debug) \
|
|
printf("%s: " fmt, __func__, ## __VA_ARGS__); \
|
|
} while (0)
|
|
|
|
extern int cryptocteon_debug;
|
|
|
|
void octo_calc_hash(uint8_t, unsigned char *, uint64_t *, uint64_t *);
|
|
|
|
/* XXX Actually just hashing functions, not encryption. */
|
|
octo_encrypt_t octo_null_md5_encrypt;
|
|
octo_encrypt_t octo_null_sha1_encrypt;
|
|
|
|
octo_encrypt_t octo_des_cbc_encrypt;
|
|
octo_encrypt_t octo_des_cbc_md5_encrypt;
|
|
octo_encrypt_t octo_des_cbc_sha1_encrypt;
|
|
|
|
octo_decrypt_t octo_des_cbc_decrypt;
|
|
octo_decrypt_t octo_des_cbc_md5_decrypt;
|
|
octo_decrypt_t octo_des_cbc_sha1_decrypt;
|
|
|
|
octo_encrypt_t octo_aes_cbc_encrypt;
|
|
octo_encrypt_t octo_aes_cbc_md5_encrypt;
|
|
octo_encrypt_t octo_aes_cbc_sha1_encrypt;
|
|
|
|
octo_decrypt_t octo_aes_cbc_decrypt;
|
|
octo_decrypt_t octo_aes_cbc_md5_decrypt;
|
|
octo_decrypt_t octo_aes_cbc_sha1_decrypt;
|
|
|
|
#endif /* !_MIPS_CAVIUM_CRYPTOCTEON_CRYPTOCTEONVAR_H_ */
|