Select Git revision
testutils.h
Forked from
Nettle / nettle
Source project has a limited visibility.
testutils.h 4.22 KiB
#ifndef NETTLE_TESTUTILS_H_INCLUDED
#define NETTLE_TESTUTILS_H_INCLUDED
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include "nettle-types.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#if HAVE_LIBGMP
# include "bignum.h"
#endif
#if WITH_HOGWEED
# include "rsa.h"
# include "dsa.h"
#endif
#include "nettle-meta.h"
#ifdef __cplusplus
extern "C" {
#endif
void *
xalloc(size_t size);
/* Decodes a NUL-terminated hex string. */
unsigned
decode_hex_length(const char *hex);
int
decode_hex(uint8_t *dst, const char *hex);
/* Allocates space */
const uint8_t *
decode_hex_dup(const char *hex);
void
print_hex(unsigned length, const uint8_t *data);
/* The main program */
int
test_main(void);
extern int verbose;
/* FIXME: When interface stabilizes, move to nettle-meta.h */
struct nettle_mac
{
const char *name;
/* Size of the context struct */
unsigned context_size;
/* Size of digests */
unsigned digest_size;
/* Suggested key size; other sizes are sometimes possible. */
unsigned key_size;
nettle_set_key_func *set_key;
nettle_hash_update_func *update;
nettle_hash_digest_func *digest;
};