aesni.h (255187) | aesni.h (257757) |
---|---|
1/*- 2 * Copyright (c) 2010 Konstantin Belousov <kib@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2010 Konstantin Belousov <kib@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/crypto/aesni/aesni.h 255187 2013-09-03 18:31:23Z jmg $ | 26 * $FreeBSD: head/sys/crypto/aesni/aesni.h 257757 2013-11-06 19:14:49Z jmg $ |
27 */ 28 29#ifndef _AESNI_H_ 30#define _AESNI_H_ 31 32#include <sys/types.h> 33#include <sys/malloc.h> 34#include <sys/queue.h> --- 31 unchanged lines hidden (view full) --- 66 uint32_t id; 67 TAILQ_ENTRY(aesni_session) next; 68 struct fpu_kern_ctx *fpu_ctx; 69}; 70 71/* 72 * Internal functions, implemented in assembler. 73 */ | 27 */ 28 29#ifndef _AESNI_H_ 30#define _AESNI_H_ 31 32#include <sys/types.h> 33#include <sys/malloc.h> 34#include <sys/queue.h> --- 31 unchanged lines hidden (view full) --- 66 uint32_t id; 67 TAILQ_ENTRY(aesni_session) next; 68 struct fpu_kern_ctx *fpu_ctx; 69}; 70 71/* 72 * Internal functions, implemented in assembler. 73 */ |
74void aesni_set_enckey(const uint8_t *userkey, uint8_t *encrypt_schedule, 75 int number_of_rounds); 76void aesni_set_deckey(const uint8_t *encrypt_schedule, 77 uint8_t *decrypt_schedule, int number_of_rounds); | 74void aesni_set_enckey(const uint8_t *userkey, 75 uint8_t *encrypt_schedule /*__aligned(16)*/, int number_of_rounds); 76void aesni_set_deckey(const uint8_t *encrypt_schedule /*__aligned(16)*/, 77 uint8_t *decrypt_schedule /*__aligned(16)*/, int number_of_rounds); |
78 79/* 80 * Slightly more public interfaces. 81 */ | 78 79/* 80 * Slightly more public interfaces. 81 */ |
82void aesni_encrypt_cbc(int rounds, const void *key_schedule, size_t len, 83 const uint8_t *from, uint8_t *to, const uint8_t iv[AES_BLOCK_LEN]); 84void aesni_decrypt_cbc(int rounds, const void *key_schedule, size_t len, 85 uint8_t *buf, const uint8_t iv[AES_BLOCK_LEN]); 86void aesni_encrypt_ecb(int rounds, const void *key_schedule, size_t len, 87 const uint8_t from[AES_BLOCK_LEN], uint8_t to[AES_BLOCK_LEN]); 88void aesni_decrypt_ecb(int rounds, const void *key_schedule, size_t len, 89 const uint8_t from[AES_BLOCK_LEN], uint8_t to[AES_BLOCK_LEN]); 90 91void aesni_encrypt_xts(int rounds, const void *data_schedule, 92 const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, | 82void aesni_encrypt_cbc(int rounds, const void *key_schedule /*__aligned(16)*/, 83 size_t len, const uint8_t *from, uint8_t *to, |
93 const uint8_t iv[AES_BLOCK_LEN]); | 84 const uint8_t iv[AES_BLOCK_LEN]); |
94void aesni_decrypt_xts(int rounds, const void *data_schedule, 95 const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, 96 const uint8_t iv[AES_BLOCK_LEN]); | 85void aesni_decrypt_cbc(int rounds, const void *key_schedule /*__aligned(16)*/, 86 size_t len, uint8_t *buf, const uint8_t iv[AES_BLOCK_LEN]); 87void aesni_encrypt_ecb(int rounds, const void *key_schedule /*__aligned(16)*/, 88 size_t len, const uint8_t *from, uint8_t *to); 89void aesni_decrypt_ecb(int rounds, const void *key_schedule /*__aligned(16)*/, 90 size_t len, const uint8_t *from, uint8_t *to); |
97 | 91 |
92void aesni_encrypt_xts(int rounds, const void *data_schedule /*__aligned(16)*/, 93 const void *tweak_schedule /*__aligned(16)*/, size_t len, 94 const uint8_t *from, uint8_t *to, const uint8_t iv[AES_BLOCK_LEN]); 95void aesni_decrypt_xts(int rounds, const void *data_schedule /*__aligned(16)*/, 96 const void *tweak_schedule /*__aligned(16)*/, size_t len, 97 const uint8_t *from, uint8_t *to, const uint8_t iv[AES_BLOCK_LEN]); 98 |
|
98int aesni_cipher_setup(struct aesni_session *ses, 99 struct cryptoini *encini); 100int aesni_cipher_process(struct aesni_session *ses, 101 struct cryptodesc *enccrd, struct cryptop *crp); 102 103uint8_t *aesni_cipher_alloc(struct cryptodesc *enccrd, struct cryptop *crp, 104 int *allocated); 105 | 99int aesni_cipher_setup(struct aesni_session *ses, 100 struct cryptoini *encini); 101int aesni_cipher_process(struct aesni_session *ses, 102 struct cryptodesc *enccrd, struct cryptop *crp); 103 104uint8_t *aesni_cipher_alloc(struct cryptodesc *enccrd, struct cryptop *crp, 105 int *allocated); 106 |
106#endif | 107#endif /* _AESNI_H_ */ |