aboutsummaryrefslogtreecommitdiff
path: root/providers/legacy/digests/md2.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2019-04-11 20:27:59 +1000
committerShane Lontis <shane.lontis@oracle.com>2019-06-04 12:09:50 +1000
commitd5e5e2ffafc7dbc861f7d285508cf129c5e8f5ac (patch)
tree3920b0febd6d2716940fb022b57894fe2ebf565d /providers/legacy/digests/md2.c
parentbf5b04ea25d6ac7d31e388b4e87d3eb5cd1e1e2b (diff)
downloadopenssl-d5e5e2ffafc7dbc861f7d285508cf129c5e8f5ac.zip
openssl-d5e5e2ffafc7dbc861f7d285508cf129c5e8f5ac.tar.gz
openssl-d5e5e2ffafc7dbc861f7d285508cf129c5e8f5ac.tar.bz2
Move digests to providers
Move digest code into the relevant providers (fips, default, legacy). The headers are temporarily moved to be internal, and will be moved into providers after all external references are resolved. The deprecated digest code can not be removed until EVP_PKEY (signing) is supported by providers. EVP_MD data can also not yet be cleaned up for the same reasons. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8763)
Diffstat (limited to 'providers/legacy/digests/md2.c')
-rw-r--r--providers/legacy/digests/md2.c57
1 files changed, 6 insertions, 51 deletions
diff --git a/providers/legacy/digests/md2.c b/providers/legacy/digests/md2.c
index 017a511..edd4b78 100644
--- a/providers/legacy/digests/md2.c
+++ b/providers/legacy/digests/md2.c
@@ -7,57 +7,12 @@
* https://www.openssl.org/source/license.html
*/
-#include <openssl/md2.h>
#include <openssl/crypto.h>
-#include <openssl/core_numbers.h>
-
-static int md2_final(void *ctx, unsigned char *md, size_t *size)
-{
- if (MD2_Final(md, ctx)) {
- *size = MD2_DIGEST_LENGTH;
- return 1;
- }
-
- return 0;
-}
-
-static void *md2_newctx(void)
-{
- MD2_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
-
- return ctx;
-}
-
-static void md2_freectx(void *vctx)
-{
- MD2_CTX *ctx = (MD2_CTX *)vctx;
-
- OPENSSL_clear_free(ctx, sizeof(*ctx));
-}
-
-static void *md2_dupctx(void *ctx)
-{
- MD2_CTX *in = (MD2_CTX *)ctx;
- MD2_CTX *ret = OPENSSL_malloc(sizeof(*ret));
-
- *ret = *in;
-
- return ret;
-}
+#include <openssl/md2.h>
-static size_t md2_size(void)
-{
- return MD2_DIGEST_LENGTH;
-}
+#include "internal/core_mkdigest.h"
+#include "internal/provider_algs.h"
-extern const OSSL_DISPATCH md2_functions[];
-const OSSL_DISPATCH md2_functions[] = {
- { OSSL_FUNC_DIGEST_NEWCTX, (void (*)(void))md2_newctx },
- { OSSL_FUNC_DIGEST_INIT, (void (*)(void))MD2_Init },
- { OSSL_FUNC_DIGEST_UPDATE, (void (*)(void))MD2_Update },
- { OSSL_FUNC_DIGEST_FINAL, (void (*)(void))md2_final },
- { OSSL_FUNC_DIGEST_FREECTX, (void (*)(void))md2_freectx },
- { OSSL_FUNC_DIGEST_DUPCTX, (void (*)(void))md2_dupctx },
- { OSSL_FUNC_DIGEST_SIZE, (void (*)(void))md2_size },
- { 0, NULL }
-};
+OSSL_FUNC_DIGEST_CONSTRUCT(md2, MD2_CTX,
+ MD2_BLOCK, MD2_DIGEST_LENGTH,
+ MD2_Init, MD2_Update, MD2_Final)