Select Git revision
Forked from
Nettle / nettle
Source project has a limited visibility.
testutils.h 3.31 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;
void
test_cipher(const struct nettle_cipher *cipher,
unsigned key_length,
const uint8_t *key,
unsigned length,
const uint8_t *cleartext,
const uint8_t *ciphertext);
void
test_cipher_cbc(const struct nettle_cipher *cipher,
unsigned key_length,
const uint8_t *key,
unsigned length,
const uint8_t *cleartext,
const uint8_t *ciphertext,
const uint8_t *iv);
void