m_mdc2.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the OpenSSL license (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. #include <stdio.h>
  10. #include "internal/cryptlib.h"
  11. #ifndef OPENSSL_NO_MDC2
  12. # include <openssl/evp.h>
  13. # include <openssl/objects.h>
  14. # include <openssl/x509.h>
  15. # include <openssl/mdc2.h>
  16. # include <openssl/rsa.h>
  17. # include "internal/evp_int.h"
  18. static int init(EVP_MD_CTX *ctx)
  19. {
  20. return MDC2_Init(EVP_MD_CTX_md_data(ctx));
  21. }
  22. static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
  23. {
  24. return MDC2_Update(EVP_MD_CTX_md_data(ctx), data, count);
  25. }
  26. static int final(EVP_MD_CTX *ctx, unsigned char *md)
  27. {
  28. return MDC2_Final(md, EVP_MD_CTX_md_data(ctx));
  29. }
  30. static const EVP_MD mdc2_md = {
  31. NID_mdc2,
  32. NID_mdc2WithRSA,
  33. MDC2_DIGEST_LENGTH,
  34. 0,
  35. init,
  36. update,
  37. final,
  38. NULL,
  39. NULL,
  40. MDC2_BLOCK,
  41. sizeof(EVP_MD *) + sizeof(MDC2_CTX),
  42. };
  43. const EVP_MD *EVP_mdc2(void)
  44. {
  45. return &mdc2_md;
  46. }
  47. #endif