aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/lgl
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/https/lgl')
-rw-r--r--src/daemon/https/lgl/des.c14
-rw-r--r--src/daemon/https/lgl/des.h14
-rw-r--r--src/daemon/https/lgl/gc-gnulib.c45
-rw-r--r--src/daemon/https/lgl/gc-libgcrypt.c33
-rw-r--r--src/daemon/https/lgl/gc-pbkdf2-sha1.c4
-rw-r--r--src/daemon/https/lgl/gc.h54
-rw-r--r--src/daemon/https/lgl/hmac-md5.c2
-rw-r--r--src/daemon/https/lgl/hmac-sha1.c2
-rw-r--r--src/daemon/https/lgl/hmac.h4
-rw-r--r--src/daemon/https/lgl/md5.c6
-rw-r--r--src/daemon/https/lgl/md5.h10
-rw-r--r--src/daemon/https/lgl/rijndael-alg-fst.c8
-rw-r--r--src/daemon/https/lgl/rijndael-alg-fst.h8
-rw-r--r--src/daemon/https/lgl/rijndael-api-fst.c24
-rw-r--r--src/daemon/https/lgl/rijndael-api-fst.h24
-rw-r--r--src/daemon/https/lgl/sha1.c9
-rw-r--r--src/daemon/https/lgl/sha1.h4
17 files changed, 154 insertions, 111 deletions
diff --git a/src/daemon/https/lgl/des.c b/src/daemon/https/lgl/des.c
index 7bc4c4d0..dbe5f3c6 100644
--- a/src/daemon/https/lgl/des.c
+++ b/src/daemon/https/lgl/des.c
@@ -543,7 +543,8 @@ MHD_gl_des_makekey (MHD_gl_des_ctx * ctx, const char *key, size_t keylen)
543} 543}
544 544
545void 545void
546MHD_gl_des_ecb_crypt (MHD_gl_des_ctx * ctx, const char *_from, char *_to, int mode) 546MHD_gl_des_ecb_crypt (MHD_gl_des_ctx * ctx, const char *_from, char *_to,
547 int mode)
547{ 548{
548 const unsigned char *from = (const unsigned char *) _from; 549 const unsigned char *from = (const unsigned char *) _from;
549 unsigned char *to = (unsigned char *) _to; 550 unsigned char *to = (unsigned char *) _to;
@@ -565,7 +566,8 @@ READ_64BIT_DATA (from, left, right)
565 FINAL_PERMUTATION (right, work, left) WRITE_64BIT_DATA (to, right, left)} 566 FINAL_PERMUTATION (right, work, left) WRITE_64BIT_DATA (to, right, left)}
566 567
567void 568void
568MHD_gl_3des_set2keys (MHD_gl_3des_ctx * ctx, const char *key1, const char *key2) 569MHD_gl_3des_set2keys (MHD_gl_3des_ctx * ctx, const char *key1,
570 const char *key2)
569{ 571{
570 int i; 572 int i;
571 573
@@ -590,7 +592,7 @@ MHD_gl_3des_set2keys (MHD_gl_3des_ctx * ctx, const char *key1, const char *key2)
590 592
591void 593void
592MHD_gl_3des_set3keys (MHD_gl_3des_ctx * ctx, const char *key1, 594MHD_gl_3des_set3keys (MHD_gl_3des_ctx * ctx, const char *key1,
593 const char *key2, const char *key3) 595 const char *key2, const char *key3)
594{ 596{
595 int i; 597 int i;
596 598
@@ -612,7 +614,8 @@ MHD_gl_3des_set3keys (MHD_gl_3des_ctx * ctx, const char *key1,
612} 614}
613 615
614void 616void
615MHD_gl_3des_ecb_crypt (MHD_gl_3des_ctx * ctx, const char *_from, char *_to, int mode) 617MHD_gl_3des_ecb_crypt (MHD_gl_3des_ctx * ctx, const char *_from, char *_to,
618 int mode)
616{ 619{
617 const unsigned char *from = (const unsigned char *) _from; 620 const unsigned char *from = (const unsigned char *) _from;
618 unsigned char *to = (unsigned char *) _to; 621 unsigned char *to = (unsigned char *) _to;
@@ -658,5 +661,6 @@ MHD_gl_3des_makekey (MHD_gl_3des_ctx * ctx, const char *key, size_t keylen)
658 MHD_gl_3des_set3keys (ctx, key, key + 8, key + 16); 661 MHD_gl_3des_set3keys (ctx, key, key + 8, key + 16);
659 662
660 return !(MHD_gl_des_is_weak_key (key) 663 return !(MHD_gl_des_is_weak_key (key)
661 || MHD_gl_des_is_weak_key (key + 8) || MHD_gl_des_is_weak_key (key + 16)); 664 || MHD_gl_des_is_weak_key (key + 8)
665 || MHD_gl_des_is_weak_key (key + 16));
662} 666}
diff --git a/src/daemon/https/lgl/des.h b/src/daemon/https/lgl/des.h
index 4d9eb20c..d2ad058e 100644
--- a/src/daemon/https/lgl/des.h
+++ b/src/daemon/https/lgl/des.h
@@ -62,12 +62,14 @@ extern void MHD_gl_des_setkey (MHD_gl_des_ctx * ctx, const char *key);
62/* 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
63 * weak key checking. Does not check parity bits, but simply ignore 63 * weak key checking. Does not check parity bits, but simply ignore
64 * them. */ 64 * them. */
65extern bool MHD_gl_des_makekey (MHD_gl_des_ctx * ctx, const char *key, size_t keylen); 65extern bool MHD_gl_des_makekey (MHD_gl_des_ctx * ctx, const char *key,
66 size_t keylen);
66 67
67/* Electronic Codebook Mode DES encryption/decryption of data 68/* Electronic Codebook Mode DES encryption/decryption of data
68 * according to 'mode'. */ 69 * according to 'mode'. */
69extern void 70extern void
70MHD_gl_des_ecb_crypt (MHD_gl_des_ctx * ctx, const char *from, char *to, int mode); 71MHD_gl_des_ecb_crypt (MHD_gl_des_ctx * ctx, const char *from, char *to,
72 int mode);
71 73
72#define MHD_gl_des_ecb_encrypt(ctx, from, to) MHD_gl_des_ecb_crypt(ctx, from, to, 0) 74#define MHD_gl_des_ecb_encrypt(ctx, from, to) MHD_gl_des_ecb_crypt(ctx, from, to, 0)
73#define MHD_gl_des_ecb_decrypt(ctx, from, to) MHD_gl_des_ecb_crypt(ctx, from, to, 1) 75#define MHD_gl_des_ecb_decrypt(ctx, from, to) MHD_gl_des_ecb_crypt(ctx, from, to, 1)
@@ -80,7 +82,8 @@ MHD_gl_des_ecb_crypt (MHD_gl_des_ctx * ctx, const char *from, char *to, int mode
80 * 64bit keys in KEY1 and KEY2. Does not check the parity bits of the 82 * 64bit keys in KEY1 and KEY2. Does not check the parity bits of the
81 * keys, but simply ignore them. Does not check for weak keys. */ 83 * keys, but simply ignore them. Does not check for weak keys. */
82extern void 84extern void
83MHD_gl_3des_set2keys (MHD_gl_3des_ctx * ctx, const char *key1, const char *key2); 85MHD_gl_3des_set2keys (MHD_gl_3des_ctx * ctx, const char *key1,
86 const char *key2);
84 87
85/* 88/*
86 * Fill a Triple-DES context CTX with subkeys calculated from three 89 * Fill a Triple-DES context CTX with subkeys calculated from three
@@ -89,7 +92,7 @@ MHD_gl_3des_set2keys (MHD_gl_3des_ctx * ctx, const char *key1, const char *key2)
89 * keys. */ 92 * keys. */
90extern void 93extern void
91MHD_gl_3des_set3keys (MHD_gl_3des_ctx * ctx, 94MHD_gl_3des_set3keys (MHD_gl_3des_ctx * ctx,
92 const char *key1, const char *key2, const char *key3); 95 const char *key1, const char *key2, const char *key3);
93 96
94/* Fill a Triple-DES context CTX with subkeys calculated from three 97/* Fill a Triple-DES context CTX with subkeys calculated from three
95 * concatenated 64bit keys in KEY, with weak key checking. Does not 98 * concatenated 64bit keys in KEY, with weak key checking. Does not
@@ -101,7 +104,8 @@ MHD_gl_3des_makekey (MHD_gl_3des_ctx * ctx, const char *key, size_t keylen);
101 * according to 'mode'. Sometimes this mode is named 'EDE' mode 104 * according to 'mode'. Sometimes this mode is named 'EDE' mode
102 * (Encryption-Decryption-Encryption). */ 105 * (Encryption-Decryption-Encryption). */
103extern void 106extern void
104MHD_gl_3des_ecb_crypt (MHD_gl_3des_ctx * ctx, const char *from, char *to, int mode); 107MHD_gl_3des_ecb_crypt (MHD_gl_3des_ctx * ctx, const char *from, char *to,
108 int mode);
105 109
106#define MHD_gl_3des_ecb_encrypt(ctx, from, to) MHD_gl_3des_ecb_crypt(ctx,from,to,0) 110#define MHD_gl_3des_ecb_encrypt(ctx, from, to) MHD_gl_3des_ecb_crypt(ctx,from,to,0)
107#define MHD_gl_3des_ecb_decrypt(ctx, from, to) MHD_gl_3des_ecb_crypt(ctx,from,to,1) 111#define MHD_gl_3des_ecb_decrypt(ctx, from, to) MHD_gl_3des_ecb_crypt(ctx,from,to,1)
diff --git a/src/daemon/https/lgl/gc-gnulib.c b/src/daemon/https/lgl/gc-gnulib.c
index 7c16d443..52fce18b 100644
--- a/src/daemon/https/lgl/gc-gnulib.c
+++ b/src/daemon/https/lgl/gc-gnulib.c
@@ -161,9 +161,9 @@ MHD_gc_random (char *data, size_t datalen)
161/* Memory allocation. */ 161/* Memory allocation. */
162void 162void
163MHD_gc_set_allocators (MHD_gc_malloc_t func_malloc, 163MHD_gc_set_allocators (MHD_gc_malloc_t func_malloc,
164 MHD_gc_malloc_t secure_malloc, 164 MHD_gc_malloc_t secure_malloc,
165 MHD_gc_secure_check_t secure_check, 165 MHD_gc_secure_check_t secure_check,
166 MHD_gc_realloc_t func_realloc, MHD_gc_free_t func_free) 166 MHD_gc_realloc_t func_realloc, MHD_gc_free_t func_free)
167{ 167{
168 return; 168 return;
169} 169}
@@ -193,7 +193,7 @@ typedef struct _MHD_gc_cipher_ctx
193 193
194Gc_rc 194Gc_rc
195MHD_gc_cipher_open (Gc_cipher alg, 195MHD_gc_cipher_open (Gc_cipher alg,
196 Gc_cipher_mode mode, MHD_gc_cipher_handle * outhandle) 196 Gc_cipher_mode mode, MHD_gc_cipher_handle * outhandle)
197{ 197{
198 _MHD_gc_cipher_ctx *ctx; 198 _MHD_gc_cipher_ctx *ctx;
199 Gc_rc rc = GC_OK; 199 Gc_rc rc = GC_OK;
@@ -277,7 +277,8 @@ MHD_gc_cipher_open (Gc_cipher alg,
277} 277}
278 278
279Gc_rc 279Gc_rc
280MHD_gc_cipher_setkey (MHD_gc_cipher_handle handle, size_t keylen, const char *key) 280MHD_gc_cipher_setkey (MHD_gc_cipher_handle handle, size_t keylen,
281 const char *key)
281{ 282{
282 _MHD_gc_cipher_ctx *ctx = handle; 283 _MHD_gc_cipher_ctx *ctx = handle;
283 284
@@ -317,16 +318,18 @@ MHD_gc_cipher_setkey (MHD_gc_cipher_handle handle, size_t keylen, const char *ke
317 sprintf (&keyMaterial[2 * i], "%02x", key[i] & 0xFF); 318 sprintf (&keyMaterial[2 * i], "%02x", key[i] & 0xFF);
318 319
319 rc = MHD_rijndaelMakeKey (&ctx->aesEncKey, RIJNDAEL_DIR_ENCRYPT, 320 rc = MHD_rijndaelMakeKey (&ctx->aesEncKey, RIJNDAEL_DIR_ENCRYPT,
320 keylen * 8, keyMaterial); 321 keylen * 8, keyMaterial);
321 if (rc < 0) 322 if (rc < 0)
322 return GC_INVALID_CIPHER; 323 return GC_INVALID_CIPHER;
323 324
324 rc = MHD_rijndaelMakeKey (&ctx->aesDecKey, RIJNDAEL_DIR_DECRYPT, 325 rc = MHD_rijndaelMakeKey (&ctx->aesDecKey, RIJNDAEL_DIR_DECRYPT,
325 keylen * 8, keyMaterial); 326 keylen * 8, keyMaterial);
326 if (rc < 0) 327 if (rc < 0)
327 return GC_INVALID_CIPHER; 328 return GC_INVALID_CIPHER;
328 329
329 rc = MHD_MHD_rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_ECB, NULL); 330 rc =
331 MHD_MHD_rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_ECB,
332 NULL);
330 if (rc < 0) 333 if (rc < 0)
331 return GC_INVALID_CIPHER; 334 return GC_INVALID_CIPHER;
332 } 335 }
@@ -341,7 +344,8 @@ MHD_gc_cipher_setkey (MHD_gc_cipher_handle handle, size_t keylen, const char *ke
341} 344}
342 345
343Gc_rc 346Gc_rc
344MHD_gc_cipher_setiv (MHD_gc_cipher_handle handle, size_t ivlen, const char *iv) 347MHD_gc_cipher_setiv (MHD_gc_cipher_handle handle, size_t ivlen,
348 const char *iv)
345{ 349{
346 _MHD_gc_cipher_ctx *ctx = handle; 350 _MHD_gc_cipher_ctx *ctx = handle;
347 351
@@ -374,8 +378,9 @@ MHD_gc_cipher_setiv (MHD_gc_cipher_handle handle, size_t ivlen, const char *iv)
374 for (i = 0; i < ivlen; i++) 378 for (i = 0; i < ivlen; i++)
375 sprintf (&ivMaterial[2 * i], "%02x", iv[i] & 0xFF); 379 sprintf (&ivMaterial[2 * i], "%02x", iv[i] & 0xFF);
376 380
377 rc = MHD_MHD_rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_CBC, 381 rc =
378 ivMaterial); 382 MHD_MHD_rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_CBC,
383 ivMaterial);
379 if (rc < 0) 384 if (rc < 0)
380 return GC_INVALID_CIPHER; 385 return GC_INVALID_CIPHER;
381 } 386 }
@@ -395,7 +400,8 @@ MHD_gc_cipher_setiv (MHD_gc_cipher_handle handle, size_t ivlen, const char *iv)
395} 400}
396 401
397Gc_rc 402Gc_rc
398MHD_gc_cipher_encrypt_inline (MHD_gc_cipher_handle handle, size_t len, char *data) 403MHD_gc_cipher_encrypt_inline (MHD_gc_cipher_handle handle, size_t len,
404 char *data)
399{ 405{
400 _MHD_gc_cipher_ctx *ctx = handle; 406 _MHD_gc_cipher_ctx *ctx = handle;
401 407
@@ -450,7 +456,7 @@ MHD_gc_cipher_encrypt_inline (MHD_gc_cipher_handle handle, size_t len, char *dat
450 int nblocks; 456 int nblocks;
451 457
452 nblocks = MHD_rijndaelBlockEncrypt (&ctx->aesContext, &ctx->aesEncKey, 458 nblocks = MHD_rijndaelBlockEncrypt (&ctx->aesContext, &ctx->aesEncKey,
453 data, 8 * len, data); 459 data, 8 * len, data);
454 if (nblocks < 0) 460 if (nblocks < 0)
455 return GC_INVALID_CIPHER; 461 return GC_INVALID_CIPHER;
456 } 462 }
@@ -465,7 +471,8 @@ MHD_gc_cipher_encrypt_inline (MHD_gc_cipher_handle handle, size_t len, char *dat
465} 471}
466 472
467Gc_rc 473Gc_rc
468MHD_gc_cipher_decrypt_inline (MHD_gc_cipher_handle handle, size_t len, char *data) 474MHD_gc_cipher_decrypt_inline (MHD_gc_cipher_handle handle, size_t len,
475 char *data)
469{ 476{
470 _MHD_gc_cipher_ctx *ctx = handle; 477 _MHD_gc_cipher_ctx *ctx = handle;
471 478
@@ -522,7 +529,7 @@ MHD_gc_cipher_decrypt_inline (MHD_gc_cipher_handle handle, size_t len, char *dat
522 int nblocks; 529 int nblocks;
523 530
524 nblocks = MHD_rijndaelBlockDecrypt (&ctx->aesContext, &ctx->aesDecKey, 531 nblocks = MHD_rijndaelBlockDecrypt (&ctx->aesContext, &ctx->aesDecKey,
525 data, 8 * len, data); 532 data, 8 * len, data);
526 if (nblocks < 0) 533 if (nblocks < 0)
527 return GC_INVALID_CIPHER; 534 return GC_INVALID_CIPHER;
528 } 535 }
@@ -565,7 +572,8 @@ typedef struct _MHD_gc_hash_ctx
565} _MHD_gc_hash_ctx; 572} _MHD_gc_hash_ctx;
566 573
567Gc_rc 574Gc_rc
568MHD_gc_hash_open (Gc_hash hash, Gc_hash_mode mode, MHD_gc_hash_handle * outhandle) 575MHD_gc_hash_open (Gc_hash hash, Gc_hash_mode mode,
576 MHD_gc_hash_handle * outhandle)
569{ 577{
570 _MHD_gc_hash_ctx *ctx; 578 _MHD_gc_hash_ctx *ctx;
571 Gc_rc rc = GC_OK; 579 Gc_rc rc = GC_OK;
@@ -769,7 +777,7 @@ MHD_gc_sha1 (const void *in, size_t inlen, void *resbuf)
769#ifdef GNULIB_GC_HMAC_MD5 777#ifdef GNULIB_GC_HMAC_MD5
770Gc_rc 778Gc_rc
771MHD_gc_MHD_hmac_md5 (const void *key, size_t keylen, 779MHD_gc_MHD_hmac_md5 (const void *key, size_t keylen,
772 const void *in, size_t inlen, char *resbuf) 780 const void *in, size_t inlen, char *resbuf)
773{ 781{
774 MHD_hmac_md5 (key, keylen, in, inlen, resbuf); 782 MHD_hmac_md5 (key, keylen, in, inlen, resbuf);
775 return GC_OK; 783 return GC_OK;
@@ -779,7 +787,8 @@ MHD_gc_MHD_hmac_md5 (const void *key, size_t keylen,
779#ifdef GNULIB_GC_HMAC_SHA1 787#ifdef GNULIB_GC_HMAC_SHA1
780Gc_rc 788Gc_rc
781MHD_gc_MHD_hmac_sha1 (const void *key, 789MHD_gc_MHD_hmac_sha1 (const void *key,
782 size_t keylen, const void *in, size_t inlen, char *resbuf) 790 size_t keylen, const void *in, size_t inlen,
791 char *resbuf)
783{ 792{
784 MHD_hmac_sha1 (key, keylen, in, inlen, resbuf); 793 MHD_hmac_sha1 (key, keylen, in, inlen, resbuf);
785 return GC_OK; 794 return GC_OK;
diff --git a/src/daemon/https/lgl/gc-libgcrypt.c b/src/daemon/https/lgl/gc-libgcrypt.c
index a51a7bb4..e4429bd2 100644
--- a/src/daemon/https/lgl/gc-libgcrypt.c
+++ b/src/daemon/https/lgl/gc-libgcrypt.c
@@ -90,9 +90,9 @@ MHD_gc_random (char *data, size_t datalen)
90 90
91void 91void
92MHD_gc_set_allocators (MHD_gc_malloc_t func_malloc, 92MHD_gc_set_allocators (MHD_gc_malloc_t func_malloc,
93 MHD_gc_malloc_t secure_malloc, 93 MHD_gc_malloc_t secure_malloc,
94 MHD_gc_secure_check_t secure_check, 94 MHD_gc_secure_check_t secure_check,
95 MHD_gc_realloc_t func_realloc, MHD_gc_free_t func_free) 95 MHD_gc_realloc_t func_realloc, MHD_gc_free_t func_free)
96{ 96{
97 gcry_set_allocation_handler (func_malloc, secure_malloc, secure_check, 97 gcry_set_allocation_handler (func_malloc, secure_malloc, secure_check,
98 func_realloc, func_free); 98 func_realloc, func_free);
@@ -102,7 +102,7 @@ MHD_gc_set_allocators (MHD_gc_malloc_t func_malloc,
102 102
103Gc_rc 103Gc_rc
104MHD_gc_cipher_open (Gc_cipher alg, 104MHD_gc_cipher_open (Gc_cipher alg,
105 Gc_cipher_mode mode, MHD_gc_cipher_handle * outhandle) 105 Gc_cipher_mode mode, MHD_gc_cipher_handle * outhandle)
106{ 106{
107 int gcryalg, gcrymode; 107 int gcryalg, gcrymode;
108 gcry_error_t err; 108 gcry_error_t err;
@@ -179,7 +179,8 @@ MHD_gc_cipher_open (Gc_cipher alg,
179} 179}
180 180
181Gc_rc 181Gc_rc
182MHD_gc_cipher_setkey (MHD_gc_cipher_handle handle, size_t keylen, const char *key) 182MHD_gc_cipher_setkey (MHD_gc_cipher_handle handle, size_t keylen,
183 const char *key)
183{ 184{
184 gcry_error_t err; 185 gcry_error_t err;
185 186
@@ -191,7 +192,8 @@ MHD_gc_cipher_setkey (MHD_gc_cipher_handle handle, size_t keylen, const char *ke
191} 192}
192 193
193Gc_rc 194Gc_rc
194MHD_gc_cipher_setiv (MHD_gc_cipher_handle handle, size_t ivlen, const char *iv) 195MHD_gc_cipher_setiv (MHD_gc_cipher_handle handle, size_t ivlen,
196 const char *iv)
195{ 197{
196 gcry_error_t err; 198 gcry_error_t err;
197 199
@@ -203,7 +205,8 @@ MHD_gc_cipher_setiv (MHD_gc_cipher_handle handle, size_t ivlen, const char *iv)
203} 205}
204 206
205Gc_rc 207Gc_rc
206MHD_gc_cipher_encrypt_inline (MHD_gc_cipher_handle handle, size_t len, char *data) 208MHD_gc_cipher_encrypt_inline (MHD_gc_cipher_handle handle, size_t len,
209 char *data)
207{ 210{
208 if (gcry_cipher_encrypt ((gcry_cipher_hd_t) handle, data, len, NULL, len) != 211 if (gcry_cipher_encrypt ((gcry_cipher_hd_t) handle, data, len, NULL, len) !=
209 0) 212 0)
@@ -213,7 +216,8 @@ MHD_gc_cipher_encrypt_inline (MHD_gc_cipher_handle handle, size_t len, char *dat
213} 216}
214 217
215Gc_rc 218Gc_rc
216MHD_gc_cipher_decrypt_inline (MHD_gc_cipher_handle handle, size_t len, char *data) 219MHD_gc_cipher_decrypt_inline (MHD_gc_cipher_handle handle, size_t len,
220 char *data)
217{ 221{
218 if (gcry_cipher_decrypt ((gcry_cipher_hd_t) handle, data, len, NULL, len) != 222 if (gcry_cipher_decrypt ((gcry_cipher_hd_t) handle, data, len, NULL, len) !=
219 0) 223 0)
@@ -240,7 +244,8 @@ typedef struct _MHD_gc_hash_ctx
240} _MHD_gc_hash_ctx; 244} _MHD_gc_hash_ctx;
241 245
242Gc_rc 246Gc_rc
243MHD_gc_hash_open (Gc_hash hash, Gc_hash_mode mode, MHD_gc_hash_handle * outhandle) 247MHD_gc_hash_open (Gc_hash hash, Gc_hash_mode mode,
248 MHD_gc_hash_handle * outhandle)
244{ 249{
245 _MHD_gc_hash_ctx *ctx; 250 _MHD_gc_hash_ctx *ctx;
246 int gcryalg = 0, gcrymode = 0; 251 int gcryalg = 0, gcrymode = 0;
@@ -391,7 +396,8 @@ MHD_gc_hash_digest_length (Gc_hash hash)
391} 396}
392 397
393void 398void
394MHD_gc_hash_MHD_hmac_setkey (MHD_gc_hash_handle handle, size_t len, const char *key) 399MHD_gc_hash_MHD_hmac_setkey (MHD_gc_hash_handle handle, size_t len,
400 const char *key)
395{ 401{
396 _MHD_gc_hash_ctx *ctx = handle; 402 _MHD_gc_hash_ctx *ctx = handle;
397 gcry_md_setkey (ctx->gch, key, len); 403 gcry_md_setkey (ctx->gch, key, len);
@@ -411,7 +417,7 @@ MHD_gc_hash_read (MHD_gc_hash_handle handle)
411 const char *digest; 417 const char *digest;
412 { 418 {
413 gcry_md_final (ctx->gch); 419 gcry_md_final (ctx->gch);
414 digest = (const char*) gcry_md_read (ctx->gch, 0); 420 digest = (const char *) gcry_md_read (ctx->gch, 0);
415 } 421 }
416 422
417 return digest; 423 return digest;
@@ -547,7 +553,7 @@ MHD_gc_sha1 (const void *in, size_t inlen, void *resbuf)
547#ifdef GNULIB_GC_HMAC_MD5 553#ifdef GNULIB_GC_HMAC_MD5
548Gc_rc 554Gc_rc
549MHD_gc_MHD_hmac_md5 (const void *key, size_t keylen, 555MHD_gc_MHD_hmac_md5 (const void *key, size_t keylen,
550 const void *in, size_t inlen, char *resbuf) 556 const void *in, size_t inlen, char *resbuf)
551{ 557{
552 size_t hlen = gcry_md_get_algo_dlen (GCRY_MD_MD5); 558 size_t hlen = gcry_md_get_algo_dlen (GCRY_MD_MD5);
553 gcry_md_hd_t mdh; 559 gcry_md_hd_t mdh;
@@ -587,7 +593,8 @@ MHD_gc_MHD_hmac_md5 (const void *key, size_t keylen,
587#ifdef GNULIB_GC_HMAC_SHA1 593#ifdef GNULIB_GC_HMAC_SHA1
588Gc_rc 594Gc_rc
589MHD_gc_MHD_hmac_sha1 (const void *key, 595MHD_gc_MHD_hmac_sha1 (const void *key,
590 size_t keylen, const void *in, size_t inlen, char *resbuf) 596 size_t keylen, const void *in, size_t inlen,
597 char *resbuf)
591{ 598{
592 size_t hlen = gcry_md_get_algo_dlen (GCRY_MD_SHA1); 599 size_t hlen = gcry_md_get_algo_dlen (GCRY_MD_SHA1);
593 gcry_md_hd_t mdh; 600 gcry_md_hd_t mdh;
diff --git a/src/daemon/https/lgl/gc-pbkdf2-sha1.c b/src/daemon/https/lgl/gc-pbkdf2-sha1.c
index 98ac9f96..f58ba491 100644
--- a/src/daemon/https/lgl/gc-pbkdf2-sha1.c
+++ b/src/daemon/https/lgl/gc-pbkdf2-sha1.c
@@ -53,8 +53,8 @@
53 53
54Gc_rc 54Gc_rc
55MHD_gc_pbkdf2_sha1 (const char *P, size_t Plen, 55MHD_gc_pbkdf2_sha1 (const char *P, size_t Plen,
56 const char *S, size_t Slen, 56 const char *S, size_t Slen,
57 unsigned int c, char *DK, size_t dkLen) 57 unsigned int c, char *DK, size_t dkLen)
58{ 58{
59 unsigned int hLen = 20; 59 unsigned int hLen = 20;
60 char U[20]; 60 char U[20];
diff --git a/src/daemon/https/lgl/gc.h b/src/daemon/https/lgl/gc.h
index ecc506fc..4d6b2c93 100644
--- a/src/daemon/https/lgl/gc.h
+++ b/src/daemon/https/lgl/gc.h
@@ -105,9 +105,10 @@ typedef int (*MHD_gc_secure_check_t) (const void *);
105typedef void *(*MHD_gc_realloc_t) (void *p, size_t n); 105typedef void *(*MHD_gc_realloc_t) (void *p, size_t n);
106typedef void (*MHD_gc_free_t) (void *); 106typedef void (*MHD_gc_free_t) (void *);
107void MHD_gc_set_allocators (MHD_gc_malloc_t func_malloc, 107void MHD_gc_set_allocators (MHD_gc_malloc_t func_malloc,
108 MHD_gc_malloc_t secure_malloc, 108 MHD_gc_malloc_t secure_malloc,
109 MHD_gc_secure_check_t secure_check, 109 MHD_gc_secure_check_t secure_check,
110 MHD_gc_realloc_t func_realloc, MHD_gc_free_t func_free); 110 MHD_gc_realloc_t func_realloc,
111 MHD_gc_free_t func_free);
111 112
112/* Randomness. */ 113/* Randomness. */
113Gc_rc MHD_gc_nonce (char *data, size_t datalen); 114Gc_rc MHD_gc_nonce (char *data, size_t datalen);
@@ -116,24 +117,29 @@ Gc_rc MHD_gc_random (char *data, size_t datalen);
116 117
117/* Ciphers. */ 118/* Ciphers. */
118Gc_rc MHD_gc_cipher_open (Gc_cipher cipher, 119Gc_rc MHD_gc_cipher_open (Gc_cipher cipher,
119 Gc_cipher_mode mode, MHD_gc_cipher_handle * outhandle); 120 Gc_cipher_mode mode,
120Gc_rc MHD_gc_cipher_setkey (MHD_gc_cipher_handle handle, 121 MHD_gc_cipher_handle * outhandle);
121 size_t keylen, const char *key); 122Gc_rc MHD_gc_cipher_setkey (MHD_gc_cipher_handle handle, size_t keylen,
122Gc_rc MHD_gc_cipher_setiv (MHD_gc_cipher_handle handle, size_t ivlen, const char *iv); 123 const char *key);
123Gc_rc MHD_gc_cipher_encrypt_inline (MHD_gc_cipher_handle handle, 124Gc_rc MHD_gc_cipher_setiv (MHD_gc_cipher_handle handle, size_t ivlen,
124 size_t len, char *data); 125 const char *iv);
125Gc_rc MHD_gc_cipher_decrypt_inline (MHD_gc_cipher_handle handle, 126Gc_rc MHD_gc_cipher_encrypt_inline (MHD_gc_cipher_handle handle, size_t len,
126 size_t len, char *data); 127 char *data);
128Gc_rc MHD_gc_cipher_decrypt_inline (MHD_gc_cipher_handle handle, size_t len,
129 char *data);
127Gc_rc MHD_gc_cipher_close (MHD_gc_cipher_handle handle); 130Gc_rc MHD_gc_cipher_close (MHD_gc_cipher_handle handle);
128 131
129/* Hashes. */ 132/* Hashes. */
130 133
131Gc_rc MHD_gc_hash_open (Gc_hash hash, 134Gc_rc MHD_gc_hash_open (Gc_hash hash,
132 Gc_hash_mode mode, MHD_gc_hash_handle * outhandle); 135 Gc_hash_mode mode, MHD_gc_hash_handle * outhandle);
133Gc_rc MHD_gc_hash_clone (MHD_gc_hash_handle handle, MHD_gc_hash_handle * outhandle); 136Gc_rc MHD_gc_hash_clone (MHD_gc_hash_handle handle,
137 MHD_gc_hash_handle * outhandle);
134size_t MHD_gc_hash_digest_length (Gc_hash hash); 138size_t MHD_gc_hash_digest_length (Gc_hash hash);
135void MHD_gc_hash_MHD_hmac_setkey (MHD_gc_hash_handle handle, size_t len, const char *key); 139void MHD_gc_hash_MHD_hmac_setkey (MHD_gc_hash_handle handle, size_t len,
136void MHD_gc_hash_write (MHD_gc_hash_handle handle, size_t len, const char *data); 140 const char *key);
141void MHD_gc_hash_write (MHD_gc_hash_handle handle, size_t len,
142 const char *data);
137const char *MHD_gc_hash_read (MHD_gc_hash_handle handle); 143const char *MHD_gc_hash_read (MHD_gc_hash_handle handle);
138void MHD_gc_hash_close (MHD_gc_hash_handle handle); 144void MHD_gc_hash_close (MHD_gc_hash_handle handle);
139 145
@@ -143,7 +149,8 @@ void MHD_gc_hash_close (MHD_gc_hash_handle handle);
143 GC_<HASH>_DIGEST_SIZE. For example, for GC_MD5 the output buffer 149 GC_<HASH>_DIGEST_SIZE. For example, for GC_MD5 the output buffer
144 must be 16 bytes. The return value is 0 (GC_OK) on success, or 150 must be 16 bytes. The return value is 0 (GC_OK) on success, or
145 another Gc_rc error code. */ 151 another Gc_rc error code. */
146Gc_rc MHD_gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *out); 152Gc_rc MHD_gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen,
153 char *out);
147 154
148/* One-call interface. */ 155/* One-call interface. */
149Gc_rc MHD_gc_md2 (const void *in, size_t inlen, void *resbuf); 156Gc_rc MHD_gc_md2 (const void *in, size_t inlen, void *resbuf);
@@ -151,10 +158,10 @@ Gc_rc MHD_gc_md4 (const void *in, size_t inlen, void *resbuf);
151Gc_rc MHD_gc_md5 (const void *in, size_t inlen, void *resbuf); 158Gc_rc MHD_gc_md5 (const void *in, size_t inlen, void *resbuf);
152Gc_rc MHD_gc_sha1 (const void *in, size_t inlen, void *resbuf); 159Gc_rc MHD_gc_sha1 (const void *in, size_t inlen, void *resbuf);
153Gc_rc MHD_gc_MHD_hmac_md5 (const void *key, 160Gc_rc MHD_gc_MHD_hmac_md5 (const void *key,
154 size_t keylen, const void *in, size_t inlen, char *resbuf); 161 size_t keylen, const void *in, size_t inlen,
155Gc_rc MHD_gc_MHD_hmac_sha1 (const void *key, 162 char *resbuf);
156 size_t keylen, 163Gc_rc MHD_gc_MHD_hmac_sha1 (const void *key, size_t keylen, const void *in,
157 const void *in, size_t inlen, char *resbuf); 164 size_t inlen, char *resbuf);
158 165
159/* Derive cryptographic keys from a password P of length PLEN, with 166/* Derive cryptographic keys from a password P of length PLEN, with
160 salt S of length SLEN, placing the result in pre-allocated buffer 167 salt S of length SLEN, placing the result in pre-allocated buffer
@@ -164,9 +171,10 @@ Gc_rc MHD_gc_MHD_hmac_sha1 (const void *key,
164 exactly dkLen bytes long. GC_OK is returned on success, otherwise 171 exactly dkLen bytes long. GC_OK is returned on success, otherwise
165 an Gc_rc error code is returned. */ 172 an Gc_rc error code is returned. */
166Gc_rc MHD_gc_pbkdf2_sha1 (const char *P, 173Gc_rc MHD_gc_pbkdf2_sha1 (const char *P,
167 size_t Plen, 174 size_t Plen,
168 const char *S, 175 const char *S,
169 size_t Slen, unsigned int c, char *DK, size_t dkLen); 176 size_t Slen, unsigned int c, char *DK,
177 size_t dkLen);
170 178
171/* 179/*
172 TODO: 180 TODO:
diff --git a/src/daemon/https/lgl/hmac-md5.c b/src/daemon/https/lgl/hmac-md5.c
index fc6902a9..1fd943f0 100644
--- a/src/daemon/https/lgl/hmac-md5.c
+++ b/src/daemon/https/lgl/hmac-md5.c
@@ -31,7 +31,7 @@
31 31
32int 32int
33MHD_hmac_md5 (const void *key, size_t keylen, 33MHD_hmac_md5 (const void *key, size_t keylen,
34 const void *in, size_t inlen, void *resbuf) 34 const void *in, size_t inlen, void *resbuf)
35{ 35{
36 struct MHD_md5_ctx inner; 36 struct MHD_md5_ctx inner;
37 struct MHD_md5_ctx outer; 37 struct MHD_md5_ctx outer;
diff --git a/src/daemon/https/lgl/hmac-sha1.c b/src/daemon/https/lgl/hmac-sha1.c
index 5d341cb4..4d2e4f37 100644
--- a/src/daemon/https/lgl/hmac-sha1.c
+++ b/src/daemon/https/lgl/hmac-sha1.c
@@ -31,7 +31,7 @@
31 31
32int 32int
33MHD_hmac_sha1 (const void *key, size_t keylen, 33MHD_hmac_sha1 (const void *key, size_t keylen,
34 const void *in, size_t inlen, void *resbuf) 34 const void *in, size_t inlen, void *resbuf)
35{ 35{
36 struct MHD_sha1_ctx inner; 36 struct MHD_sha1_ctx inner;
37 struct MHD_sha1_ctx outer; 37 struct MHD_sha1_ctx outer;
diff --git a/src/daemon/https/lgl/hmac.h b/src/daemon/https/lgl/hmac.h
index 29764056..c4791504 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
30MHD_hmac_md5 (const void *key, size_t keylen, 30MHD_hmac_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 @@ MHD_hmac_md5 (const void *key, size_t keylen,
36 success. */ 36 success. */
37int 37int
38MHD_hmac_sha1 (const void *key, size_t keylen, 38MHD_hmac_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.c b/src/daemon/https/lgl/md5.c
index bc1fccbc..8cca27f5 100644
--- a/src/daemon/https/lgl/md5.c
+++ b/src/daemon/https/lgl/md5.c
@@ -212,7 +212,8 @@ MHD_md5_buffer (const char *buffer, size_t len, void *resblock)
212 212
213 213
214void 214void
215MHD_md5_process_bytes (const void *buffer, size_t len, struct MHD_md5_ctx *ctx) 215MHD_md5_process_bytes (const void *buffer, size_t len,
216 struct MHD_md5_ctx *ctx)
216{ 217{
217 /* When we already have some bits in our internal buffer concatenate 218 /* When we already have some bits in our internal buffer concatenate
218 both inputs first. */ 219 both inputs first. */
@@ -292,7 +293,8 @@ MHD_md5_process_bytes (const void *buffer, size_t len, struct MHD_md5_ctx *ctx)
292 It is assumed that LEN % 64 == 0. */ 293 It is assumed that LEN % 64 == 0. */
293 294
294void 295void
295MHD_md5_process_block (const void *buffer, size_t len, struct MHD_md5_ctx *ctx) 296MHD_md5_process_block (const void *buffer, size_t len,
297 struct MHD_md5_ctx *ctx)
296{ 298{
297 uint32_t correct_words[16]; 299 uint32_t correct_words[16];
298 const uint32_t *words = buffer; 300 const uint32_t *words = buffer;
diff --git a/src/daemon/https/lgl/md5.h b/src/daemon/https/lgl/md5.h
index 80793b66..94247e46 100644
--- a/src/daemon/https/lgl/md5.h
+++ b/src/daemon/https/lgl/md5.h
@@ -83,14 +83,14 @@ __MHD_md5_init_ctx (struct MHD_md5_ctx *ctx)
83 starting at BUFFER. 83 starting at BUFFER.
84 It is necessary that LEN is a multiple of 64!!! */ 84 It is necessary that LEN is a multiple of 64!!! */
85 extern void __MHD_md5_process_block (const void *buffer, size_t len, 85 extern void __MHD_md5_process_block (const void *buffer, size_t len,
86 struct MHD_md5_ctx *ctx) __THROW; 86 struct MHD_md5_ctx *ctx) __THROW;
87 87
88/* 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
89 initialization function update the context for the next LEN bytes 89 initialization function update the context for the next LEN bytes
90 starting at BUFFER. 90 starting at BUFFER.
91 It is NOT required that LEN is a multiple of 64. */ 91 It is NOT required that LEN is a multiple of 64. */
92 extern void __MHD_md5_process_bytes (const void *buffer, size_t len, 92 extern void __MHD_md5_process_bytes (const void *buffer, size_t len,
93 struct MHD_md5_ctx *ctx) __THROW; 93 struct MHD_md5_ctx *ctx) __THROW;
94 94
95/* 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
96 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
@@ -100,7 +100,7 @@ __MHD_md5_init_ctx (struct MHD_md5_ctx *ctx)
100 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
101 boundary. */ 101 boundary. */
102 extern void *__MHD_md5_finish_ctx (struct MHD_md5_ctx *ctx, 102 extern void *__MHD_md5_finish_ctx (struct MHD_md5_ctx *ctx,
103 void *resbuf) __THROW; 103 void *resbuf) __THROW;
104 104
105 105
106/* 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
@@ -110,7 +110,7 @@ __MHD_md5_init_ctx (struct MHD_md5_ctx *ctx)
110 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
111 boundary. */ 111 boundary. */
112 extern void *__MHD_md5_read_ctx (const struct MHD_md5_ctx *ctx, 112 extern void *__MHD_md5_read_ctx (const struct MHD_md5_ctx *ctx,
113 void *resbuf) __THROW; 113 void *resbuf) __THROW;
114 114
115 115
116/* Compute MD5 message digest for bytes read from STREAM. The 116/* Compute MD5 message digest for bytes read from STREAM. The
@@ -123,6 +123,6 @@ __MHD_md5_init_ctx (struct MHD_md5_ctx *ctx)
123 output yields to the wanted ASCII representation of the message 123 output yields to the wanted ASCII representation of the message
124 digest. */ 124 digest. */
125 extern void *__MHD_md5_buffer (const char *buffer, size_t len, 125 extern void *__MHD_md5_buffer (const char *buffer, size_t len,
126 void *resblock) __THROW; 126 void *resblock) __THROW;
127 127
128#endif /* md5.h */ 128#endif /* md5.h */
diff --git a/src/daemon/https/lgl/rijndael-alg-fst.c b/src/daemon/https/lgl/rijndael-alg-fst.c
index d17fbeed..516fff15 100644
--- a/src/daemon/https/lgl/rijndael-alg-fst.c
+++ b/src/daemon/https/lgl/rijndael-alg-fst.c
@@ -763,7 +763,7 @@ static const uint32_t rcon[] = {
763 */ 763 */
764int 764int
765MHD_rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ], 765MHD_rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ],
766 const char cipherKey[], size_t keyBits) 766 const char cipherKey[], size_t keyBits)
767{ 767{
768 size_t i = 0; 768 size_t i = 0;
769 uint32_t temp; 769 uint32_t temp;
@@ -858,7 +858,7 @@ MHD_rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ],
858 */ 858 */
859int 859int
860MHD_rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ], 860MHD_rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ],
861 const char cipherKey[], size_t keyBits) 861 const char cipherKey[], size_t keyBits)
862{ 862{
863 size_t Nr, i, j; 863 size_t Nr, i, j;
864 uint32_t temp; 864 uint32_t temp;
@@ -912,7 +912,7 @@ MHD_rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ],
912 912
913void 913void
914MHD_rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr, 914MHD_rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
915 const char pt[16], char ct[16]) 915 const char pt[16], char ct[16])
916{ 916{
917 uint32_t s0, s1, s2, s3, t0, t1, t2, t3; 917 uint32_t s0, s1, s2, s3, t0, t1, t2, t3;
918 size_t r; 918 size_t r;
@@ -1003,7 +1003,7 @@ MHD_rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
1003 1003
1004void 1004void
1005MHD_rijndaelDecrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr, 1005MHD_rijndaelDecrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
1006 const char ct[16], char pt[16]) 1006 const char ct[16], char pt[16])
1007{ 1007{
1008 uint32_t s0, s1, s2, s3, t0, t1, t2, t3; 1008 uint32_t s0, s1, s2, s3, t0, t1, t2, t3;
1009 size_t r; 1009 size_t r;
diff --git a/src/daemon/https/lgl/rijndael-alg-fst.h b/src/daemon/https/lgl/rijndael-alg-fst.h
index c5496181..b04c1deb 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 MHD_rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ], 58int MHD_rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ],
59 const char cipherKey[], size_t keyBits); 59 const char cipherKey[], size_t keyBits);
60int MHD_rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ], 60int MHD_rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ],
61 const char cipherKey[], size_t keyBits); 61 const char cipherKey[], size_t keyBits);
62void MHD_rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr, 62void MHD_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 MHD_rijndaelDecrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr, 64void MHD_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.c b/src/daemon/https/lgl/rijndael-api-fst.c
index 62d2a4e6..d4196948 100644
--- a/src/daemon/https/lgl/rijndael-api-fst.c
+++ b/src/daemon/https/lgl/rijndael-api-fst.c
@@ -73,7 +73,7 @@
73 73
74rijndael_rc 74rijndael_rc
75MHD_rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction, 75MHD_rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction,
76 size_t keyLen, const char *keyMaterial) 76 size_t keyLen, const char *keyMaterial)
77{ 77{
78 size_t i; 78 size_t i;
79 char *keyMat; 79 char *keyMat;
@@ -149,8 +149,8 @@ MHD_rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction,
149} 149}
150 150
151rijndael_rc 151rijndael_rc
152MHD_MHD_rijndaelCipherInit (rijndaelCipherInstance * cipher, rijndael_mode mode, 152MHD_MHD_rijndaelCipherInit (rijndaelCipherInstance * cipher,
153 const char *IV) 153 rijndael_mode mode, const char *IV)
154{ 154{
155 if ((mode == RIJNDAEL_MODE_ECB) || (mode == RIJNDAEL_MODE_CBC) 155 if ((mode == RIJNDAEL_MODE_ECB) || (mode == RIJNDAEL_MODE_CBC)
156 || (mode == RIJNDAEL_MODE_CFB1)) 156 || (mode == RIJNDAEL_MODE_CFB1))
@@ -200,8 +200,8 @@ MHD_MHD_rijndaelCipherInit (rijndaelCipherInstance * cipher, rijndael_mode mode,
200 200
201int 201int
202MHD_rijndaelBlockEncrypt (rijndaelCipherInstance * cipher, 202MHD_rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
203 const rijndaelKeyInstance * key, 203 const rijndaelKeyInstance * key,
204 const char *input, size_t inputLen, char *outBuffer) 204 const char *input, size_t inputLen, char *outBuffer)
205{ 205{
206 size_t i, k, t, numBlocks; 206 size_t i, k, t, numBlocks;
207 char block[16], *iv; 207 char block[16], *iv;
@@ -277,8 +277,9 @@ MHD_rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
277 277
278int 278int
279MHD_rijndaelPadEncrypt (rijndaelCipherInstance * cipher, 279MHD_rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
280 const rijndaelKeyInstance * key, 280 const rijndaelKeyInstance * key,
281 const char *input, size_t inputOctets, char *outBuffer) 281 const char *input, size_t inputOctets,
282 char *outBuffer)
282{ 283{
283 size_t i, numBlocks, padLen; 284 size_t i, numBlocks, padLen;
284 char block[16], *iv; 285 char block[16], *iv;
@@ -350,8 +351,8 @@ MHD_rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
350 351
351int 352int
352MHD_rijndaelBlockDecrypt (rijndaelCipherInstance * cipher, 353MHD_rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
353 const rijndaelKeyInstance * key, 354 const rijndaelKeyInstance * key,
354 const char *input, size_t inputLen, char *outBuffer) 355 const char *input, size_t inputLen, char *outBuffer)
355{ 356{
356 size_t i, k, t, numBlocks; 357 size_t i, k, t, numBlocks;
357 char block[16], *iv; 358 char block[16], *iv;
@@ -426,8 +427,9 @@ MHD_rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
426 427
427int 428int
428MHD_rijndaelPadDecrypt (rijndaelCipherInstance * cipher, 429MHD_rijndaelPadDecrypt (rijndaelCipherInstance * cipher,
429 const rijndaelKeyInstance * key, 430 const rijndaelKeyInstance * key,
430 const char *input, size_t inputOctets, char *outBuffer) 431 const char *input, size_t inputOctets,
432 char *outBuffer)
431{ 433{
432 size_t i, numBlocks, padLen; 434 size_t i, numBlocks, padLen;
433 char block[16]; 435 char block[16];
diff --git a/src/daemon/https/lgl/rijndael-api-fst.h b/src/daemon/https/lgl/rijndael-api-fst.h
index 088e6bfd..893021fc 100644
--- a/src/daemon/https/lgl/rijndael-api-fst.h
+++ b/src/daemon/https/lgl/rijndael-api-fst.h
@@ -138,7 +138,7 @@ typedef struct
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
140MHD_rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction, 140MHD_rijndaelMakeKey (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
@@ -146,7 +146,7 @@ MHD_rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction,
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
148MHD_MHD_rijndaelCipherInit (rijndaelCipherInstance * cipher, 148MHD_MHD_rijndaelCipherInit (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
@@ -157,8 +157,9 @@ MHD_MHD_rijndaelCipherInit (rijndaelCipherInstance * cipher,
157 negative rijndael_rc error code. */ 157 negative rijndael_rc error code. */
158extern int 158extern int
159MHD_rijndaelBlockEncrypt (rijndaelCipherInstance * cipher, 159MHD_rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
160 const rijndaelKeyInstance * key, 160 const rijndaelKeyInstance * key,
161 const char *input, size_t inputLen, char *outBuffer); 161 const char *input, size_t inputLen,
162 char *outBuffer);
162 163
163/* Encrypt data in INPUT, of INPUTOCTETS bytes length, placing the 164/* Encrypt data in INPUT, of INPUTOCTETS bytes length, placing the
164 output in the pre-allocated OUTBUFFER which must hold at least 165 output in the pre-allocated OUTBUFFER which must hold at least
@@ -171,8 +172,9 @@ MHD_rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
171 negative rijndael_rc error code. */ 172 negative rijndael_rc error code. */
172extern int 173extern int
173MHD_rijndaelPadEncrypt (rijndaelCipherInstance * cipher, 174MHD_rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
174 const rijndaelKeyInstance * key, 175 const rijndaelKeyInstance * key,
175 const char *input, size_t inputOctets, char *outBuffer); 176 const char *input, size_t inputOctets,
177 char *outBuffer);
176 178
177/* Decrypt data in INPUT, of INPUTLEN/8 bytes length, placing the 179/* Decrypt data in INPUT, of INPUTLEN/8 bytes length, placing the
178 output in the pre-allocated OUTBUFFER which must hold at least 180 output in the pre-allocated OUTBUFFER which must hold at least
@@ -183,8 +185,9 @@ MHD_rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
183 negative rijndael_rc error code. */ 185 negative rijndael_rc error code. */
184extern int 186extern int
185MHD_rijndaelBlockDecrypt (rijndaelCipherInstance * cipher, 187MHD_rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
186 const rijndaelKeyInstance * key, 188 const rijndaelKeyInstance * key,
187 const char *input, size_t inputLen, char *outBuffer); 189 const char *input, size_t inputLen,
190 char *outBuffer);
188 191
189/* Decrypt data in INPUT, of INPUTOCTETS bytes length, placing the 192/* Decrypt data in INPUT, of INPUTOCTETS bytes length, placing the
190 output in the pre-allocated OUTBUFFER which must hold at least 193 output in the pre-allocated OUTBUFFER which must hold at least
@@ -197,7 +200,8 @@ MHD_rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
197 negative rijndael_rc error code. */ 200 negative rijndael_rc error code. */
198extern int 201extern int
199MHD_rijndaelPadDecrypt (rijndaelCipherInstance * cipher, 202MHD_rijndaelPadDecrypt (rijndaelCipherInstance * cipher,
200 const rijndaelKeyInstance * key, 203 const rijndaelKeyInstance * key,
201 const char *input, size_t inputOctets, char *outBuffer); 204 const char *input, size_t inputOctets,
205 char *outBuffer);
202 206
203#endif /* __RIJNDAEL_API_FST_H */ 207#endif /* __RIJNDAEL_API_FST_H */
diff --git a/src/daemon/https/lgl/sha1.c b/src/daemon/https/lgl/sha1.c
index c336cc4e..573e7c69 100644
--- a/src/daemon/https/lgl/sha1.c
+++ b/src/daemon/https/lgl/sha1.c
@@ -199,7 +199,8 @@ MHD_sha1_buffer (const char *buffer, size_t len, void *resblock)
199} 199}
200 200
201void 201void
202MHD_sha1_process_bytes (const void *buffer, size_t len, struct MHD_sha1_ctx *ctx) 202MHD_sha1_process_bytes (const void *buffer, size_t len,
203 struct MHD_sha1_ctx *ctx)
203{ 204{
204 /* When we already have some bits in our internal buffer concatenate 205 /* When we already have some bits in our internal buffer concatenate
205 both inputs first. */ 206 both inputs first. */
@@ -235,7 +236,8 @@ MHD_sha1_process_bytes (const void *buffer, size_t len, struct MHD_sha1_ctx *ctx
235 if (UNALIGNED_P (buffer)) 236 if (UNALIGNED_P (buffer))
236 while (len > 64) 237 while (len > 64)
237 { 238 {
238 MHD_sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); 239 MHD_sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64,
240 ctx);
239 buffer = (const char *) buffer + 64; 241 buffer = (const char *) buffer + 64;
240 len -= 64; 242 len -= 64;
241 } 243 }
@@ -284,7 +286,8 @@ MHD_sha1_process_bytes (const void *buffer, size_t len, struct MHD_sha1_ctx *ctx
284 Most of this code comes from GnuPG's cipher/sha1.c. */ 286 Most of this code comes from GnuPG's cipher/sha1.c. */
285 287
286void 288void
287MHD_sha1_process_block (const void *buffer, size_t len, struct MHD_sha1_ctx *ctx) 289MHD_sha1_process_block (const void *buffer, size_t len,
290 struct MHD_sha1_ctx *ctx)
288{ 291{
289 const uint32_t *words = buffer; 292 const uint32_t *words = buffer;
290 size_t nwords = len / sizeof (uint32_t); 293 size_t nwords = len / sizeof (uint32_t);
diff --git a/src/daemon/https/lgl/sha1.h b/src/daemon/https/lgl/sha1.h
index 382d96cf..b6e40cdb 100644
--- a/src/daemon/https/lgl/sha1.h
+++ b/src/daemon/https/lgl/sha1.h
@@ -45,14 +45,14 @@ extern void MHD_sha1_init_ctx (struct MHD_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 MHD_sha1_process_block (const void *buffer, size_t len, 47extern void MHD_sha1_process_block (const void *buffer, size_t len,
48 struct MHD_sha1_ctx *ctx); 48 struct MHD_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 MHD_sha1_process_bytes (const void *buffer, size_t len, 54extern void MHD_sha1_process_bytes (const void *buffer, size_t len,
55 struct MHD_sha1_ctx *ctx); 55 struct MHD_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