2 * libwebsockets - generic crypto api hiding the backend
4 * Copyright (C) 2017 - 2018 Andy Green <andy@warmcat.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation:
9 * version 2.1 of the License.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 * lws-gencrypto openssl-specific common code
24 #include "private-lib-core.h"
25 #include "private-lib-tls-openssl.h"
28 * Care: many openssl apis return 1 for success. These are translated to the
29 * lws convention of 0 for success.
33 lws_gencrypto_openssl_hash_to_NID(enum lws_genhash_types hash_type)
38 case LWS_GENHASH_TYPE_UNKNOWN:
40 case LWS_GENHASH_TYPE_MD5:
43 case LWS_GENHASH_TYPE_SHA1:
46 case LWS_GENHASH_TYPE_SHA256:
49 case LWS_GENHASH_TYPE_SHA384:
52 case LWS_GENHASH_TYPE_SHA512:
61 lws_gencrypto_openssl_hash_to_EVP_MD(enum lws_genhash_types hash_type)
63 const EVP_MD *h = NULL;
66 case LWS_GENHASH_TYPE_UNKNOWN:
68 case LWS_GENHASH_TYPE_MD5:
71 case LWS_GENHASH_TYPE_SHA1:
74 case LWS_GENHASH_TYPE_SHA256:
77 case LWS_GENHASH_TYPE_SHA384:
80 case LWS_GENHASH_TYPE_SHA512: