rand: remove unimplemented librandom stub code
[openssl.git] / crypto / mdc2 / mdc2_one.c
1 /*
2  * Copyright 1995-2020 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
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
16 #include <stdio.h>
17 #include "internal/cryptlib.h"
18 #include <openssl/mdc2.h>
19
20 unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md)
21 {
22     MDC2_CTX c;
23     static unsigned char m[MDC2_DIGEST_LENGTH];
24
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 */
32     return md;
33 }