m_md4.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_MD4
  12. # include <openssl/evp.h>
  13. # include <openssl/objects.h>
  14. # include <openssl/x509.h>
  15. # include <openssl/md4.h>
  16. # include <openssl/rsa.h>
  17. # include "internal/evp_int.h"
  18. static int init(EVP_MD_CTX *ctx)
  19. {
  20. return MD4_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 MD4_Update(EVP_MD_CTX_md_data(ctx), data, count);
  25. }
  26. static int final(EVP_MD_CTX *ctx, unsigned char *md)
  27. {
  28. return MD4_Final(md, EVP_MD_CTX_md_data(ctx));
  29. }
  30. static const EVP_MD md4_md = {
  31. NID_md4,
  32. NID_md4WithRSAEncryption,
  33. MD4_DIGEST_LENGTH,
  34. 0,
  35. init,
  36. update,
  37. final,
  38. NULL,
  39. NULL,
  40. MD4_CBLOCK,
  41. sizeof(EVP_MD *) + sizeof(MD4_CTX),
  42. };
  43. const EVP_MD *EVP_md4(void)
  44. {
  45. return &md4_md;
  46. }
  47. #endif