evp_locl.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. /* EVP_MD_CTX related stuff */
  10. struct evp_md_ctx_st {
  11. const EVP_MD *digest;
  12. ENGINE *engine; /* functional reference if 'digest' is
  13. * ENGINE-provided */
  14. unsigned long flags;
  15. void *md_data;
  16. /* Public key context for sign/verify */
  17. EVP_PKEY_CTX *pctx;
  18. /* Update function: usually copied from EVP_MD */
  19. int (*update) (EVP_MD_CTX *ctx, const void *data, size_t count);
  20. } /* EVP_MD_CTX */ ;
  21. struct evp_cipher_ctx_st {
  22. const EVP_CIPHER *cipher;
  23. ENGINE *engine; /* functional reference if 'cipher' is
  24. * ENGINE-provided */
  25. int encrypt; /* encrypt or decrypt */
  26. int buf_len; /* number we have left */
  27. unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */
  28. unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */
  29. unsigned char buf[EVP_MAX_BLOCK_LENGTH]; /* saved partial block */
  30. int num; /* used by cfb/ofb/ctr mode */
  31. /* FIXME: Should this even exist? It appears unused */
  32. void *app_data; /* application stuff */
  33. int key_len; /* May change for variable length cipher */
  34. unsigned long flags; /* Various flags */
  35. void *cipher_data; /* per EVP data */
  36. int final_used;
  37. int block_mask;
  38. unsigned char final[EVP_MAX_BLOCK_LENGTH]; /* possible final block */
  39. } /* EVP_CIPHER_CTX */ ;
  40. struct evp_mac_ctx_st {
  41. const EVP_MAC *meth; /* Method structure */
  42. void *data; /* Individual method data */
  43. } /* EVP_MAC_CTX */;
  44. int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,
  45. int passlen, ASN1_TYPE *param,
  46. const EVP_CIPHER *c, const EVP_MD *md,
  47. int en_de);
  48. struct evp_Encode_Ctx_st {
  49. /* number saved in a partial encode/decode */
  50. int num;
  51. /*
  52. * The length is either the output line length (in input bytes) or the
  53. * shortest input line length that is ok. Once decoding begins, the
  54. * length is adjusted up each time a longer line is decoded
  55. */
  56. int length;
  57. /* data to encode */
  58. unsigned char enc_data[80];
  59. /* number read on current line */
  60. int line_num;
  61. unsigned int flags;
  62. };
  63. typedef struct evp_pbe_st EVP_PBE_CTL;
  64. DEFINE_STACK_OF(EVP_PBE_CTL)
  65. int is_partially_overlapping(const void *ptr1, const void *ptr2, int len);