aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/lgl/gc-gnulib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/https/lgl/gc-gnulib.c')
-rw-r--r--src/daemon/https/lgl/gc-gnulib.c45
1 files changed, 27 insertions, 18 deletions
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;