• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
25 #define LWS_AESGCM_IV 12
26 #define LWS_AESGCM_TAG 16
27 
28 /* jwe-rsa-aescbc.c */
29 
30 int
31 lws_jwe_auth_and_decrypt_rsa_aes_cbc_hs(struct lws_jwe *jwe);
32 
33 
34 int
35 lws_jwe_encrypt_rsa_aes_cbc_hs(struct lws_jwe *jwe,
36 			       char *temp, int *temp_len);
37 
38 int
39 lws_jwe_auth_and_decrypt_cbc_hs(struct lws_jwe *jwe, uint8_t *enc_cek,
40 				uint8_t *aad, int aad_len);
41 
42 
43 /* jws-rsa-aesgcm.c */
44 
45 int
46 lws_jwe_auth_and_decrypt_gcm(struct lws_jwe *jwe, uint8_t *enc_cek,
47 			     uint8_t *aad, int aad_len);
48 
49 int
50 lws_jwe_auth_and_decrypt_rsa_aes_gcm(struct lws_jwe *jwe);
51 
52 int
53 lws_jwe_encrypt_gcm(struct lws_jwe *jwe,
54 		    uint8_t *enc_cek, uint8_t *aad, int aad_len);
55 
56 int
57 lws_jwe_encrypt_rsa_aes_gcm(struct lws_jwe *jwe,
58 			    char *temp, int *temp_len);
59 
60 
61 
62 
63 /* jwe-rsa-aeskw.c */
64 
65 int
66 lws_jwe_encrypt_aeskw_cbc_hs(struct lws_jwe *jwe,
67 			     char *temp, int *temp_len);
68 
69 int
70 lws_jwe_auth_and_decrypt_aeskw_cbc_hs(struct lws_jwe *jwe);
71 
72 /* aescbc.c */
73 
74 int
75 lws_jwe_auth_and_decrypt_cbc_hs(struct lws_jwe *jwe, uint8_t *enc_cek,
76 				uint8_t *aad, int aad_len);
77 
78 int
79 lws_jwe_encrypt_cbc_hs(struct lws_jwe *jwe,
80 		       uint8_t *cek, uint8_t *aad, int aad_len);
81 
82 int
83 lws_jwe_auth_and_decrypt_ecdh_cbc_hs(struct lws_jwe *jwe,
84 		char *temp, int *temp_len);
85 
86 int
87 lws_jwe_encrypt_ecdh_cbc_hs(struct lws_jwe *jwe,
88 		 	     char *temp, int *temp_len);
89