]>
Commit | Line | Data |
---|---|---|
d2e9e320 | 1 | /* |
33388b44 | 2 | * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. |
d02b48c6 | 3 | * |
2bcb0fc8 | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
d2e9e320 RS |
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 | |
d02b48c6 RE |
8 | */ |
9 | ||
33ee9ae0 P |
10 | /* |
11 | * MD2 low level APIs are deprecated for public use, but still ok for | |
12 | * internal use. | |
13 | */ | |
14 | #include "internal/deprecated.h" | |
15 | ||
d02b48c6 | 16 | #include <stdio.h> |
b39fc560 | 17 | #include "internal/cryptlib.h" |
ec577822 | 18 | #include <openssl/mdc2.h> |
d02b48c6 | 19 | |
9e0aad9f | 20 | unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md) |
0f113f3e MC |
21 | { |
22 | MDC2_CTX c; | |
23 | static unsigned char m[MDC2_DIGEST_LENGTH]; | |
d02b48c6 | 24 | |
0f113f3e MC |
25 | if (md == NULL) |
26 | md = m; | |
27 | if (!MDC2_Init(&c)) | |
28 | return NULL; | |
29 | MDC2_Update(&c, d, n); | |
30 | MDC2_Final(md, &c); | |
31 | OPENSSL_cleanse(&c, sizeof(c)); /* security consideration */ | |
26a7d938 | 32 | return md; |
0f113f3e | 33 | } |