Commit 90113ca2 authored by Niels Möller's avatar Niels Möller
Browse files

* examples/io.h: Use WITH_HOGWEED, not WITH_PUBLIC_KEY.

* examples/io.c (read_rsa_key): Deleted, moved to...
* examples/read_rsa_key.c: New file, extracted from io.c.

Rev: nettle/examples/io.c:1.2
Rev: nettle/examples/io.h:1.2
parent 0f92b40a
......@@ -185,24 +185,3 @@ hash_file(const struct nettle_hash *hash, void *ctx, FILE *f)
return 1;
}
}
#if WITH_PUBLIC_KEY
int
read_rsa_key(const char *name,
struct rsa_public_key *pub,
struct rsa_private_key *priv)
{
unsigned length;
char *buffer;
int res;
length = read_file(name, 0, &buffer);
if (!length)
return 0;
res = rsa_keypair_from_sexp(pub, priv, 0, length, buffer);
free(buffer);
return res;
}
#endif /* WITH_PUBLIC_KEY */
......@@ -27,9 +27,6 @@
#define NETTLE_EXAMPLES_IO_H_INCLUDED
#include "nettle-meta.h"
#if WITH_PUBLIC_KEY
# include "rsa.h"
#endif
#include "yarrow.h"
#include <stdio.h>
......@@ -63,7 +60,7 @@ simple_random(struct yarrow256_ctx *ctx, const char *name);
int
hash_file(const struct nettle_hash *hash, void *ctx, FILE *f);
#if WITH_PUBLIC_KEY
#if WITH_HOGWEED
struct rsa_public_key;
struct rsa_private_key;
......@@ -71,6 +68,6 @@ int
read_rsa_key(const char *name,
struct rsa_public_key *pub,
struct rsa_private_key *priv);
#endif /* WITH_PUBLIC_KEY */
#endif /* WITH_HOGWEED */
#endif /* NETTLE_EXAMPLES_IO_H_INCLUDED */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment