|
Packit |
c22fc9 |
/*
|
|
Packit |
c22fc9 |
* Soft: Perform a GET query to a remote HTTP/HTTPS server.
|
|
Packit |
c22fc9 |
* Set a timer to compute global remote server response
|
|
Packit |
c22fc9 |
* time.
|
|
Packit |
c22fc9 |
*
|
|
Packit |
c22fc9 |
* Part: Hash-related declarations (to break circular deps).
|
|
Packit |
c22fc9 |
*
|
|
Packit |
c22fc9 |
* Authors: Jan Pokorny, <jpokorny@redhat.com>
|
|
Packit |
c22fc9 |
*
|
|
Packit |
c22fc9 |
* This program is distributed in the hope that it will be useful,
|
|
Packit |
c22fc9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
c22fc9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
Packit |
c22fc9 |
* See the GNU General Public License for more details.
|
|
Packit |
c22fc9 |
*
|
|
Packit |
c22fc9 |
* This program is free software; you can redistribute it and/or
|
|
Packit |
c22fc9 |
* modify it under the terms of the GNU General Public License
|
|
Packit |
c22fc9 |
* as published by the Free Software Foundation; either version
|
|
Packit |
c22fc9 |
* 2 of the License, or (at your option) any later version.
|
|
Packit |
c22fc9 |
*
|
|
Packit |
c22fc9 |
* Copyright 2013 Red Hat, Inc.
|
|
Packit |
c22fc9 |
* Copyright (C) 2014-2017 Alexandre Cassen, <acassen@gmail.com>
|
|
Packit |
c22fc9 |
*/
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#ifndef _HASH_H
|
|
Packit |
c22fc9 |
#define _HASH_H
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
/* system includes */
|
|
Packit |
c22fc9 |
#include <openssl/md5.h>
|
|
Packit |
c22fc9 |
#ifdef _WITH_SHA1_
|
|
Packit |
c22fc9 |
#include <openssl/sha.h>
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
/* available hashes enumeration */
|
|
Packit |
c22fc9 |
enum feat_hashes {
|
|
Packit |
c22fc9 |
hash_first,
|
|
Packit |
c22fc9 |
hash_md5 = hash_first,
|
|
Packit |
c22fc9 |
#ifdef _WITH_SHA1_
|
|
Packit |
c22fc9 |
hash_sha1,
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
hash_guard,
|
|
Packit |
c22fc9 |
hash_default = hash_md5,
|
|
Packit |
c22fc9 |
};
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
typedef union {
|
|
Packit |
c22fc9 |
MD5_CTX md5;
|
|
Packit |
c22fc9 |
#ifdef _WITH_SHA1_
|
|
Packit |
c22fc9 |
SHA_CTX sha;
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
/* this is due to poor C standard/draft wording (wrapped):
|
|
Packit |
c22fc9 |
https://groups.google.com/forum/#!msg/comp.lang.c/
|
|
Packit |
c22fc9 |
1kQMGXhgn4I/0VBEYG_ji44J */
|
|
Packit |
c22fc9 |
char *dummy;
|
|
Packit |
c22fc9 |
} hash_context_t;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
typedef int (*hash_init_f)(hash_context_t *);
|
|
Packit |
c22fc9 |
typedef int (*hash_update_f)(hash_context_t *, const void *, unsigned long);
|
|
Packit |
c22fc9 |
typedef int (*hash_final_f)(unsigned char *, hash_context_t *);
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
typedef struct {
|
|
Packit |
c22fc9 |
hash_init_f init;
|
|
Packit |
c22fc9 |
hash_update_f update;
|
|
Packit |
c22fc9 |
hash_final_f final;
|
|
Packit |
c22fc9 |
unsigned char length; /* length of the digest */
|
|
Packit |
c22fc9 |
const char *id; /* command-line handing + help */
|
|
Packit |
c22fc9 |
const char *label; /* final output */
|
|
Packit |
c22fc9 |
} hash_t;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#endif
|