libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-sha1-base64.h
Go to the documentation of this file.
1/*
2 * libwebsockets - small server side websockets and web server implementation
3 *
4 * Copyright (C) 2010 - 2019 Andy Green <andy@warmcat.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
31#ifdef LWS_SHA1_USE_OPENSSL_NAME
32#define lws_SHA1 SHA1
33#else
43LWS_VISIBLE LWS_EXTERN unsigned char *
44lws_SHA1(const unsigned char *d, size_t n, unsigned char *md);
45#endif
57lws_b64_encode_string(const char *in, int in_len, char *out, int out_size);
69lws_b64_encode_string_url(const char *in, int in_len, char *out, int out_size);
82lws_b64_decode_string(const char *in, char *out, int out_size);
96lws_b64_decode_string_len(const char *in, int in_len, char *out, int out_size);
97
99 unsigned char quad[4];
100 size_t done;
101 size_t len;
102 int i;
103 int c;
104};
105
108
110lws_b64_decode_stateful(struct lws_b64state *s, const char *in, size_t *in_len,
111 uint8_t *out, size_t *out_size, int final);
113
unsigned char quad[4]
LWS_VISIBLE LWS_EXTERN int lws_b64_encode_string_url(const char *in, int in_len, char *out, int out_size)
LWS_VISIBLE LWS_EXTERN int lws_b64_decode_stateful(struct lws_b64state *s, const char *in, size_t *in_len, uint8_t *out, size_t *out_size, int final)
LWS_VISIBLE LWS_EXTERN int lws_b64_decode_string(const char *in, char *out, int out_size)
LWS_VISIBLE LWS_EXTERN unsigned char * lws_SHA1(const unsigned char *d, size_t n, unsigned char *md)
LWS_VISIBLE LWS_EXTERN int lws_b64_encode_string(const char *in, int in_len, char *out, int out_size)
LWS_VISIBLE LWS_EXTERN void lws_b64_decode_state_init(struct lws_b64state *state)
LWS_VISIBLE LWS_EXTERN int lws_b64_decode_string_len(const char *in, int in_len, char *out, int out_size)
#define LWS_EXTERN
unsigned char uint8_t
#define LWS_VISIBLE