3 * Miscellaneous functions used by the example programs.
6 /* nettle, low-level cryptographics library
8 * Copyright (C) 2002 Niels Möller
10 * The nettle library is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or (at your
13 * option) any later version.
15 * The nettle library is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with the nettle library; see the file COPYING.LIB. If not, write to
22 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
26 #ifndef NETTLE_EXAMPLES_IO_H_INCLUDED
27 #define NETTLE_EXAMPLES_IO_H_INCLUDED
29 #include "nettle-meta.h"
34 extern int quiet_flag;
40 werror(const char *format, ...)
42 __attribute__((__format__ (__printf__,1, 2)))
46 /* If size is > 0, read at most that many bytes. If size == 0,
47 * read until EOF. Allocates the buffer dynamically. */
49 read_file(const char *name, unsigned size, char **buffer);
52 write_file(const char *name, unsigned size, const char *buffer);
55 write_string(FILE *f, unsigned size, const char *buffer);
58 simple_random(struct yarrow256_ctx *ctx, const char *name);
61 hash_file(const struct nettle_hash *hash, void *ctx, FILE *f);
64 struct rsa_public_key;
65 struct rsa_private_key;
68 read_rsa_key(const char *name,
69 struct rsa_public_key *pub,
70 struct rsa_private_key *priv);
71 #endif /* WITH_HOGWEED */
73 #endif /* NETTLE_EXAMPLES_IO_H_INCLUDED */