cryptosoft.h 2.3 KB

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