1 /* $OpenBSD: cryptosoft.h,v 1.6 2001/07/05 08:26:05 jjbg Exp $ */ 2 3 /* 4 * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) 5 * 6 * This code was written by Angelos D. Keromytis in Athens, Greece, in 7 * February 2000. Network Security Technologies Inc. (NSTI) kindly 8 * supported the development of this code. 9 * 10 * Copyright (c) 2000 Angelos D. Keromytis 11 * 12 * Permission to use, copy, and modify this software without fee 13 * is hereby granted, provided that this entire notice is included in 14 * all source code copies of any software which is or includes a copy or 15 * modification of this software. 16 * 17 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR 18 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY 19 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE 20 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR 21 * PURPOSE. 22 */ 23 24 #ifndef _CRYPTO_CRYPTOSOFT_H_ 25 #define _CRYPTO_CRYPTOSOFT_H_ 26 27 /* Software session entry */ 28 struct swcr_data { 29 int sw_alg; /* Algorithm */ 30 union { 31 struct { 32 u_int8_t *SW_ictx; 33 u_int8_t *SW_octx; 34 u_int32_t SW_klen; 35 struct auth_hash *SW_axf; 36 } SWCR_AUTH; 37 struct { 38 u_int8_t *SW_kschedule; 39 u_int8_t *SW_iv; 40 struct enc_xform *SW_exf; 41 } SWCR_ENC; 42 struct { 43 u_int32_t SW_size; 44 struct comp_algo *SW_cxf; 45 } SWCR_COMP; 46 } SWCR_UN; 47 48 #define sw_ictx SWCR_UN.SWCR_AUTH.SW_ictx 49 #define sw_octx SWCR_UN.SWCR_AUTH.SW_octx 50 #define sw_klen SWCR_UN.SWCR_AUTH.SW_klen 51 #define sw_axf SWCR_UN.SWCR_AUTH.SW_axf 52 #define sw_kschedule SWCR_UN.SWCR_ENC.SW_kschedule 53 #define sw_iv SWCR_UN.SWCR_ENC.SW_iv 54 #define sw_exf SWCR_UN.SWCR_ENC.SW_exf 55 #define sw_size SWCR_UN.SWCR_COMP.SW_size 56 #define sw_cxf SWCR_UN.SWCR_COMP.SW_cxf 57 58 struct swcr_data *sw_next; 59 }; 60 61 #ifdef _KERNEL 62 extern u_int8_t hmac_ipad_buffer[64]; 63 extern u_int8_t hmac_opad_buffer[64]; 64 65 int swcr_encdec(struct cryptodesc *, struct swcr_data *, caddr_t, int); 66 int swcr_authcompute(struct cryptodesc *, struct swcr_data *, 67 caddr_t, int); 68 int swcr_compdec(struct cryptodesc *, struct swcr_data *, caddr_t, int); 69 int swcr_process(struct cryptop *); 70 int swcr_newsession(u_int32_t *, struct cryptoini *); 71 int swcr_freesession(u_int64_t); 72 void swcr_init(void); 73 #endif /* _KERNEL */ 74 75 #endif /* _CRYPTO_CRYPTO_H_ */ 76