evp_locl.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright 2000-2019 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 *reqdigest; /* The original requested digest */
  12. const EVP_MD *digest;
  13. ENGINE *engine; /* functional reference if 'digest' is
  14. * ENGINE-provided */
  15. unsigned long flags;
  16. void *md_data;
  17. /* Public key context for sign/verify */
  18. EVP_PKEY_CTX *pctx;
  19. /* Update function: usually copied from EVP_MD */
  20. int (*update) (EVP_MD_CTX *ctx, const void *data, size_t count);
  21. /* Provider ctx */
  22. void *provctx;
  23. EVP_MD *fetched_digest;
  24. } /* EVP_MD_CTX */ ;
  25. struct evp_cipher_ctx_st {
  26. const EVP_CIPHER *cipher;
  27. ENGINE *engine; /* functional reference if 'cipher' is
  28. * ENGINE-provided */
  29. int encrypt; /* encrypt or decrypt */
  30. int buf_len; /* number we have left */
  31. unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */
  32. unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */
  33. unsigned char buf[EVP_MAX_BLOCK_LENGTH]; /* saved partial block */
  34. int num; /* used by cfb/ofb/ctr mode */
  35. /* FIXME: Should this even exist? It appears unused */
  36. void *app_data; /* application stuff */
  37. int key_len; /* May change for variable length cipher */
  38. unsigned long flags; /* Various flags */
  39. void *cipher_data; /* per EVP data */
  40. int final_used;
  41. int block_mask;
  42. unsigned char final[EVP_MAX_BLOCK_LENGTH]; /* possible final block */
  43. /* Provider ctx */
  44. void *provctx;
  45. EVP_CIPHER *fetched_cipher;
  46. } /* EVP_CIPHER_CTX */ ;
  47. struct evp_mac_ctx_st {
  48. const EVP_MAC *meth; /* Method structure */
  49. void *data; /* Individual method data */
  50. } /* EVP_MAC_CTX */;
  51. struct evp_kdf_ctx_st {
  52. const EVP_KDF *meth; /* Method structure */
  53. EVP_KDF_IMPL *impl; /* Algorithm-specific data */
  54. } /* EVP_KDF_CTX */ ;
  55. int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,
  56. int passlen, ASN1_TYPE *param,
  57. const EVP_CIPHER *c, const EVP_MD *md,
  58. int en_de);
  59. struct evp_Encode_Ctx_st {
  60. /* number saved in a partial encode/decode */
  61. int num;
  62. /*
  63. * The length is either the output line length (in input bytes) or the
  64. * shortest input line length that is ok. Once decoding begins, the
  65. * length is adjusted up each time a longer line is decoded
  66. */
  67. int length;
  68. /* data to encode */
  69. unsigned char enc_data[80];
  70. /* number read on current line */
  71. int line_num;
  72. unsigned int flags;
  73. };
  74. typedef struct evp_pbe_st EVP_PBE_CTL;
  75. DEFINE_STACK_OF(EVP_PBE_CTL)
  76. int is_partially_overlapping(const void *ptr1, const void *ptr2, int len);
  77. #include <openssl/ossl_typ.h>
  78. #include <openssl/core.h>
  79. void *evp_generic_fetch(OPENSSL_CTX *ctx, int operation_id,
  80. const char *algorithm, const char *properties,
  81. void *(*new_method)(const OSSL_DISPATCH *fns,
  82. OSSL_PROVIDER *prov),
  83. int (*upref_method)(void *),
  84. void (*free_method)(void *));