1 /* $OpenBSD: cryptosoft.h,v 1.10 2002/04/22 23:10:09 deraadt 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 with or 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 struct enc_xform *SW_exf; 40 } SWCR_ENC; 41 struct { 42 u_int32_t SW_size; 43 struct comp_algo *SW_cxf; 44 } SWCR_COMP; 45 } SWCR_UN; 46 47 #define sw_ictx SWCR_UN.SWCR_AUTH.SW_ictx 48 #define sw_octx SWCR_UN.SWCR_AUTH.SW_octx 49 #define sw_klen SWCR_UN.SWCR_AUTH.SW_klen 50 #define sw_axf SWCR_UN.SWCR_AUTH.SW_axf 51 #define sw_kschedule SWCR_UN.SWCR_ENC.SW_kschedule 52 #define sw_exf SWCR_UN.SWCR_ENC.SW_exf 53 #define sw_size SWCR_UN.SWCR_COMP.SW_size 54 #define sw_cxf SWCR_UN.SWCR_COMP.SW_cxf 55 56 struct swcr_data *sw_next; 57 }; 58 59 #ifdef _KERNEL 60 extern u_int8_t hmac_ipad_buffer[64]; 61 extern u_int8_t hmac_opad_buffer[64]; 62 63 int swcr_encdec(struct cryptodesc *, struct swcr_data *, caddr_t, int); 64 int swcr_authcompute(struct cryptop *, struct cryptodesc *, struct swcr_data *, 65 caddr_t, int); 66 int swcr_compdec(struct cryptodesc *, struct swcr_data *, caddr_t, int); 67 int swcr_process(struct cryptop *); 68 int swcr_newsession(u_int32_t *, struct cryptoini *); 69 int swcr_freesession(u_int64_t); 70 void swcr_init(void); 71 #endif /* _KERNEL */ 72 73 #endif /* _CRYPTO_CRYPTO_H_ */ 74