aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/lgl
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2008-08-24 18:03:05 +0000
committerChristian Grothoff <christian@grothoff.org>2008-08-24 18:03:05 +0000
commit9181dd0a072670d61a2e6839f23d7e33165ca089 (patch)
tree88806884c43d3579c3a357d8b26d1843e009ceab /src/daemon/https/lgl
parent484e65d76e26874485e906f5221156442bb52467 (diff)
downloadlibmicrohttpd-9181dd0a072670d61a2e6839f23d7e33165ca089.tar.gz
libmicrohttpd-9181dd0a072670d61a2e6839f23d7e33165ca089.zip
indenting
Diffstat (limited to 'src/daemon/https/lgl')
-rw-r--r--src/daemon/https/lgl/des.h30
-rw-r--r--src/daemon/https/lgl/gc.h210
-rw-r--r--src/daemon/https/lgl/gettext.h33
-rw-r--r--src/daemon/https/lgl/hmac.h4
-rw-r--r--src/daemon/https/lgl/md5.h24
-rw-r--r--src/daemon/https/lgl/printf-args.h62
-rw-r--r--src/daemon/https/lgl/printf-parse.h78
-rw-r--r--src/daemon/https/lgl/rijndael-alg-fst.c10
-rw-r--r--src/daemon/https/lgl/rijndael-alg-fst.h8
-rw-r--r--src/daemon/https/lgl/rijndael-api-fst.h50
-rw-r--r--src/daemon/https/lgl/sha1.h6
-rw-r--r--src/daemon/https/lgl/vasnprintf.h17
-rw-r--r--src/daemon/https/lgl/xsize.h17
13 files changed, 252 insertions, 297 deletions
diff --git a/src/daemon/https/lgl/des.h b/src/daemon/https/lgl/des.h
index fdc8686f..a80ede84 100644
--- a/src/daemon/https/lgl/des.h
+++ b/src/daemon/https/lgl/des.h
@@ -47,8 +47,7 @@ typedef struct
47 47
48/* Check whether the 8 byte key is weak. Does not check the parity 48/* Check whether the 8 byte key is weak. Does not check the parity
49 * bits of the key but simple ignore them. */ 49 * bits of the key but simple ignore them. */
50extern bool 50extern bool gl_des_is_weak_key (const char *key);
51gl_des_is_weak_key (const char * key);
52 51
53/* 52/*
54 * DES 53 * DES
@@ -58,19 +57,17 @@ gl_des_is_weak_key (const char * key);
58/* Fill a DES context CTX with subkeys calculated from 64bit KEY. 57/* Fill a DES context CTX with subkeys calculated from 64bit KEY.
59 * Does not check parity bits, but simply ignore them. Does not check 58 * Does not check parity bits, but simply ignore them. Does not check
60 * for weak keys. */ 59 * for weak keys. */
61extern void 60extern void gl_des_setkey (gl_des_ctx * ctx, const char *key);
62gl_des_setkey (gl_des_ctx *ctx, const char * key);
63 61
64/* Fill a DES context CTX with subkeys calculated from 64bit KEY, with 62/* Fill a DES context CTX with subkeys calculated from 64bit KEY, with
65 * weak key checking. Does not check parity bits, but simply ignore 63 * weak key checking. Does not check parity bits, but simply ignore
66 * them. */ 64 * them. */
67extern bool 65extern bool gl_des_makekey (gl_des_ctx * ctx, const char *key, size_t keylen);
68gl_des_makekey (gl_des_ctx *ctx, const char * key, size_t keylen);
69 66
70/* Electronic Codebook Mode DES encryption/decryption of data 67/* Electronic Codebook Mode DES encryption/decryption of data
71 * according to 'mode'. */ 68 * according to 'mode'. */
72extern void 69extern void
73gl_des_ecb_crypt (gl_des_ctx *ctx, const char * from, char * to, int mode); 70gl_des_ecb_crypt (gl_des_ctx * ctx, const char *from, char *to, int mode);
74 71
75#define gl_des_ecb_encrypt(ctx, from, to) gl_des_ecb_crypt(ctx, from, to, 0) 72#define gl_des_ecb_encrypt(ctx, from, to) gl_des_ecb_crypt(ctx, from, to, 0)
76#define gl_des_ecb_decrypt(ctx, from, to) gl_des_ecb_crypt(ctx, from, to, 1) 73#define gl_des_ecb_decrypt(ctx, from, to) gl_des_ecb_crypt(ctx, from, to, 1)
@@ -83,9 +80,7 @@ gl_des_ecb_crypt (gl_des_ctx *ctx, const char * from, char * to, int mode);
83 * 64bit keys in KEY1 and KEY2. Does not check the parity bits of the 80 * 64bit keys in KEY1 and KEY2. Does not check the parity bits of the
84 * keys, but simply ignore them. Does not check for weak keys. */ 81 * keys, but simply ignore them. Does not check for weak keys. */
85extern void 82extern void
86gl_3des_set2keys (gl_3des_ctx *ctx, 83gl_3des_set2keys (gl_3des_ctx * ctx, const char *key1, const char *key2);
87 const char * key1,
88 const char * key2);
89 84
90/* 85/*
91 * Fill a Triple-DES context CTX with subkeys calculated from three 86 * Fill a Triple-DES context CTX with subkeys calculated from three
@@ -93,27 +88,20 @@ gl_3des_set2keys (gl_3des_ctx *ctx,
93 * of the keys, but simply ignore them. Does not check for weak 88 * of the keys, but simply ignore them. Does not check for weak
94 * keys. */ 89 * keys. */
95extern void 90extern void
96gl_3des_set3keys (gl_3des_ctx *ctx, 91gl_3des_set3keys (gl_3des_ctx * ctx,
97 const char * key1, 92 const char *key1, const char *key2, const char *key3);
98 const char * key2,
99 const char * key3);
100 93
101/* Fill a Triple-DES context CTX with subkeys calculated from three 94/* Fill a Triple-DES context CTX with subkeys calculated from three
102 * concatenated 64bit keys in KEY, with weak key checking. Does not 95 * concatenated 64bit keys in KEY, with weak key checking. Does not
103 * check the parity bits of the keys, but simply ignore them. */ 96 * check the parity bits of the keys, but simply ignore them. */
104extern bool 97extern bool
105gl_3des_makekey (gl_3des_ctx *ctx, 98gl_3des_makekey (gl_3des_ctx * ctx, const char *key, size_t keylen);
106 const char * key,
107 size_t keylen);
108 99
109/* Electronic Codebook Mode Triple-DES encryption/decryption of data 100/* Electronic Codebook Mode Triple-DES encryption/decryption of data
110 * according to 'mode'. Sometimes this mode is named 'EDE' mode 101 * according to 'mode'. Sometimes this mode is named 'EDE' mode
111 * (Encryption-Decryption-Encryption). */ 102 * (Encryption-Decryption-Encryption). */
112extern void 103extern void
113gl_3des_ecb_crypt (gl_3des_ctx *ctx, 104gl_3des_ecb_crypt (gl_3des_ctx * ctx, const char *from, char *to, int mode);
114 const char * from,
115 char * to,
116 int mode);
117 105
118#define gl_3des_ecb_encrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,0) 106#define gl_3des_ecb_encrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,0)
119#define gl_3des_ecb_decrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,1) 107#define gl_3des_ecb_decrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,1)
diff --git a/src/daemon/https/lgl/gc.h b/src/daemon/https/lgl/gc.h
index 688e624a..1e1f808c 100644
--- a/src/daemon/https/lgl/gc.h
+++ b/src/daemon/https/lgl/gc.h
@@ -25,37 +25,37 @@
25# include <stddef.h> 25# include <stddef.h>
26 26
27enum Gc_rc 27enum Gc_rc
28 { 28{
29 GC_OK = 0, 29 GC_OK = 0,
30 GC_MALLOC_ERROR, 30 GC_MALLOC_ERROR,
31 GC_INIT_ERROR, 31 GC_INIT_ERROR,
32 GC_RANDOM_ERROR, 32 GC_RANDOM_ERROR,
33 GC_INVALID_CIPHER, 33 GC_INVALID_CIPHER,
34 GC_INVALID_HASH, 34 GC_INVALID_HASH,
35 GC_PKCS5_INVALID_ITERATION_COUNT, 35 GC_PKCS5_INVALID_ITERATION_COUNT,
36 GC_PKCS5_INVALID_DERIVED_KEY_LENGTH, 36 GC_PKCS5_INVALID_DERIVED_KEY_LENGTH,
37 GC_PKCS5_DERIVED_KEY_TOO_LONG 37 GC_PKCS5_DERIVED_KEY_TOO_LONG
38 }; 38};
39typedef enum Gc_rc Gc_rc; 39typedef enum Gc_rc Gc_rc;
40 40
41/* Hash types. */ 41/* Hash types. */
42enum Gc_hash 42enum Gc_hash
43 { 43{
44 GC_MD4, 44 GC_MD4,
45 GC_MD5, 45 GC_MD5,
46 GC_SHA1, 46 GC_SHA1,
47 GC_MD2, 47 GC_MD2,
48 GC_RMD160, 48 GC_RMD160,
49 GC_SHA256, 49 GC_SHA256,
50 GC_SHA384, 50 GC_SHA384,
51 GC_SHA512 51 GC_SHA512
52 }; 52};
53typedef enum Gc_hash Gc_hash; 53typedef enum Gc_hash Gc_hash;
54 54
55enum Gc_hash_mode 55enum Gc_hash_mode
56 { 56{
57 GC_HMAC = 1 57 GC_HMAC = 1
58 }; 58};
59typedef enum Gc_hash_mode Gc_hash_mode; 59typedef enum Gc_hash_mode Gc_hash_mode;
60 60
61typedef void *gc_hash_handle; 61typedef void *gc_hash_handle;
@@ -71,88 +71,71 @@ typedef void *gc_hash_handle;
71 71
72/* Cipher types. */ 72/* Cipher types. */
73enum Gc_cipher 73enum Gc_cipher
74 { 74{
75 GC_AES128, 75 GC_AES128,
76 GC_AES192, 76 GC_AES192,
77 GC_AES256, 77 GC_AES256,
78 GC_3DES, 78 GC_3DES,
79 GC_DES, 79 GC_DES,
80 GC_ARCFOUR128, 80 GC_ARCFOUR128,
81 GC_ARCFOUR40, 81 GC_ARCFOUR40,
82 GC_ARCTWO40, 82 GC_ARCTWO40,
83 GC_CAMELLIA128, 83 GC_CAMELLIA128,
84 GC_CAMELLIA256 84 GC_CAMELLIA256
85 }; 85};
86typedef enum Gc_cipher Gc_cipher; 86typedef enum Gc_cipher Gc_cipher;
87 87
88enum Gc_cipher_mode 88enum Gc_cipher_mode
89 { 89{
90 GC_ECB, 90 GC_ECB,
91 GC_CBC, 91 GC_CBC,
92 GC_STREAM 92 GC_STREAM
93 }; 93};
94typedef enum Gc_cipher_mode Gc_cipher_mode; 94typedef enum Gc_cipher_mode Gc_cipher_mode;
95 95
96typedef void * gc_cipher_handle; 96typedef void *gc_cipher_handle;
97 97
98/* Call before respectively after any other functions. */ 98/* Call before respectively after any other functions. */
99Gc_rc gc_init(void); 99Gc_rc gc_init (void);
100void gc_done(void); 100void gc_done (void);
101 101
102/* Memory allocation (avoid). */ 102/* Memory allocation (avoid). */
103typedef void *(*gc_malloc_t)(size_t n); 103typedef void *(*gc_malloc_t) (size_t n);
104typedef int (*gc_secure_check_t)(const void *); 104typedef int (*gc_secure_check_t) (const void *);
105typedef void *(*gc_realloc_t)(void *p, 105typedef void *(*gc_realloc_t) (void *p, size_t n);
106 size_t n); 106typedef void (*gc_free_t) (void *);
107typedef void (*gc_free_t)(void *); 107void gc_set_allocators (gc_malloc_t func_malloc,
108void gc_set_allocators(gc_malloc_t func_malloc, 108 gc_malloc_t secure_malloc,
109 gc_malloc_t secure_malloc, 109 gc_secure_check_t secure_check,
110 gc_secure_check_t secure_check, 110 gc_realloc_t func_realloc, gc_free_t func_free);
111 gc_realloc_t func_realloc,
112 gc_free_t func_free);
113 111
114/* Randomness. */ 112/* Randomness. */
115Gc_rc gc_nonce(char *data, 113Gc_rc gc_nonce (char *data, size_t datalen);
116 size_t datalen); 114Gc_rc gc_pseudo_random (char *data, size_t datalen);
117Gc_rc gc_pseudo_random(char *data, 115Gc_rc gc_random (char *data, size_t datalen);
118 size_t datalen);
119Gc_rc gc_random(char *data,
120 size_t datalen);
121 116
122/* Ciphers. */ 117/* Ciphers. */
123Gc_rc gc_cipher_open(Gc_cipher cipher, 118Gc_rc gc_cipher_open (Gc_cipher cipher,
124 Gc_cipher_mode mode, 119 Gc_cipher_mode mode, gc_cipher_handle * outhandle);
125 gc_cipher_handle *outhandle); 120Gc_rc gc_cipher_setkey (gc_cipher_handle handle,
126Gc_rc gc_cipher_setkey(gc_cipher_handle handle, 121 size_t keylen, const char *key);
127 size_t keylen, 122Gc_rc gc_cipher_setiv (gc_cipher_handle handle, size_t ivlen, const char *iv);
128 const char *key); 123Gc_rc gc_cipher_encrypt_inline (gc_cipher_handle handle,
129Gc_rc gc_cipher_setiv(gc_cipher_handle handle, 124 size_t len, char *data);
130 size_t ivlen, 125Gc_rc gc_cipher_decrypt_inline (gc_cipher_handle handle,
131 const char *iv); 126 size_t len, char *data);
132Gc_rc gc_cipher_encrypt_inline(gc_cipher_handle handle, 127Gc_rc gc_cipher_close (gc_cipher_handle handle);
133 size_t len,
134 char *data);
135Gc_rc gc_cipher_decrypt_inline(gc_cipher_handle handle,
136 size_t len,
137 char *data);
138Gc_rc gc_cipher_close(gc_cipher_handle handle);
139 128
140/* Hashes. */ 129/* Hashes. */
141 130
142Gc_rc gc_hash_open(Gc_hash hash, 131Gc_rc gc_hash_open (Gc_hash hash,
143 Gc_hash_mode mode, 132 Gc_hash_mode mode, gc_hash_handle * outhandle);
144 gc_hash_handle *outhandle); 133Gc_rc gc_hash_clone (gc_hash_handle handle, gc_hash_handle * outhandle);
145Gc_rc gc_hash_clone(gc_hash_handle handle, 134size_t gc_hash_digest_length (Gc_hash hash);
146 gc_hash_handle *outhandle); 135void gc_hash_hmac_setkey (gc_hash_handle handle, size_t len, const char *key);
147size_t gc_hash_digest_length(Gc_hash hash); 136void gc_hash_write (gc_hash_handle handle, size_t len, const char *data);
148void gc_hash_hmac_setkey(gc_hash_handle handle, 137const char *gc_hash_read (gc_hash_handle handle);
149 size_t len, 138void gc_hash_close (gc_hash_handle handle);
150 const char *key);
151void gc_hash_write(gc_hash_handle handle,
152 size_t len,
153 const char *data);
154const char *gc_hash_read(gc_hash_handle handle);
155void gc_hash_close(gc_hash_handle handle);
156 139
157/* Compute a hash value over buffer IN of INLEN bytes size using the 140/* Compute a hash value over buffer IN of INLEN bytes size using the
158 algorithm HASH, placing the result in the pre-allocated buffer OUT. 141 algorithm HASH, placing the result in the pre-allocated buffer OUT.
@@ -160,34 +143,18 @@ void gc_hash_close(gc_hash_handle handle);
160 GC_<HASH>_DIGEST_SIZE. For example, for GC_MD5 the output buffer 143 GC_<HASH>_DIGEST_SIZE. For example, for GC_MD5 the output buffer
161 must be 16 bytes. The return value is 0 (GC_OK) on success, or 144 must be 16 bytes. The return value is 0 (GC_OK) on success, or
162 another Gc_rc error code. */ 145 another Gc_rc error code. */
163Gc_rc gc_hash_buffer(Gc_hash hash, 146Gc_rc gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *out);
164 const void *in,
165 size_t inlen,
166 char *out);
167 147
168/* One-call interface. */ 148/* One-call interface. */
169Gc_rc gc_md2(const void *in, 149Gc_rc gc_md2 (const void *in, size_t inlen, void *resbuf);
170 size_t inlen, 150Gc_rc gc_md4 (const void *in, size_t inlen, void *resbuf);
171 void *resbuf); 151Gc_rc gc_md5 (const void *in, size_t inlen, void *resbuf);
172Gc_rc gc_md4(const void *in, 152Gc_rc gc_sha1 (const void *in, size_t inlen, void *resbuf);
173 size_t inlen, 153Gc_rc gc_hmac_md5 (const void *key,
174 void *resbuf); 154 size_t keylen, const void *in, size_t inlen, char *resbuf);
175Gc_rc gc_md5(const void *in, 155Gc_rc gc_hmac_sha1 (const void *key,
176 size_t inlen, 156 size_t keylen,
177 void *resbuf); 157 const void *in, size_t inlen, char *resbuf);
178Gc_rc gc_sha1(const void *in,
179 size_t inlen,
180 void *resbuf);
181Gc_rc gc_hmac_md5(const void *key,
182 size_t keylen,
183 const void *in,
184 size_t inlen,
185 char *resbuf);
186Gc_rc gc_hmac_sha1(const void *key,
187 size_t keylen,
188 const void *in,
189 size_t inlen,
190 char *resbuf);
191 158
192/* Derive cryptographic keys from a password P of length PLEN, with 159/* Derive cryptographic keys from a password P of length PLEN, with
193 salt S of length SLEN, placing the result in pre-allocated buffer 160 salt S of length SLEN, placing the result in pre-allocated buffer
@@ -196,13 +163,10 @@ Gc_rc gc_hmac_sha1(const void *key,
196 counts are 1000-20000). This function "stretches" the key to be 163 counts are 1000-20000). This function "stretches" the key to be
197 exactly dkLen bytes long. GC_OK is returned on success, otherwise 164 exactly dkLen bytes long. GC_OK is returned on success, otherwise
198 an Gc_rc error code is returned. */ 165 an Gc_rc error code is returned. */
199Gc_rc gc_pbkdf2_sha1(const char *P, 166Gc_rc gc_pbkdf2_sha1 (const char *P,
200 size_t Plen, 167 size_t Plen,
201 const char *S, 168 const char *S,
202 size_t Slen, 169 size_t Slen, unsigned int c, char *DK, size_t dkLen);
203 unsigned int c,
204 char *DK,
205 size_t dkLen);
206 170
207/* 171/*
208 TODO: 172 TODO:
diff --git a/src/daemon/https/lgl/gettext.h b/src/daemon/https/lgl/gettext.h
index bd214d5c..75a3eb1d 100644
--- a/src/daemon/https/lgl/gettext.h
+++ b/src/daemon/https/lgl/gettext.h
@@ -131,8 +131,7 @@ inline
131#endif 131#endif
132static const char * 132static const char *
133pgettext_aux (const char *domain, 133pgettext_aux (const char *domain,
134 const char *msg_ctxt_id, const char *msgid, 134 const char *msg_ctxt_id, const char *msgid, int category)
135 int category)
136{ 135{
137 const char *translation = dcgettext (domain, msg_ctxt_id, category); 136 const char *translation = dcgettext (domain, msg_ctxt_id, category);
138 if (translation == msg_ctxt_id) 137 if (translation == msg_ctxt_id)
@@ -150,9 +149,8 @@ inline
150#endif 149#endif
151static const char * 150static const char *
152npgettext_aux (const char *domain, 151npgettext_aux (const char *domain,
153 const char *msg_ctxt_id, const char *msgid, 152 const char *msg_ctxt_id, const char *msgid,
154 const char *msgid_plural, unsigned long int n, 153 const char *msgid_plural, unsigned long int n, int category)
155 int category)
156{ 154{
157 const char *translation = 155 const char *translation =
158 dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); 156 dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
@@ -190,8 +188,7 @@ inline
190#endif 188#endif
191static const char * 189static const char *
192dcpgettext_expr (const char *domain, 190dcpgettext_expr (const char *domain,
193 const char *msgctxt, const char *msgid, 191 const char *msgctxt, const char *msgid, int category)
194 int category)
195{ 192{
196 size_t msgctxt_len = strlen (msgctxt) + 1; 193 size_t msgctxt_len = strlen (msgctxt) + 1;
197 size_t msgid_len = strlen (msgid) + 1; 194 size_t msgid_len = strlen (msgid) + 1;
@@ -202,8 +199,7 @@ dcpgettext_expr (const char *domain,
202 char buf[1024]; 199 char buf[1024];
203 char *msg_ctxt_id = 200 char *msg_ctxt_id =
204 (msgctxt_len + msgid_len <= sizeof (buf) 201 (msgctxt_len + msgid_len <= sizeof (buf)
205 ? buf 202 ? buf : (char *) malloc (msgctxt_len + msgid_len));
206 : (char *) malloc (msgctxt_len + msgid_len));
207 if (msg_ctxt_id != NULL) 203 if (msg_ctxt_id != NULL)
208#endif 204#endif
209 { 205 {
@@ -213,10 +209,10 @@ dcpgettext_expr (const char *domain,
213 translation = dcgettext (domain, msg_ctxt_id, category); 209 translation = dcgettext (domain, msg_ctxt_id, category);
214#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 210#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
215 if (msg_ctxt_id != buf) 211 if (msg_ctxt_id != buf)
216 free (msg_ctxt_id); 212 free (msg_ctxt_id);
217#endif 213#endif
218 if (translation != msg_ctxt_id) 214 if (translation != msg_ctxt_id)
219 return translation; 215 return translation;
220 } 216 }
221 return msgid; 217 return msgid;
222} 218}
@@ -235,9 +231,8 @@ inline
235#endif 231#endif
236static const char * 232static const char *
237dcnpgettext_expr (const char *domain, 233dcnpgettext_expr (const char *domain,
238 const char *msgctxt, const char *msgid, 234 const char *msgctxt, const char *msgid,
239 const char *msgid_plural, unsigned long int n, 235 const char *msgid_plural, unsigned long int n, int category)
240 int category)
241{ 236{
242 size_t msgctxt_len = strlen (msgctxt) + 1; 237 size_t msgctxt_len = strlen (msgctxt) + 1;
243 size_t msgid_len = strlen (msgid) + 1; 238 size_t msgid_len = strlen (msgid) + 1;
@@ -248,21 +243,21 @@ dcnpgettext_expr (const char *domain,
248 char buf[1024]; 243 char buf[1024];
249 char *msg_ctxt_id = 244 char *msg_ctxt_id =
250 (msgctxt_len + msgid_len <= sizeof (buf) 245 (msgctxt_len + msgid_len <= sizeof (buf)
251 ? buf 246 ? buf : (char *) malloc (msgctxt_len + msgid_len));
252 : (char *) malloc (msgctxt_len + msgid_len));
253 if (msg_ctxt_id != NULL) 247 if (msg_ctxt_id != NULL)
254#endif 248#endif
255 { 249 {
256 memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); 250 memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
257 msg_ctxt_id[msgctxt_len - 1] = '\004'; 251 msg_ctxt_id[msgctxt_len - 1] = '\004';
258 memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); 252 memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
259 translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); 253 translation =
254 dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
260#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 255#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
261 if (msg_ctxt_id != buf) 256 if (msg_ctxt_id != buf)
262 free (msg_ctxt_id); 257 free (msg_ctxt_id);
263#endif 258#endif
264 if (!(translation == msg_ctxt_id || translation == msgid_plural)) 259 if (!(translation == msg_ctxt_id || translation == msgid_plural))
265 return translation; 260 return translation;
266 } 261 }
267 return (n == 1 ? msgid : msgid_plural); 262 return (n == 1 ? msgid : msgid_plural);
268} 263}
diff --git a/src/daemon/https/lgl/hmac.h b/src/daemon/https/lgl/hmac.h
index 5965b603..78bcbb16 100644
--- a/src/daemon/https/lgl/hmac.h
+++ b/src/daemon/https/lgl/hmac.h
@@ -28,7 +28,7 @@
28 RESBUF buffer. Return 0 on success. */ 28 RESBUF buffer. Return 0 on success. */
29int 29int
30hmac_md5 (const void *key, size_t keylen, 30hmac_md5 (const void *key, size_t keylen,
31 const void *buffer, size_t buflen, void *resbuf); 31 const void *buffer, size_t buflen, void *resbuf);
32 32
33/* Compute Hashed Message Authentication Code with SHA-1, over BUFFER 33/* Compute Hashed Message Authentication Code with SHA-1, over BUFFER
34 data of BUFLEN bytes using the KEY of KEYLEN bytes, writing the 34 data of BUFLEN bytes using the KEY of KEYLEN bytes, writing the
@@ -36,6 +36,6 @@ hmac_md5 (const void *key, size_t keylen,
36 success. */ 36 success. */
37int 37int
38hmac_sha1 (const void *key, size_t keylen, 38hmac_sha1 (const void *key, size_t keylen,
39 const void *in, size_t inlen, void *resbuf); 39 const void *in, size_t inlen, void *resbuf);
40 40
41#endif /* HMAC_H */ 41#endif /* HMAC_H */
diff --git a/src/daemon/https/lgl/md5.h b/src/daemon/https/lgl/md5.h
index 6018a6f6..a03f1e8a 100644
--- a/src/daemon/https/lgl/md5.h
+++ b/src/daemon/https/lgl/md5.h
@@ -74,21 +74,23 @@ struct md5_ctx
74 74
75/* Initialize structure containing state of computation. 75/* Initialize structure containing state of computation.
76 (RFC 1321, 3.3: Step 3) */ 76 (RFC 1321, 3.3: Step 3) */
77extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW; 77extern void
78__md5_init_ctx (struct md5_ctx *ctx)
79 __THROW;
78 80
79/* Starting with the result of former calls of this function (or the 81/* Starting with the result of former calls of this function (or the
80 initialization function update the context for the next LEN bytes 82 initialization function update the context for the next LEN bytes
81 starting at BUFFER. 83 starting at BUFFER.
82 It is necessary that LEN is a multiple of 64!!! */ 84 It is necessary that LEN is a multiple of 64!!! */
83extern void __md5_process_block (const void *buffer, size_t len, 85 extern void __md5_process_block (const void *buffer, size_t len,
84 struct md5_ctx *ctx) __THROW; 86 struct md5_ctx *ctx) __THROW;
85 87
86/* Starting with the result of former calls of this function (or the 88/* Starting with the result of former calls of this function (or the
87 initialization function update the context for the next LEN bytes 89 initialization function update the context for the next LEN bytes
88 starting at BUFFER. 90 starting at BUFFER.
89 It is NOT required that LEN is a multiple of 64. */ 91 It is NOT required that LEN is a multiple of 64. */
90extern void __md5_process_bytes (const void *buffer, size_t len, 92 extern void __md5_process_bytes (const void *buffer, size_t len,
91 struct md5_ctx *ctx) __THROW; 93 struct md5_ctx *ctx) __THROW;
92 94
93/* Process the remaining bytes in the buffer and put result from CTX 95/* Process the remaining bytes in the buffer and put result from CTX
94 in first 16 bytes following RESBUF. The result is always in little 96 in first 16 bytes following RESBUF. The result is always in little
@@ -97,7 +99,8 @@ extern void __md5_process_bytes (const void *buffer, size_t len,
97 99
98 IMPORTANT: On some systems, RESBUF must be aligned to a 32-bit 100 IMPORTANT: On some systems, RESBUF must be aligned to a 32-bit
99 boundary. */ 101 boundary. */
100extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW; 102 extern void *__md5_finish_ctx (struct md5_ctx *ctx,
103 void *resbuf) __THROW;
101 104
102 105
103/* Put result from CTX in first 16 bytes following RESBUF. The result is 106/* Put result from CTX in first 16 bytes following RESBUF. The result is
@@ -106,19 +109,20 @@ extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
106 109
107 IMPORTANT: On some systems, RESBUF must be aligned to a 32-bit 110 IMPORTANT: On some systems, RESBUF must be aligned to a 32-bit
108 boundary. */ 111 boundary. */
109extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; 112 extern void *__md5_read_ctx (const struct md5_ctx *ctx,
113 void *resbuf) __THROW;
110 114
111 115
112/* Compute MD5 message digest for bytes read from STREAM. The 116/* Compute MD5 message digest for bytes read from STREAM. The
113 resulting message digest number will be written into the 16 bytes 117 resulting message digest number will be written into the 16 bytes
114 beginning at RESBLOCK. */ 118 beginning at RESBLOCK. */
115extern int __md5_stream (FILE *stream, void *resblock) __THROW; 119 extern int __md5_stream (FILE * stream, void *resblock) __THROW;
116 120
117/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The 121/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
118 result is always in little endian byte order, so that a byte-wise 122 result is always in little endian byte order, so that a byte-wise
119 output yields to the wanted ASCII representation of the message 123 output yields to the wanted ASCII representation of the message
120 digest. */ 124 digest. */
121extern void *__md5_buffer (const char *buffer, size_t len, 125 extern void *__md5_buffer (const char *buffer, size_t len,
122 void *resblock) __THROW; 126 void *resblock) __THROW;
123 127
124#endif /* md5.h */ 128#endif /* md5.h */
diff --git a/src/daemon/https/lgl/printf-args.h b/src/daemon/https/lgl/printf-args.h
index b663a63b..5edbdf40 100644
--- a/src/daemon/https/lgl/printf-args.h
+++ b/src/daemon/https/lgl/printf-args.h
@@ -77,13 +77,11 @@ typedef enum
77 TYPE_COUNT_INT_POINTER, 77 TYPE_COUNT_INT_POINTER,
78 TYPE_COUNT_LONGINT_POINTER 78 TYPE_COUNT_LONGINT_POINTER
79#if HAVE_LONG_LONG_INT 79#if HAVE_LONG_LONG_INT
80, TYPE_COUNT_LONGLONGINT_POINTER 80 , TYPE_COUNT_LONGLONGINT_POINTER
81#endif 81#endif
82#if ENABLE_UNISTDIO 82#if ENABLE_UNISTDIO
83 /* The unistdio extensions. */ 83 /* The unistdio extensions. */
84, TYPE_U8_STRING 84 , TYPE_U8_STRING, TYPE_U16_STRING, TYPE_U32_STRING
85, TYPE_U16_STRING
86, TYPE_U32_STRING
87#endif 85#endif
88} arg_type; 86} arg_type;
89 87
@@ -93,42 +91,42 @@ typedef struct
93 arg_type type; 91 arg_type type;
94 union 92 union
95 { 93 {
96 signed char a_schar; 94 signed char a_schar;
97 unsigned char a_uchar; 95 unsigned char a_uchar;
98 short a_short; 96 short a_short;
99 unsigned short a_ushort; 97 unsigned short a_ushort;
100 int a_int; 98 int a_int;
101 unsigned int a_uint; 99 unsigned int a_uint;
102 long int a_longint; 100 long int a_longint;
103 unsigned long int a_ulongint; 101 unsigned long int a_ulongint;
104#if HAVE_LONG_LONG_INT 102#if HAVE_LONG_LONG_INT
105 long long int a_longlongint; 103 long long int a_longlongint;
106 unsigned long long int a_ulonglongint; 104 unsigned long long int a_ulonglongint;
107#endif 105#endif
108 float a_float; 106 float a_float;
109 double a_double; 107 double a_double;
110 long double a_longdouble; 108 long double a_longdouble;
111 int a_char; 109 int a_char;
112#if HAVE_WINT_T 110#if HAVE_WINT_T
113 wint_t a_wide_char; 111 wint_t a_wide_char;
114#endif 112#endif
115 const char* a_string; 113 const char *a_string;
116#if HAVE_WCHAR_T 114#if HAVE_WCHAR_T
117 const wchar_t* a_wide_string; 115 const wchar_t *a_wide_string;
118#endif 116#endif
119 void* a_pointer; 117 void *a_pointer;
120 signed char * a_count_schar_pointer; 118 signed char *a_count_schar_pointer;
121 short * a_count_short_pointer; 119 short *a_count_short_pointer;
122 int * a_count_int_pointer; 120 int *a_count_int_pointer;
123 long int * a_count_longint_pointer; 121 long int *a_count_longint_pointer;
124#if HAVE_LONG_LONG_INT 122#if HAVE_LONG_LONG_INT
125 long long int * a_count_longlongint_pointer; 123 long long int *a_count_longlongint_pointer;
126#endif 124#endif
127#if ENABLE_UNISTDIO 125#if ENABLE_UNISTDIO
128 /* The unistdio extensions. */ 126 /* The unistdio extensions. */
129 const uint8_t * a_u8_string; 127 const uint8_t *a_u8_string;
130 const uint16_t * a_u16_string; 128 const uint16_t *a_u16_string;
131 const uint32_t * a_u32_string; 129 const uint32_t *a_u32_string;
132#endif 130#endif
133 } 131 }
134 a; 132 a;
@@ -149,6 +147,6 @@ STATIC
149#else 147#else
150extern 148extern
151#endif 149#endif
152int PRINTF_FETCHARGS (va_list args, arguments *a); 150int PRINTF_FETCHARGS (va_list args, arguments * a);
153 151
154#endif /* _PRINTF_ARGS_H */ 152#endif /* _PRINTF_ARGS_H */
diff --git a/src/daemon/https/lgl/printf-parse.h b/src/daemon/https/lgl/printf-parse.h
index f9013278..2493d481 100644
--- a/src/daemon/https/lgl/printf-parse.h
+++ b/src/daemon/https/lgl/printf-parse.h
@@ -25,11 +25,11 @@
25#include "printf-args.h" 25#include "printf-args.h"
26 26
27/* Flags */ 27/* Flags */
28#define FLAG_GROUP 1 /* ' flag */ 28#define FLAG_GROUP 1 /* ' flag */
29#define FLAG_LEFT 2 /* - flag */ 29#define FLAG_LEFT 2 /* - flag */
30#define FLAG_SHOWSIGN 4 /* + flag */ 30#define FLAG_SHOWSIGN 4 /* + flag */
31#define FLAG_SPACE 8 /* space flag */ 31#define FLAG_SPACE 8 /* space flag */
32#define FLAG_ALT 16 /* # flag */ 32#define FLAG_ALT 16 /* # flag */
33#define FLAG_ZERO 32 33#define FLAG_ZERO 32
34 34
35/* arg_index value indicating that no argument is consumed. */ 35/* arg_index value indicating that no argument is consumed. */
@@ -41,16 +41,16 @@
41/* A parsed directive. */ 41/* A parsed directive. */
42typedef struct 42typedef struct
43{ 43{
44 const char* dir_start; 44 const char *dir_start;
45 const char* dir_end; 45 const char *dir_end;
46 int flags; 46 int flags;
47 const char* width_start; 47 const char *width_start;
48 const char* width_end; 48 const char *width_end;
49 size_t width_arg_index; 49 size_t width_arg_index;
50 const char* precision_start; 50 const char *precision_start;
51 const char* precision_end; 51 const char *precision_end;
52 size_t precision_arg_index; 52 size_t precision_arg_index;
53 char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ 53 char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
54 size_t arg_index; 54 size_t arg_index;
55} 55}
56char_directive; 56char_directive;
@@ -70,16 +70,16 @@ char_directives;
70/* A parsed directive. */ 70/* A parsed directive. */
71typedef struct 71typedef struct
72{ 72{
73 const uint8_t* dir_start; 73 const uint8_t *dir_start;
74 const uint8_t* dir_end; 74 const uint8_t *dir_end;
75 int flags; 75 int flags;
76 const uint8_t* width_start; 76 const uint8_t *width_start;
77 const uint8_t* width_end; 77 const uint8_t *width_end;
78 size_t width_arg_index; 78 size_t width_arg_index;
79 const uint8_t* precision_start; 79 const uint8_t *precision_start;
80 const uint8_t* precision_end; 80 const uint8_t *precision_end;
81 size_t precision_arg_index; 81 size_t precision_arg_index;
82 uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ 82 uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
83 size_t arg_index; 83 size_t arg_index;
84} 84}
85u8_directive; 85u8_directive;
@@ -97,16 +97,16 @@ u8_directives;
97/* A parsed directive. */ 97/* A parsed directive. */
98typedef struct 98typedef struct
99{ 99{
100 const uint16_t* dir_start; 100 const uint16_t *dir_start;
101 const uint16_t* dir_end; 101 const uint16_t *dir_end;
102 int flags; 102 int flags;
103 const uint16_t* width_start; 103 const uint16_t *width_start;
104 const uint16_t* width_end; 104 const uint16_t *width_end;
105 size_t width_arg_index; 105 size_t width_arg_index;
106 const uint16_t* precision_start; 106 const uint16_t *precision_start;
107 const uint16_t* precision_end; 107 const uint16_t *precision_end;
108 size_t precision_arg_index; 108 size_t precision_arg_index;
109 uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ 109 uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
110 size_t arg_index; 110 size_t arg_index;
111} 111}
112u16_directive; 112u16_directive;
@@ -124,16 +124,16 @@ u16_directives;
124/* A parsed directive. */ 124/* A parsed directive. */
125typedef struct 125typedef struct
126{ 126{
127 const uint32_t* dir_start; 127 const uint32_t *dir_start;
128 const uint32_t* dir_end; 128 const uint32_t *dir_end;
129 int flags; 129 int flags;
130 const uint32_t* width_start; 130 const uint32_t *width_start;
131 const uint32_t* width_end; 131 const uint32_t *width_end;
132 size_t width_arg_index; 132 size_t width_arg_index;
133 const uint32_t* precision_start; 133 const uint32_t *precision_start;
134 const uint32_t* precision_end; 134 const uint32_t *precision_end;
135 size_t precision_arg_index; 135 size_t precision_arg_index;
136 uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ 136 uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
137 size_t arg_index; 137 size_t arg_index;
138} 138}
139u32_directive; 139u32_directive;
@@ -157,22 +157,20 @@ u32_directives;
157 arguments and the needed count of arguments. */ 157 arguments and the needed count of arguments. */
158#if ENABLE_UNISTDIO 158#if ENABLE_UNISTDIO
159extern int 159extern int
160 ulc_printf_parse (const char *format, char_directives *d, arguments *a); 160ulc_printf_parse (const char *format, char_directives * d, arguments * a);
161extern int 161extern int
162 u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a); 162u8_printf_parse (const uint8_t * format, u8_directives * d, arguments * a);
163extern int 163extern int
164 u16_printf_parse (const uint16_t *format, u16_directives *d, 164u16_printf_parse (const uint16_t * format, u16_directives * d, arguments * a);
165 arguments *a);
166extern int 165extern int
167 u32_printf_parse (const uint32_t *format, u32_directives *d, 166u32_printf_parse (const uint32_t * format, u32_directives * d, arguments * a);
168 arguments *a);
169#else 167#else
170# ifdef STATIC 168# ifdef STATIC
171STATIC 169STATIC
172# else 170# else
173extern 171extern
174# endif 172# endif
175int printf_parse (const char *format, char_directives *d, arguments *a); 173int printf_parse (const char *format, char_directives * d, arguments * a);
176#endif 174#endif
177 175
178#endif /* _PRINTF_PARSE_H */ 176#endif /* _PRINTF_PARSE_H */
diff --git a/src/daemon/https/lgl/rijndael-alg-fst.c b/src/daemon/https/lgl/rijndael-alg-fst.c
index 5baa0e95..a39ec382 100644
--- a/src/daemon/https/lgl/rijndael-alg-fst.c
+++ b/src/daemon/https/lgl/rijndael-alg-fst.c
@@ -135,6 +135,7 @@ static const uint32_t Te0[256] = {
135 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 135 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11,
136 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a, 136 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a,
137}; 137};
138
138static const uint32_t Te1[256] = { 139static const uint32_t Te1[256] = {
139 0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 140 0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b,
140 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 141 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5,
@@ -201,6 +202,7 @@ static const uint32_t Te1[256] = {
201 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 202 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f,
202 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616, 203 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616,
203}; 204};
205
204static const uint32_t Te2[256] = { 206static const uint32_t Te2[256] = {
205 0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 207 0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b,
206 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 208 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5,
@@ -267,6 +269,7 @@ static const uint32_t Te2[256] = {
267 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 269 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f,
268 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16, 270 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16,
269}; 271};
272
270static const uint32_t Te3[256] = { 273static const uint32_t Te3[256] = {
271 0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 274 0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6,
272 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 275 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491,
@@ -333,6 +336,7 @@ static const uint32_t Te3[256] = {
333 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 336 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e,
334 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c, 337 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c,
335}; 338};
339
336static const uint32_t Te4[256] = { 340static const uint32_t Te4[256] = {
337 0x63636363, 0x7c7c7c7c, 0x77777777, 0x7b7b7b7b, 341 0x63636363, 0x7c7c7c7c, 0x77777777, 0x7b7b7b7b,
338 0xf2f2f2f2, 0x6b6b6b6b, 0x6f6f6f6f, 0xc5c5c5c5, 342 0xf2f2f2f2, 0x6b6b6b6b, 0x6f6f6f6f, 0xc5c5c5c5,
@@ -399,6 +403,7 @@ static const uint32_t Te4[256] = {
399 0x41414141, 0x99999999, 0x2d2d2d2d, 0x0f0f0f0f, 403 0x41414141, 0x99999999, 0x2d2d2d2d, 0x0f0f0f0f,
400 0xb0b0b0b0, 0x54545454, 0xbbbbbbbb, 0x16161616, 404 0xb0b0b0b0, 0x54545454, 0xbbbbbbbb, 0x16161616,
401}; 405};
406
402static const uint32_t Td0[256] = { 407static const uint32_t Td0[256] = {
403 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 408 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96,
404 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 409 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393,
@@ -465,6 +470,7 @@ static const uint32_t Td0[256] = {
465 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 470 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190,
466 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742, 471 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742,
467}; 472};
473
468static const uint32_t Td1[256] = { 474static const uint32_t Td1[256] = {
469 0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 475 0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e,
470 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 476 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303,
@@ -531,6 +537,7 @@ static const uint32_t Td1[256] = {
531 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 537 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1,
532 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857, 538 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857,
533}; 539};
540
534static const uint32_t Td2[256] = { 541static const uint32_t Td2[256] = {
535 0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 542 0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27,
536 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 543 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3,
@@ -597,6 +604,7 @@ static const uint32_t Td2[256] = {
597 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 604 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456,
598 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8, 605 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8,
599}; 606};
607
600static const uint32_t Td3[256] = { 608static const uint32_t Td3[256] = {
601 0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 609 0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a,
602 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 610 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b,
@@ -663,6 +671,7 @@ static const uint32_t Td3[256] = {
663 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 671 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064,
664 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0, 672 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0,
665}; 673};
674
666static const uint32_t Td4[256] = { 675static const uint32_t Td4[256] = {
667 0x52525252, 0x09090909, 0x6a6a6a6a, 0xd5d5d5d5, 676 0x52525252, 0x09090909, 0x6a6a6a6a, 0xd5d5d5d5,
668 0x30303030, 0x36363636, 0xa5a5a5a5, 0x38383838, 677 0x30303030, 0x36363636, 0xa5a5a5a5, 0x38383838,
@@ -729,6 +738,7 @@ static const uint32_t Td4[256] = {
729 0xe1e1e1e1, 0x69696969, 0x14141414, 0x63636363, 738 0xe1e1e1e1, 0x69696969, 0x14141414, 0x63636363,
730 0x55555555, 0x21212121, 0x0c0c0c0c, 0x7d7d7d7d, 739 0x55555555, 0x21212121, 0x0c0c0c0c, 0x7d7d7d7d,
731}; 740};
741
732static const uint32_t rcon[] = { 742static const uint32_t rcon[] = {
733 0x01000000, 0x02000000, 0x04000000, 0x08000000, 743 0x01000000, 0x02000000, 0x04000000, 0x08000000,
734 0x10000000, 0x20000000, 0x40000000, 0x80000000, 744 0x10000000, 0x20000000, 0x40000000, 0x80000000,
diff --git a/src/daemon/https/lgl/rijndael-alg-fst.h b/src/daemon/https/lgl/rijndael-alg-fst.h
index 88391023..657d6697 100644
--- a/src/daemon/https/lgl/rijndael-alg-fst.h
+++ b/src/daemon/https/lgl/rijndael-alg-fst.h
@@ -56,12 +56,12 @@
56#define RIJNDAEL_MAXNR 14 56#define RIJNDAEL_MAXNR 14
57 57
58int rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ], 58int rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ],
59 const char cipherKey[], size_t keyBits); 59 const char cipherKey[], size_t keyBits);
60int rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ], 60int rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ],
61 const char cipherKey[], size_t keyBits); 61 const char cipherKey[], size_t keyBits);
62void rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr, 62void rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
63 const char pt[16], char ct[16]); 63 const char pt[16], char ct[16]);
64void rijndaelDecrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr, 64void rijndaelDecrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
65 const char ct[16], char pt[16]); 65 const char ct[16], char pt[16]);
66 66
67#endif /* __RIJNDAEL_ALG_FST_H */ 67#endif /* __RIJNDAEL_ALG_FST_H */
diff --git a/src/daemon/https/lgl/rijndael-api-fst.h b/src/daemon/https/lgl/rijndael-api-fst.h
index d0ff60ac..cbe6411f 100644
--- a/src/daemon/https/lgl/rijndael-api-fst.h
+++ b/src/daemon/https/lgl/rijndael-api-fst.h
@@ -95,15 +95,15 @@ typedef enum
95 95
96typedef enum 96typedef enum
97{ 97{
98 RIJNDAEL_DIR_ENCRYPT = 0, /* Are we encrypting? */ 98 RIJNDAEL_DIR_ENCRYPT = 0, /* Are we encrypting? */
99 RIJNDAEL_DIR_DECRYPT = 1 /* Are we decrypting? */ 99 RIJNDAEL_DIR_DECRYPT = 1 /* Are we decrypting? */
100} rijndael_direction; 100} rijndael_direction;
101 101
102typedef enum 102typedef enum
103{ 103{
104 RIJNDAEL_MODE_ECB = 1, /* Are we ciphering in ECB mode? */ 104 RIJNDAEL_MODE_ECB = 1, /* Are we ciphering in ECB mode? */
105 RIJNDAEL_MODE_CBC = 2, /* Are we ciphering in CBC mode? */ 105 RIJNDAEL_MODE_CBC = 2, /* Are we ciphering in CBC mode? */
106 RIJNDAEL_MODE_CFB1 = 3 /* Are we ciphering in 1-bit CFB mode? */ 106 RIJNDAEL_MODE_CFB1 = 3 /* Are we ciphering in 1-bit CFB mode? */
107} rijndael_mode; 107} rijndael_mode;
108 108
109/* The structure for key information */ 109/* The structure for key information */
@@ -125,8 +125,8 @@ typedef struct
125 125
126/* The structure for cipher information */ 126/* The structure for cipher information */
127typedef struct 127typedef struct
128{ /* changed order of the components */ 128{ /* changed order of the components */
129 rijndael_mode mode; /* MODE_ECB, MODE_CBC, or MODE_CFB1 */ 129 rijndael_mode mode; /* MODE_ECB, MODE_CBC, or MODE_CFB1 */
130 /* A possible Initialization Vector for ciphering */ 130 /* A possible Initialization Vector for ciphering */
131 char IV[RIJNDAEL_MAX_IV_SIZE]; 131 char IV[RIJNDAEL_MAX_IV_SIZE];
132} rijndaelCipherInstance; 132} rijndaelCipherInstance;
@@ -137,16 +137,16 @@ typedef struct
137 from KEYMATERIAL, a hex string, of KEYLEN size. KEYLEN should be 137 from KEYMATERIAL, a hex string, of KEYLEN size. KEYLEN should be
138 128, 192 or 256. Returns 0 on success, or an error code. */ 138 128, 192 or 256. Returns 0 on success, or an error code. */
139extern rijndael_rc 139extern rijndael_rc
140rijndaelMakeKey (rijndaelKeyInstance *key, rijndael_direction direction, 140rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction,
141 size_t keyLen, const char *keyMaterial); 141 size_t keyLen, const char *keyMaterial);
142 142
143/* Initialize cipher state CIPHER for encryption MODE (e.g., 143/* Initialize cipher state CIPHER for encryption MODE (e.g.,
144 RIJNDAEL_MODE_CBC) with initialization vector IV, a hex string of 144 RIJNDAEL_MODE_CBC) with initialization vector IV, a hex string of
145 2*RIJNDAEL_MAX_IV_SIZE length. IV may be NULL for modes that do 145 2*RIJNDAEL_MAX_IV_SIZE length. IV may be NULL for modes that do
146 not need an IV (i.e., RIJNDAEL_MODE_ECB). */ 146 not need an IV (i.e., RIJNDAEL_MODE_ECB). */
147extern rijndael_rc 147extern rijndael_rc
148rijndaelCipherInit (rijndaelCipherInstance *cipher, 148rijndaelCipherInit (rijndaelCipherInstance * cipher,
149 rijndael_mode mode, const char *IV); 149 rijndael_mode mode, const char *IV);
150 150
151/* Encrypt data in INPUT, of INPUTLEN/8 bytes length, placing the 151/* Encrypt data in INPUT, of INPUTLEN/8 bytes length, placing the
152 output in the pre-allocated OUTBUFFER which must hold at least 152 output in the pre-allocated OUTBUFFER which must hold at least
@@ -156,10 +156,9 @@ rijndaelCipherInit (rijndaelCipherInstance *cipher,
156 calling this function. Return the number of bits written, or a 156 calling this function. Return the number of bits written, or a
157 negative rijndael_rc error code. */ 157 negative rijndael_rc error code. */
158extern int 158extern int
159rijndaelBlockEncrypt (rijndaelCipherInstance *cipher, 159rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
160 const rijndaelKeyInstance *key, 160 const rijndaelKeyInstance * key,
161 const char *input, size_t inputLen, 161 const char *input, size_t inputLen, char *outBuffer);
162 char *outBuffer);
163 162
164/* Encrypt data in INPUT, of INPUTOCTETS bytes length, placing the 163/* Encrypt data in INPUT, of INPUTOCTETS bytes length, placing the
165 output in the pre-allocated OUTBUFFER which must hold at least 164 output in the pre-allocated OUTBUFFER which must hold at least
@@ -171,10 +170,9 @@ rijndaelBlockEncrypt (rijndaelCipherInstance *cipher,
171 calling this function. Return the number of bits written, or a 170 calling this function. Return the number of bits written, or a
172 negative rijndael_rc error code. */ 171 negative rijndael_rc error code. */
173extern int 172extern int
174rijndaelPadEncrypt (rijndaelCipherInstance *cipher, 173rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
175 const rijndaelKeyInstance *key, 174 const rijndaelKeyInstance * key,
176 const char *input, size_t inputOctets, 175 const char *input, size_t inputOctets, char *outBuffer);
177 char *outBuffer);
178 176
179/* Decrypt data in INPUT, of INPUTLEN/8 bytes length, placing the 177/* Decrypt data in INPUT, of INPUTLEN/8 bytes length, placing the
180 output in the pre-allocated OUTBUFFER which must hold at least 178 output in the pre-allocated OUTBUFFER which must hold at least
@@ -184,10 +182,9 @@ rijndaelPadEncrypt (rijndaelCipherInstance *cipher,
184 calling this function. Return the number of bits written, or a 182 calling this function. Return the number of bits written, or a
185 negative rijndael_rc error code. */ 183 negative rijndael_rc error code. */
186extern int 184extern int
187rijndaelBlockDecrypt (rijndaelCipherInstance *cipher, 185rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
188 const rijndaelKeyInstance *key, 186 const rijndaelKeyInstance * key,
189 const char *input, size_t inputLen, 187 const char *input, size_t inputLen, char *outBuffer);
190 char *outBuffer);
191 188
192/* Decrypt data in INPUT, of INPUTOCTETS bytes length, placing the 189/* Decrypt data in INPUT, of INPUTOCTETS bytes length, placing the
193 output in the pre-allocated OUTBUFFER which must hold at least 190 output in the pre-allocated OUTBUFFER which must hold at least
@@ -199,9 +196,8 @@ rijndaelBlockDecrypt (rijndaelCipherInstance *cipher,
199 calling this function. Return the number of bits written, or a 196 calling this function. Return the number of bits written, or a
200 negative rijndael_rc error code. */ 197 negative rijndael_rc error code. */
201extern int 198extern int
202rijndaelPadDecrypt (rijndaelCipherInstance *cipher, 199rijndaelPadDecrypt (rijndaelCipherInstance * cipher,
203 const rijndaelKeyInstance *key, 200 const rijndaelKeyInstance * key,
204 const char *input, size_t inputOctets, 201 const char *input, size_t inputOctets, char *outBuffer);
205 char *outBuffer);
206 202
207#endif /* __RIJNDAEL_API_FST_H */ 203#endif /* __RIJNDAEL_API_FST_H */
diff --git a/src/daemon/https/lgl/sha1.h b/src/daemon/https/lgl/sha1.h
index ed0de2b4..7bfd376c 100644
--- a/src/daemon/https/lgl/sha1.h
+++ b/src/daemon/https/lgl/sha1.h
@@ -45,14 +45,14 @@ extern void sha1_init_ctx (struct sha1_ctx *ctx);
45 starting at BUFFER. 45 starting at BUFFER.
46 It is necessary that LEN is a multiple of 64!!! */ 46 It is necessary that LEN is a multiple of 64!!! */
47extern void sha1_process_block (const void *buffer, size_t len, 47extern void sha1_process_block (const void *buffer, size_t len,
48 struct sha1_ctx *ctx); 48 struct sha1_ctx *ctx);
49 49
50/* Starting with the result of former calls of this function (or the 50/* Starting with the result of former calls of this function (or the
51 initialization function update the context for the next LEN bytes 51 initialization function update the context for the next LEN bytes
52 starting at BUFFER. 52 starting at BUFFER.
53 It is NOT required that LEN is a multiple of 64. */ 53 It is NOT required that LEN is a multiple of 64. */
54extern void sha1_process_bytes (const void *buffer, size_t len, 54extern void sha1_process_bytes (const void *buffer, size_t len,
55 struct sha1_ctx *ctx); 55 struct sha1_ctx *ctx);
56 56
57/* Process the remaining bytes in the buffer and put result from CTX 57/* Process the remaining bytes in the buffer and put result from CTX
58 in first 20 bytes following RESBUF. The result is always in little 58 in first 20 bytes following RESBUF. The result is always in little
@@ -76,7 +76,7 @@ extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
76/* Compute SHA1 message digest for bytes read from STREAM. The 76/* Compute SHA1 message digest for bytes read from STREAM. The
77 resulting message digest number will be written into the 20 bytes 77 resulting message digest number will be written into the 20 bytes
78 beginning at RESBLOCK. */ 78 beginning at RESBLOCK. */
79extern int sha1_stream (FILE *stream, void *resblock); 79extern int sha1_stream (FILE * stream, void *resblock);
80 80
81/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The 81/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
82 result is always in little endian byte order, so that a byte-wise 82 result is always in little endian byte order, so that a byte-wise
diff --git a/src/daemon/https/lgl/vasnprintf.h b/src/daemon/https/lgl/vasnprintf.h
index 4524ce77..e4c57f5b 100644
--- a/src/daemon/https/lgl/vasnprintf.h
+++ b/src/daemon/https/lgl/vasnprintf.h
@@ -27,7 +27,7 @@
27#ifndef __attribute__ 27#ifndef __attribute__
28/* This feature is available in gcc versions 2.5 and later. */ 28/* This feature is available in gcc versions 2.5 and later. */
29# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ 29# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
30# define __attribute__(Spec) /* empty */ 30# define __attribute__(Spec) /* empty */
31# endif 31# endif
32/* The __-protected variants of `format' and `printf' attributes 32/* The __-protected variants of `format' and `printf' attributes
33 are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ 33 are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
@@ -38,7 +38,8 @@
38#endif 38#endif
39 39
40#ifdef __cplusplus 40#ifdef __cplusplus
41extern "C" { 41extern "C"
42{
42#endif 43#endif
43 44
44/* Write formatted output to a string dynamically allocated with malloc(). 45/* Write formatted output to a string dynamically allocated with malloc().
@@ -69,13 +70,15 @@ extern "C" {
69# define asnprintf rpl_asnprintf 70# define asnprintf rpl_asnprintf
70# define vasnprintf rpl_vasnprintf 71# define vasnprintf rpl_vasnprintf
71#endif 72#endif
72extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) 73 extern char *asnprintf (char *resultbuf, size_t * lengthp,
73 __attribute__ ((__format__ (__printf__, 3, 4))); 74 const char *format, ...)
74extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) 75 __attribute__ ((__format__ (__printf__, 3, 4)));
75 __attribute__ ((__format__ (__printf__, 3, 0))); 76 extern char *vasnprintf (char *resultbuf, size_t * lengthp,
77 const char *format, va_list args)
78 __attribute__ ((__format__ (__printf__, 3, 0)));
76 79
77#ifdef __cplusplus 80#ifdef __cplusplus
78} 81}
79#endif 82#endif
80 83
81#endif /* _VASNPRINTF_H */ 84#endif /* _VASNPRINTF_H */
diff --git a/src/daemon/https/lgl/xsize.h b/src/daemon/https/lgl/xsize.h
index d37de38a..d8e1b5fe 100644
--- a/src/daemon/https/lgl/xsize.h
+++ b/src/daemon/https/lgl/xsize.h
@@ -51,9 +51,9 @@
51/* Sum of two sizes, with overflow check. */ 51/* Sum of two sizes, with overflow check. */
52static inline size_t 52static inline size_t
53#if __GNUC__ >= 3 53#if __GNUC__ >= 3
54__attribute__ ((__pure__)) 54 __attribute__ ((__pure__))
55#endif 55#endif
56xsum (size_t size1, size_t size2) 56 xsum (size_t size1, size_t size2)
57{ 57{
58 size_t sum = size1 + size2; 58 size_t sum = size1 + size2;
59 return (sum >= size1 ? sum : SIZE_MAX); 59 return (sum >= size1 ? sum : SIZE_MAX);
@@ -62,9 +62,9 @@ xsum (size_t size1, size_t size2)
62/* Sum of three sizes, with overflow check. */ 62/* Sum of three sizes, with overflow check. */
63static inline size_t 63static inline size_t
64#if __GNUC__ >= 3 64#if __GNUC__ >= 3
65__attribute__ ((__pure__)) 65 __attribute__ ((__pure__))
66#endif 66#endif
67xsum3 (size_t size1, size_t size2, size_t size3) 67 xsum3 (size_t size1, size_t size2, size_t size3)
68{ 68{
69 return xsum (xsum (size1, size2), size3); 69 return xsum (xsum (size1, size2), size3);
70} 70}
@@ -72,9 +72,9 @@ xsum3 (size_t size1, size_t size2, size_t size3)
72/* Sum of four sizes, with overflow check. */ 72/* Sum of four sizes, with overflow check. */
73static inline size_t 73static inline size_t
74#if __GNUC__ >= 3 74#if __GNUC__ >= 3
75__attribute__ ((__pure__)) 75 __attribute__ ((__pure__))
76#endif 76#endif
77xsum4 (size_t size1, size_t size2, size_t size3, size_t size4) 77 xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
78{ 78{
79 return xsum (xsum (xsum (size1, size2), size3), size4); 79 return xsum (xsum (xsum (size1, size2), size3), size4);
80} 80}
@@ -82,9 +82,9 @@ xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
82/* Maximum of two sizes, with overflow check. */ 82/* Maximum of two sizes, with overflow check. */
83static inline size_t 83static inline size_t
84#if __GNUC__ >= 3 84#if __GNUC__ >= 3
85__attribute__ ((__pure__)) 85 __attribute__ ((__pure__))
86#endif 86#endif
87xmax (size_t size1, size_t size2) 87 xmax (size_t size1, size_t size2)
88{ 88{
89 /* No explicit check is needed here, because for any n: 89 /* No explicit check is needed here, because for any n:
90 max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */ 90 max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */
@@ -106,4 +106,3 @@ xmax (size_t size1, size_t size2)
106 ((SIZE) != SIZE_MAX) 106 ((SIZE) != SIZE_MAX)
107 107
108#endif /* _XSIZE_H */ 108#endif /* _XSIZE_H */
109