Commit 4124057b authored by Brian Wellington's avatar Brian Wellington
Browse files

dst_result_t -> isc_result_t

parent 84feab0f
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
*/
/* $Id: dnssec-keygen.c,v 1.7 1999/10/29 12:56:51 marka Exp $ */
/* $Id: dnssec-keygen.c,v 1.8 2000/03/06 20:04:15 bwelling Exp $ */
#include <config.h>
......@@ -28,6 +28,7 @@
#include <isc/commandline.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <dns/keyvalues.h>
#include <dst/dst.h>
#include <dst/result.h>
......@@ -46,7 +47,7 @@ main(int argc, char **argv) {
isc_mem_t *mctx = NULL;
int ch, rsa_exp = 0, generator = 0, param = 0;
int protocol = -1, size = -1;
dst_result_t ret;
isc_result_t ret;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
......@@ -235,6 +236,7 @@ main(int argc, char **argv) {
}
printf(" key for %s\n\n", name);
dst_result_register();
ret = dst_key_generate(name, alg, size, param, flags, protocol, mctx,
&key);
......
......@@ -29,6 +29,7 @@
#include <isc/boolean.h>
#include <isc/region.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <dst/dst.h>
#include <dst/result.h>
......@@ -37,7 +38,7 @@ char *current, *tmp = "/tmp";
static void
use(dst_key_t *key) {
dst_result_t ret;
isc_result_t ret;
char *data = "This is some data";
unsigned char sig[512];
isc_buffer_t databuf, sigbuf;
......@@ -53,28 +54,28 @@ use(dst_key_t *key) {
ret = dst_sign(DST_SIGMODE_ALL, key, NULL, &datareg, &sigbuf);
printf("sign(%d) returned: %s\n", dst_key_alg(key),
dst_result_totext(ret));
isc_result_totext(ret));
isc_buffer_forward(&sigbuf, 1);
isc_buffer_remaining(&sigbuf, &sigreg);
ret = dst_verify(DST_SIGMODE_ALL, key, NULL, &datareg, &sigreg);
printf("verify(%d) returned: %s\n", dst_key_alg(key),
dst_result_totext(ret));
isc_result_totext(ret));
}
static void
io(char *name, int id, int alg, int type, isc_mem_t *mctx) {
dst_key_t *key;
dst_result_t ret;
isc_result_t ret;
chdir(current);
ret = dst_key_fromfile(name, id, alg, type, mctx, &key);
printf("read(%d) returned: %s\n", alg, dst_result_totext(ret));
printf("read(%d) returned: %s\n", alg, isc_result_totext(ret));
if (ret != 0)
return;
chdir(tmp);
ret = dst_key_tofile(key, type);
printf("write(%d) returned: %s\n", alg, dst_result_totext(ret));
printf("write(%d) returned: %s\n", alg, isc_result_totext(ret));
if (ret != 0)
return;
use(key);
......@@ -84,7 +85,7 @@ io(char *name, int id, int alg, int type, isc_mem_t *mctx) {
static void
dh(char *name1, int id1, char *name2, int id2, isc_mem_t *mctx) {
dst_key_t *key1, *key2;
dst_result_t ret;
isc_result_t ret;
isc_buffer_t b1, b2;
isc_region_t r1, r2;
unsigned char array1[1024], array2[1024];
......@@ -93,33 +94,33 @@ dh(char *name1, int id1, char *name2, int id2, isc_mem_t *mctx) {
chdir(current);
ret = dst_key_fromfile(name1, id1, alg, type, mctx, &key1);
printf("read(%d) returned: %s\n", alg, dst_result_totext(ret));
printf("read(%d) returned: %s\n", alg, isc_result_totext(ret));
if (ret != 0)
return;
ret = dst_key_fromfile(name2, id2, alg, type, mctx, &key2);
printf("read(%d) returned: %s\n", alg, dst_result_totext(ret));
printf("read(%d) returned: %s\n", alg, isc_result_totext(ret));
if (ret != 0)
return;
chdir(tmp);
ret = dst_key_tofile(key1, type);
printf("write(%d) returned: %s\n", alg, dst_result_totext(ret));
printf("write(%d) returned: %s\n", alg, isc_result_totext(ret));
if (ret != 0)
return;
ret = dst_key_tofile(key2, type);
printf("write(%d) returned: %s\n", alg, dst_result_totext(ret));
printf("write(%d) returned: %s\n", alg, isc_result_totext(ret));
if (ret != 0)
return;
isc_buffer_init(&b1, array1, sizeof(array1), ISC_BUFFERTYPE_BINARY);
ret = dst_computesecret(key1, key2, &b1);
printf("computesecret() returned: %s\n", dst_result_totext(ret));
printf("computesecret() returned: %s\n", isc_result_totext(ret));
if (ret != 0)
return;
isc_buffer_init(&b2, array2, sizeof(array2), ISC_BUFFERTYPE_BINARY);
ret = dst_computesecret(key2, key1, &b2);
printf("computesecret() returned: %s\n", dst_result_totext(ret));
printf("computesecret() returned: %s\n", isc_result_totext(ret));
if (ret != 0)
return;
......@@ -145,11 +146,11 @@ dh(char *name1, int id1, char *name2, int id2, isc_mem_t *mctx) {
static void
generate(int alg, isc_mem_t *mctx) {
dst_result_t ret;
isc_result_t ret;
dst_key_t *key;
ret = dst_key_generate("test.", alg, 512, 0, 0, 0, mctx, &key);
printf("generate(%d) returned: %s\n", alg, dst_result_totext(ret));
printf("generate(%d) returned: %s\n", alg, isc_result_totext(ret));
if (alg != DST_ALG_DH)
use(key);
......@@ -161,12 +162,12 @@ static void
get_random() {
unsigned char data[25];
isc_buffer_t databuf;
dst_result_t ret;
isc_result_t ret;
unsigned int i;
isc_buffer_init(&databuf, data, sizeof data, ISC_BUFFERTYPE_BINARY);
ret = dst_random_get(sizeof(data), &databuf);
printf("random() returned: %s\n", dst_result_totext(ret));
printf("random() returned: %s\n", isc_result_totext(ret));
for (i = 0; i < sizeof data; i++)
printf("%02x ", data[i]);
printf("\n");
......@@ -181,6 +182,9 @@ main() {
current = isc_mem_get(mctx, 256);
getcwd(current, 256);
dns_result_register();
dst_result_register();
io("test.", 6204, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
io("test.", 54622, DST_ALG_RSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
......
......@@ -35,6 +35,7 @@
#include <isc/boolean.h>
#include <isc/region.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <dst/dst.h>
#include <dst/result.h>
......@@ -82,9 +83,9 @@ cleandir(char *path) {
static void
use(dst_key_t *key, dst_result_t exp_result, int *nfails) {
use(dst_key_t *key, isc_result_t exp_result, int *nfails) {
dst_result_t ret;
isc_result_t ret;
char *data = "This is some data";
unsigned char sig[512];
isc_buffer_t databuf, sigbuf;
......@@ -117,10 +118,10 @@ use(dst_key_t *key, dst_result_t exp_result, int *nfails) {
static void
dh(char *name1, int id1, char *name2, int id2, isc_mem_t *mctx,
dst_result_t exp_result, int *nfails, int *nprobs)
isc_result_t exp_result, int *nfails, int *nprobs)
{
dst_key_t *key1, *key2;
dst_result_t ret;
isc_result_t ret;
int rval;
char current[PATH_MAX + 1];
char tmp[PATH_MAX + 1];
......@@ -235,10 +236,10 @@ dh(char *name1, int id1, char *name2, int id2, isc_mem_t *mctx,
}
static void
io(char *name, int id, int alg, int type, isc_mem_t *mctx, dst_result_t exp_result,
io(char *name, int id, int alg, int type, isc_mem_t *mctx, isc_result_t exp_result,
int *nfails, int *nprobs) {
dst_key_t *key;
dst_result_t ret;
isc_result_t ret;
int rval;
char current[PATH_MAX + 1];
char tmp[PATH_MAX + 1];
......@@ -303,7 +304,7 @@ io(char *name, int id, int alg, int type, isc_mem_t *mctx, dst_result_t exp_resu
static void
generate(int alg, isc_mem_t *mctx, int size, int *nfails) {
dst_result_t ret;
isc_result_t ret;
dst_key_t *key;
ret = dst_key_generate("test.", alg, size, 0, 0, 0, mctx, &key);
......@@ -326,7 +327,7 @@ get_random(int *nfails) {
unsigned char data2[DBUFSIZ];
isc_buffer_t databuf1;
isc_buffer_t databuf2;
dst_result_t ret;
isc_result_t ret;
unsigned int i;
isc_buffer_init(&databuf1, data1, sizeof(data1), ISC_BUFFERTYPE_BINARY);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
*/
/* $Id: keygen.c,v 1.7 1999/10/29 12:56:51 marka Exp $ */
/* $Id: keygen.c,v 1.8 2000/03/06 20:04:15 bwelling Exp $ */
#include <config.h>
......@@ -28,6 +28,7 @@
#include <isc/commandline.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <dns/keyvalues.h>
#include <dst/dst.h>
#include <dst/result.h>
......@@ -46,7 +47,7 @@ main(int argc, char **argv) {
isc_mem_t *mctx = NULL;
int ch, rsa_exp = 0, generator = 0, param = 0;
int protocol = -1, size = -1;
dst_result_t ret;
isc_result_t ret;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
......@@ -235,6 +236,7 @@ main(int argc, char **argv) {
}
printf(" key for %s\n\n", name);
dst_result_register();
ret = dst_key_generate(name, alg, size, param, flags, protocol, mctx,
&key);
......
Supports Markdown
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