diff options
Diffstat (limited to 'src/daemon/https/lgl/gc-libgcrypt.c')
-rw-r--r-- | src/daemon/https/lgl/gc-libgcrypt.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/daemon/https/lgl/gc-libgcrypt.c b/src/daemon/https/lgl/gc-libgcrypt.c index 3653f0fc..2247e18d 100644 --- a/src/daemon/https/lgl/gc-libgcrypt.c +++ b/src/daemon/https/lgl/gc-libgcrypt.c | |||
@@ -416,43 +416,3 @@ MHD_gc_hash_close (MHD_gc_hash_handle handle) | |||
416 | free (ctx); | 416 | free (ctx); |
417 | } | 417 | } |
418 | 418 | ||
419 | #ifdef GNULIB_GC_HMAC_SHA1 | ||
420 | Gc_rc | ||
421 | MHD_gc_MHD_hmac_sha1 (const void *key, | ||
422 | size_t keylen, const void *in, size_t inlen, | ||
423 | char *resbuf) | ||
424 | { | ||
425 | size_t hlen = gcry_md_get_algo_dlen (GCRY_MD_SHA1); | ||
426 | gcry_md_hd_t mdh; | ||
427 | unsigned char *hash; | ||
428 | gpg_error_t err; | ||
429 | |||
430 | assert (hlen == GC_SHA1_DIGEST_SIZE); | ||
431 | |||
432 | err = gcry_md_open (&mdh, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC); | ||
433 | if (err != GPG_ERR_NO_ERROR) | ||
434 | return GC_INVALID_HASH; | ||
435 | |||
436 | err = gcry_md_setkey (mdh, key, keylen); | ||
437 | if (err != GPG_ERR_NO_ERROR) | ||
438 | { | ||
439 | gcry_md_close (mdh); | ||
440 | return GC_INVALID_HASH; | ||
441 | } | ||
442 | |||
443 | gcry_md_write (mdh, in, inlen); | ||
444 | |||
445 | hash = gcry_md_read (mdh, GCRY_MD_SHA1); | ||
446 | if (hash == NULL) | ||
447 | { | ||
448 | gcry_md_close (mdh); | ||
449 | return GC_INVALID_HASH; | ||
450 | } | ||
451 | |||
452 | memcpy (resbuf, hash, hlen); | ||
453 | |||
454 | gcry_md_close (mdh); | ||
455 | |||
456 | return GC_OK; | ||
457 | } | ||
458 | #endif | ||