Commit 1fd4766e authored by Brian Wellington's avatar Brian Wellington
Browse files

constant renaming

parent 86887047
......@@ -6,70 +6,71 @@ ISC_LANG_BEGINDECLS
/*
* Flags field of the KEY RR rdata
*/
#define NS_KEY_TYPEMASK 0xC000 /* Mask for "type" bits */
#define NS_KEY_TYPE_AUTH_CONF 0x0000 /* Key usable for both */
#define NS_KEY_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */
#define NS_KEY_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */
#define NS_KEY_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */
/* The type bits can also be interpreted independently, as single bits: */
#define NS_KEY_NO_AUTH 0x8000 /* Key unusable for authentication */
#define NS_KEY_NO_CONF 0x4000 /* Key unusable for confidentiality */
#define NS_KEY_RESERVED2 0x2000 /* Security is *mandatory* if bit=0 */
#define NS_KEY_EXTENDED_FLAGS 0x1000 /* reserved - must be zero */
#define NS_KEY_RESERVED4 0x0800 /* reserved - must be zero */
#define NS_KEY_RESERVED5 0x0400 /* reserved - must be zero */
#define NS_KEY_NAME_TYPE 0x0300 /* these bits determine the type */
#define NS_KEY_NAME_USER 0x0000 /* key is assoc. with user */
#define NS_KEY_NAME_ENTITY 0x0200 /* key is assoc. with entity eg host */
#define NS_KEY_NAME_ZONE 0x0100 /* key is zone key */
#define NS_KEY_NAME_RESERVED 0x0300 /* reserved meaning */
#define NS_KEY_RESERVED8 0x0080 /* reserved - must be zero */
#define NS_KEY_RESERVED9 0x0040 /* reserved - must be zero */
#define NS_KEY_RESERVED10 0x0020 /* reserved - must be zero */
#define NS_KEY_RESERVED11 0x0010 /* reserved - must be zero */
#define NS_KEY_SIGNATORYMASK 0x000F /* key can sign RR's of same name */
#define DNS_KEYFLAG_TYPEMASK 0xC000 /* Mask for "type" bits */
#define DNS_KEYTYPE_AUTHCONF 0x0000 /* Key usable for both */
#define DNS_KEYTYPE_CONFONLY 0x8000 /* Key usable for confidentiality */
#define DNS_KEYTYPE_AUTHONLY 0x4000 /* Key usable for authentication */
#define DNS_KEYTYPE_NOKEY 0xC000 /* No key usable for either; no key */
#define DNS_KEYTYPE_NOAUTH DNS_KEYTYPE_CONFONLY
#define DNS_KEYTYPE_NOCONF DNS_KEYTYPE_AUTHONLY
#define NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
NS_KEY_RESERVED4 | \
NS_KEY_RESERVED5 | \
NS_KEY_RESERVED8 | \
NS_KEY_RESERVED9 | \
NS_KEY_RESERVED10 | \
NS_KEY_RESERVED11 )
#define DNS_KEYFLAG_RESERVED2 0x2000 /* Security is *mandatory* if bit=0 */
#define DNS_KEYFLAG_EXTENDED 0x1000 /* key has extended flags */
#define DNS_KEYFLAG_RESERVED4 0x0800 /* reserved - must be zero */
#define DNS_KEYFLAG_RESERVED5 0x0400 /* reserved - must be zero */
#define DNS_KEYFLAG_OWNERMASK 0x0300 /* these bits determine the type */
#define DNS_KEYOWNER_USER 0x0000 /* key is assoc. with user */
#define DNS_KEYOWNER_ENTITY 0x0200 /* key is assoc. with entity eg host */
#define DNS_KEYOWNER_ZONE 0x0100 /* key is zone key */
#define DNS_KEYOWNER_RESERVED 0x0300 /* reserved meaning */
#define DNS_KEYFLAG_RESERVED8 0x0080 /* reserved - must be zero */
#define DNS_KEYFLAG_RESERVED9 0x0040 /* reserved - must be zero */
#define DNS_KEYFLAG_RESERVED10 0x0020 /* reserved - must be zero */
#define DNS_KEYFLAG_RESERVED11 0x0010 /* reserved - must be zero */
#define DNS_KEYFLAG_SIGNATORYMASK 0x000F /* key can sign RR's of same name */
#define NS_KEY_RESERVED_BITMASK2 0xFFFF /* no bits defined here */
#define DNS_KEYFLAG_RESERVEDMASK (DNS_KEYFLAG_RESERVED2 | \
DNS_KEYFLAG_RESERVED4 | \
DNS_KEYFLAG_RESERVED5 | \
DNS_KEYFLAG_RESERVED8 | \
DNS_KEYFLAG_RESERVED9 | \
DNS_KEYFLAG_RESERVED10 | \
DNS_KEYFLAG_RESERVED11 )
#define DNS_KEYFLAG_RESERVEDMASK2 0xFFFF /* no bits defined here */
/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
#define NS_ALG_MD5RSA 1 /* MD5 with RSA */
#define NS_ALG_DH 2 /* Diffie Hellman KEY */
#define NS_ALG_DSA 3 /* DSA KEY */
#define NS_ALG_DSS NS_ALG_DSA
#define NS_ALG_EXPIRE_ONLY 253 /* No alg, no security */
#define NS_ALG_PRIVATE_OID 254 /* Key begins with OID giving alg */
#define DNS_KEYALG_MD5RSA 1 /* MD5 with RSA */
#define DNS_KEYALG_RSA DNS_KEYALG_MD5RSA
#define DNS_KEYALG_DH 2 /* Diffie Hellman KEY */
#define DNS_KEYALG_DSA 3 /* DSA KEY */
#define DNS_KEYALG_DSS NS_ALG_DSA
#define DNS_KEYALG_EXPIREONLY 253 /* No alg, no security */
#define DNS_KEYALG_PRIVATEOID 254 /* Key begins with OID giving alg */
/* Protocol values */
/* value 0 is reserved */
#define NS_KEY_PROT_TLS 1
#define NS_KEY_PROT_EMAIL 2
#define NS_KEY_PROT_DNSSEC 3
#define NS_KEY_PROT_IPSEC 4
#define NS_KEY_PROT_ANY 255
#define DNS_KEYPROTO_RESERVED 0
#define DNS_KEYPROTO_TLS 1
#define DNS_KEYPROTO_EMAIL 2
#define DNS_KEYPROTO_DNSSEC 3
#define DNS_KEYPROTO_IPSEC 4
#define DNS_KEYPROTO_ANY 255
/* Signatures */
#define NS_MD5RSA_MIN_BITS 512 /* Size of a mod or exp in bits */
#define NS_MD5RSA_MAX_BITS 2552
#define DNS_SIG_RSAMINBITS 512 /* Size of a mod or exp in bits */
#define DNS_SIG_RSAMAXBITS 2552
/* Total of binary mod and exp */
#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3)
#define DNS_SIG_RSAMAXBYTES ((DNS_SIG_RSAMAXBITS+7/8)*2+3)
/* Max length of text sig block */
#define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES+2)/3)*4)
#define NS_MD5RSA_MIN_SIZE ((NS_MD5RSA_MIN_BITS+7)/8)
#define NS_MD5RSA_MAX_SIZE ((NS_MD5RSA_MAX_BITS+7)/8)
#define DNS_SIG_RSAMAXBASE64 (((DNS_SIG_RSAMAXBYTES+2)/3)*4)
#define DNS_SIG_RSAMINSIZE ((DNS_SIG_RSAMINBITS+7)/8)
#define DNS_SIG_RSAMAXSIZE ((DNS_SIG_RSAMAXBITS+7)/8)
#define NS_DSA_SIG_SIZE 41
#define NS_DSA_MIN_BITS 512
#define NS_DSA_MAX_BITS 1024
#define NS_DSA_MIN_BYTES 213
#define NS_DSA_MAX_BYTES 405
#define DNS_SIG_DSASIGSIZE 41
#define DNS_SIG_DSAMINBITS 512
#define DNS_SIG_DSAMAXBITS 1024
#define DNS_SIG_DSAMINBYTES 213
#define DNS_SIG_DSAMAXBYTES 405
ISC_LANG_ENDDECLS
......
......@@ -19,7 +19,7 @@
/*
* Principal Author: Brian Wellington
* $Id: bsafe_link.c,v 1.3 1999/08/31 14:59:04 bwelling Exp $
* $Id: bsafe_link.c,v 1.4 1999/09/01 18:56:19 bwelling Exp $
*/
#include <config.h>
......@@ -153,7 +153,7 @@ dst_bsafe_sign(const unsigned int mode, dst_key_t *key, void **context,
{
int status = 0;
B_ALGORITHM_OBJ *md5_ctx = NULL;
unsigned char digest_array[NS_MD5RSA_MAX_SIZE];
unsigned char digest_array[DNS_SIG_RSAMAXSIZE];
isc_buffer_t digest;
isc_region_t sig_region, digest_region;
dst_result_t ret;
......@@ -196,7 +196,7 @@ dst_bsafe_sign(const unsigned int mode, dst_key_t *key, void **context,
rkey = (RSA_Key *) key->opaque;
if (rkey == NULL || rkey->rk_Private_Key == NULL)
return (DST_R_NULL_KEY);
return (DST_R_NULLKEY);
if ((status = B_CreateAlgorithmObject(&rsaEncryptor)) != 0)
return (DST_R_NOMEMORY);
......@@ -246,7 +246,7 @@ dst_bsafe_sign(const unsigned int mode, dst_key_t *key, void **context,
return (DST_R_SUCCESS);
finalfail:
B_DestroyAlgorithmObject(&rsaEncryptor);
return (DST_R_SIGN_FINAL_FAILURE);
return (DST_R_SIGNFINALFAILURE);
}
else
*context = md5_ctx;
......@@ -321,7 +321,7 @@ dst_bsafe_verify(const unsigned int mode, dst_key_t *key, void **context,
rkey = (RSA_Key *) key->opaque;
if (rkey == NULL || rkey->rk_Public_Key == NULL)
return (DST_R_NULL_KEY);
return (DST_R_NULLKEY);
if ((status = B_CreateAlgorithmObject(&rsaEncryptor)) != 0)
return (DST_R_NOMEMORY);
if ((status = B_SetAlgorithmInfo(rsaEncryptor,
......@@ -361,10 +361,10 @@ dst_bsafe_verify(const unsigned int mode, dst_key_t *key, void **context,
digest_region.length) == 0)
return (DST_R_SUCCESS);
else
return (DST_R_VERIFY_FINAL_FAILURE);
return (DST_R_VERIFYFINALFAILURE);
finalfail:
B_DestroyAlgorithmObject(&rsaEncryptor);
return (DST_R_VERIFY_FINAL_FAILURE);
return (DST_R_VERIFYFINALFAILURE);
}
else
*context = md5_ctx;
......@@ -396,7 +396,7 @@ dst_bsafe_to_dns(const dst_key_t *key, isc_buffer_t *data) {
public = (B_KEY_OBJ)((RSA_Key *)key->opaque)->rk_Public_Key;
if ((status = B_GetKeyInfo((POINTER *)&pub, public, KI_RSAPublic)) != 0)
return(DST_R_INVALID_PUBLIC_KEY);
return(DST_R_INVALIDPUBLICKEY);
isc_buffer_available(data, &r);
if (pub->exponent.len < 256) { /* key exponent is <= 2040 bits */
if (r.length < 1 + pub->exponent.len + pub->modulus.len)
......@@ -461,7 +461,7 @@ dst_bsafe_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
if (bytes > MAX_RSA_MODULUS_LEN) {
dst_bsafe_destroy(rkey, mctx);
return(DST_R_INVALID_PUBLIC_KEY);
return(DST_R_INVALIDPUBLICKEY);
}
public = (A_RSA_KEY *) isc_mem_get(mctx, sizeof(A_RSA_KEY));
......@@ -507,7 +507,7 @@ dst_bsafe_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
status = B_SetKeyInfo(rkey->rk_Public_Key, KI_RSAPublic,
(POINTER) public);
if (status != 0)
return (DST_R_INVALID_PUBLIC_KEY);
return (DST_R_INVALIDPUBLICKEY);
isc_buffer_init(&b, public->modulus.data + public->modulus.len - 3,
2, ISC_BUFFERTYPE_BINARY);
......@@ -541,7 +541,7 @@ dst_bsafe_to_file(const dst_key_t *key) {
dst_private_t priv;
if (key->opaque == NULL)
return (DST_R_NULL_KEY);
return (DST_R_NULLKEY);
rkey = (B_KEY_OBJ)((RSA_Key *) key->opaque)->rk_Private_Key;
......@@ -675,7 +675,7 @@ dst_bsafe_from_file(dst_key_t *key, const int id, isc_mem_t *mctx) {
isc_buffer_add(&b, 2);
key->key_id = isc_buffer_getuint16(&b);
if (key->key_id != id)
DST_RET(DST_R_INVALID_PRIVATE_KEY);
DST_RET(DST_R_INVALIDPRIVATEKEY);
rkey = (RSA_Key *) isc_mem_get(mctx, sizeof(RSA_Key));
if (rkey == NULL)
......@@ -685,14 +685,14 @@ dst_bsafe_from_file(dst_key_t *key, const int id, isc_mem_t *mctx) {
DST_RET(DST_R_NOMEMORY);
if ((status = B_SetKeyInfo(rkey->rk_Public_Key, KI_RSAPublic,
(POINTER) public)) != 0)
DST_RET(DST_R_INVALID_PUBLIC_KEY);
DST_RET(DST_R_INVALIDPUBLICKEY);
if ((status = B_CreateKeyObject(&rkey->rk_Private_Key)) != 0)
DST_RET(DST_R_NOMEMORY);
if ((status = B_SetKeyInfo(rkey->rk_Private_Key, KI_PKCS_RSAPrivate,
(POINTER) private)) != 0)
DST_RET(DST_R_INVALID_PRIVATE_KEY);
DST_RET(DST_R_INVALIDPRIVATEKEY);
key->key_size = dst_bsafe_key_size(rkey);
key->opaque = rkey;
......@@ -811,7 +811,7 @@ dst_bsafe_generate(dst_key_t *key, int exp, isc_mem_t *mctx) {
keygenParams.publicExponent.len = exponent_len;
if ((status = B_SetAlgorithmInfo
(keypairGenerator, AI_RSAKeyGen, (POINTER) &keygenParams)) != 0)
do_fail(DST_R_INVALID_PARAM);
do_fail(DST_R_INVALIDPARAM);
isc_mem_put(mctx, keygenParams.publicExponent.data, exponent_len);
keygenParams.publicExponent.data = NULL;
......@@ -851,7 +851,7 @@ dst_bsafe_generate(dst_key_t *key, int exp, isc_mem_t *mctx) {
if ((status = B_GenerateKeypair(keypairGenerator, public, private,
randomAlgorithm, NULL_SURRENDER)) != 0)
do_fail(DST_R_INVALID_PARAM);
do_fail(DST_R_INVALIDPARAM);
rsa->rk_Private_Key = private;
rsa->rk_Public_Key = public;
......@@ -1008,19 +1008,19 @@ dst_bsafe_md5digest(const unsigned int mode, B_ALGORITHM_OBJ *digest_obj,
if ((mode & DST_SIGMODE_INIT) &&
(status = B_DigestInit(*digest_obj, (B_KEY_OBJ) NULL,
CHOOSER, NULL_SURRENDER)) != 0)
return (DST_R_SIGN_INIT_FAILURE);
return (DST_R_SIGNINITFAILURE);
if ((mode & DST_SIGMODE_UPDATE) &&
(status = B_DigestUpdate(*digest_obj, data->base, data->length,
NULL_SURRENDER)) != 0)
return (DST_R_SIGN_UPDATE_FAILURE);
return (DST_R_SIGNUPDATEFAILURE);
isc_buffer_available(digest, &r);
if (mode & DST_SIGMODE_FINAL) {
if (digest == NULL ||
(status = B_DigestFinal(*digest_obj, r.base, &written,
r.length, NULL_SURRENDER)) != 0)
return (DST_R_SIGN_FINAL_FAILURE);
return (DST_R_SIGNFINALFAILURE);
isc_buffer_add(digest, written);
}
return (DST_R_SUCCESS);
......
......@@ -17,7 +17,7 @@
/*
* Principal Author: Brian Wellington
* $Id: dst_api.c,v 1.7 1999/08/31 14:59:08 bwelling Exp $
* $Id: dst_api.c,v 1.8 1999/09/01 18:56:19 bwelling Exp $
*/
#include <config.h>
......@@ -119,9 +119,9 @@ dst_sign(const unsigned int mode, dst_key_t *key, dst_context_t *context,
REQUIRE(sig != NULL);
if (dst_supported_algorithm(key->key_alg) == ISC_FALSE)
return (DST_R_UNSUPPORTED_ALG);
return (DST_R_UNSUPPORTEDALG);
if (key->opaque == NULL)
return (DST_R_NULL_KEY);
return (DST_R_NULLKEY);
return (key->func->sign(mode, key, (void **)context, data, sig,
key->mctx));
......@@ -166,9 +166,9 @@ dst_verify(const unsigned int mode, dst_key_t *key, dst_context_t *context,
REQUIRE(sig != NULL && sig->base != NULL);
if (dst_supported_algorithm(key->key_alg) == ISC_FALSE)
return (DST_R_UNSUPPORTED_ALG);
return (DST_R_UNSUPPORTEDALG);
if (key->opaque == NULL)
return (DST_R_NULL_KEY);
return (DST_R_NULLKEY);
return (key->func->verify(mode, key, (void **)context, data, sig,
key->mctx));
......@@ -192,17 +192,17 @@ dst_key_tofile(const dst_key_t *key, const int type) {
REQUIRE(VALID_KEY(key));
if (dst_supported_algorithm(key->key_alg) == ISC_FALSE)
return (DST_R_UNSUPPORTED_ALG);
return (DST_R_UNSUPPORTEDALG);
if ((type & (DST_TYPE_PRIVATE | DST_TYPE_PUBLIC)) == 0)
return (DST_R_UNSUPPORTED_TYPE);
return (DST_R_UNSUPPORTEDTYPE);
if (type & DST_TYPE_PUBLIC)
if ((ret = write_public_key(key)) != DST_R_SUCCESS)
return (ret);
if ((type & DST_TYPE_PRIVATE) &&
(key->key_flags & NS_KEY_TYPEMASK) != NS_KEY_TYPE_NO_KEY)
(key->key_flags & DNS_KEYFLAG_TYPEMASK) != DNS_KEYTYPE_NOKEY)
{
ret = key->func->to_file(key);
if (ret != DST_R_SUCCESS)
......@@ -241,17 +241,17 @@ dst_key_fromfile(const char *name, const isc_uint16_t id, const int alg,
*keyp = NULL;
if (dst_supported_algorithm(alg) == ISC_FALSE)
return (DST_R_UNSUPPORTED_ALG);
return (DST_R_UNSUPPORTEDALG);
if ((type & (DST_TYPE_PRIVATE | DST_TYPE_PUBLIC)) == 0)
return (DST_R_UNSUPPORTED_TYPE);
return (DST_R_UNSUPPORTEDTYPE);
ret = read_public_key(name, id, alg, mctx, &pubkey);
if (ret != DST_R_SUCCESS)
return (ret);
if (type == DST_TYPE_PUBLIC ||
(pubkey->key_flags & NS_KEY_TYPEMASK) == NS_KEY_TYPE_NO_KEY)
(pubkey->key_flags & DNS_KEYFLAG_TYPEMASK) == DNS_KEYTYPE_NOKEY)
{
*keyp = pubkey;
return (DST_R_SUCCESS);
......@@ -293,7 +293,7 @@ dst_key_todns(const dst_key_t *key, isc_buffer_t *target) {
REQUIRE(target != NULL);
if (dst_supported_algorithm(key->key_alg) == ISC_FALSE)
return (DST_R_UNSUPPORTED_ALG);
return (DST_R_UNSUPPORTEDALG);
isc_buffer_available(target, &r);
if (r.length < 4)
......@@ -302,7 +302,7 @@ dst_key_todns(const dst_key_t *key, isc_buffer_t *target) {
isc_buffer_putuint8(target, key->key_proto);
isc_buffer_putuint8(target, key->key_alg);
if (key->key_flags & NS_KEY_EXTENDED_FLAGS) {
if (key->key_flags & DNS_KEYFLAG_EXTENDED) {
isc_buffer_available(target, &r);
if (r.length < 2)
return (DST_R_NOSPACE);
......@@ -345,18 +345,18 @@ dst_key_fromdns(const char *name, isc_buffer_t *source, isc_mem_t *mctx,
isc_buffer_remaining(source, &r);
if (r.length < 4) /* 2 bytes of flags, 1 proto, 1 alg */
return (DST_R_INVALID_PUBLIC_KEY);
return (DST_R_INVALIDPUBLICKEY);
flags = isc_buffer_getuint16(source);
proto = isc_buffer_getuint8(source);
alg = isc_buffer_getuint8(source);
if (!dst_supported_algorithm(alg))
return (DST_R_UNSUPPORTED_ALG);
return (DST_R_UNSUPPORTEDALG);
if (flags & NS_KEY_EXTENDED_FLAGS) {
if (flags & DNS_KEYFLAG_EXTENDED) {
isc_buffer_remaining(source, &r);
if (r.length < 2)
return (DST_R_INVALID_PUBLIC_KEY);
return (DST_R_INVALIDPUBLICKEY);
extflags = isc_buffer_getuint16(source);
flags |= (extflags << 16);
}
......@@ -401,7 +401,7 @@ dst_key_frombuffer(const char *name, const int alg, const int flags,
REQUIRE(mctx != NULL);
if (dst_supported_algorithm(alg) == ISC_FALSE)
return (DST_R_UNSUPPORTED_ALG);
return (DST_R_UNSUPPORTEDALG);
*keyp = get_key_struct(name, alg, flags, protocol, 0, mctx);
......@@ -434,7 +434,7 @@ dst_key_tobuffer(const dst_key_t *key, isc_buffer_t *target) {
REQUIRE(target != NULL);
if (dst_supported_algorithm(key->key_alg) == ISC_FALSE)
return (DST_R_UNSUPPORTED_ALG);
return (DST_R_UNSUPPORTEDALG);
return (key->func->to_dns(key, target));
}
......@@ -474,14 +474,14 @@ dst_key_generate(const char *name, const int alg, const int bits,
REQUIRE(keyp != NULL);
if (dst_supported_algorithm(alg) == ISC_FALSE)
return (DST_R_UNSUPPORTED_ALG);
return (DST_R_UNSUPPORTEDALG);
*keyp = get_key_struct(name, alg, flags, protocol, bits, mctx);
if (*keyp == NULL)
return (DST_R_NOMEMORY);
if (bits == 0) { /* NULL KEY */
(*keyp)->key_flags |= NS_KEY_TYPE_NO_KEY;
(*keyp)->key_flags |= DNS_KEYTYPE_NOKEY;
return (DST_R_SUCCESS);
}
......@@ -598,7 +598,7 @@ dst_sig_size(const dst_key_t *key) {
case DST_ALG_RSA:
return (key->key_size + 7) / 8;
case DST_ALG_DSA:
return (NS_DSA_SIG_SIZE);
return (DNS_SIG_DSASIGSIZE);
case DST_ALG_HMAC_MD5:
return (16);
case DST_ALG_HMAC_SHA1:
......@@ -739,7 +739,7 @@ read_public_key(const char *name, const isc_uint16_t id, int alg,
if (dst_s_build_filename(filename, name, id, alg, PUBLIC_KEY,
PATH_MAX) != DST_R_SUCCESS)
return (DST_R_NAME_TOO_LONG);
return (DST_R_NAMETOOLONG);
/*
* Open the file and read its formatted contents
......@@ -804,7 +804,7 @@ cleanup:
isc_lex_close(lex);
isc_lex_destroy(&lex);
}
return (DST_R_INVALID_PUBLIC_KEY);
return (DST_R_INVALIDPUBLICKEY);
}
......@@ -846,7 +846,7 @@ write_public_key(const dst_key_t *key) {
dnsret = dns_rdata_totext(&rdata, (dns_name_t *) NULL, &textb);
if (dnsret != DNS_R_SUCCESS)
return (DST_R_INVALID_PUBLIC_KEY);
return (DST_R_INVALIDPUBLICKEY);
dns_rdata_freestruct(&rdata);
......@@ -855,11 +855,11 @@ write_public_key(const dst_key_t *key) {
/* Make the filename */
if (dst_s_build_filename(filename, key->key_name, key->key_id,
key->key_alg, PUBLIC_KEY, PATH_MAX) < 0)
return (DST_R_NAME_TOO_LONG);
return (DST_R_NAMETOOLONG);
/* create public key file */
if ((fp = fopen(filename, "w")) == NULL)
return (DST_R_WRITE_ERROR);
return (DST_R_WRITEERROR);
fprintf(fp, "%s IN KEY ", key->key_name);
fwrite(r.base, 1, r.length, fp);
......
......@@ -17,7 +17,7 @@
/*
* Principal Author: Brian Wellington
* $Id: dst_parse.c,v 1.2 1999/08/20 17:03:30 bwelling Exp $
* $Id: dst_parse.c,v 1.3 1999/09/01 18:56:19 bwelling Exp $
*/
#include <config.h>
......@@ -148,7 +148,7 @@ check_data(const dst_private_t *priv, const int alg) {
case DST_ALG_HMAC_MD5:
return (check_hmac_md5(priv));
default:
return (DST_R_UNSUPPORTED_ALG);
return (DST_R_UNSUPPORTEDALG);
}
}
......@@ -178,7 +178,7 @@ dst_s_parse_private_key_file(const char *name, const int alg, const int id,
isc_token_t token;
unsigned int opt = ISC_LEXOPT_EOL;
isc_result_t iret;
isc_result_t error = DST_R_INVALID_PRIVATE_KEY;
isc_result_t error = DST_R_INVALIDPRIVATEKEY;
REQUIRE(priv != NULL);
......@@ -187,7 +187,7 @@ dst_s_parse_private_key_file(const char *name, const int alg, const int id,
ret = dst_s_build_filename(filename, name, id, alg, PRIVATE_KEY,
PATH_MAX);
if (ret < 0)
return (DST_R_NAME_TOO_LONG);
return (DST_R_NAMETOOLONG);
iret = isc_lex_create(mctx, 1024, &lex);
if (iret != ISC_R_SUCCESS)
......@@ -263,7 +263,7 @@ dst_s_parse_private_key_file(const char *name, const int alg, const int id,
data = (unsigned char *) isc_mem_get(mctx, MAXFIELDSIZE);
if (data == NULL) {
error = DST_R_INVALID_PRIVATE_KEY;
error = DST_R_INVALIDPRIVATEKEY;
goto fail;
}
isc_buffer_init(&b, data, MAXFIELDSIZE, ISC_BUFFERTYPE_BINARY);
......@@ -295,7 +295,7 @@ fail:
priv->nelements = n;
dst_s_free_private_structure_fields(priv, mctx);
return (DST_R_INVALID_PRIVATE_KEY);
return (DST_R_INVALIDPRIVATEKEY);
}
int
......@@ -311,15 +311,15 @@ dst_s_write_private_key_file(const char *name, const int alg, const int id,
REQUIRE(priv != NULL);
if (check_data(priv, alg) < 0)
return (DST_R_INVALID_PRIVATE_KEY);
return (DST_R_INVALIDPRIVATEKEY);
ret = dst_s_build_filename(filename, name, id, alg, PRIVATE_KEY,
PATH_MAX);
if (ret < 0)
return (DST_R_NAME_TOO_LONG);
return (DST_R_NAMETOOLONG);
if ((fp = fopen(filename, "w")) == NULL)
return (DST_R_WRITE_ERROR);
return (DST_R_WRITEERROR);
/* This won't exist on non-unix systems. Hmmm.... */
chmod(filename, 0600);
......@@ -349,7 +349,7 @@ dst_s_write_private_key_file(const char *name, const int alg, const int id,
iret = isc_base64_totext(&r, sizeof(buffer), "", &b);
if (iret != ISC_R_SUCCESS) {
fclose(fp);
return(DST_R_INVALID_PRIVATE_KEY);
return(DST_R_INVALIDPRIVATEKEY);
}
isc_buffer_used(&b, &r);
......
......@@ -17,7 +17,7 @@
/*
* Principal Author: Brian Wellington
* $Id: hmac_link.c,v 1.4 1999/08/31 14:59:08 bwelling Exp $
* $Id: hmac_link.c,v 1.5 1999/09/01 18:56:19 bwelling Exp $
*/
#include <config.h>
......@@ -210,7 +210,7 @@ dst_hmacmd5_verify(const unsigned int mode, dst_key_t *key, void **context,
HMAC_Key *hkey = key->opaque;
if (sig->length < MD5_LEN)
return (DST_R_VERIFY_FINAL_FAILURE);
return (DST_R_VERIFYFINALFAILURE);
MD5Final(digest, ctx);
......@@ -223,7 +223,7 @@ dst_hmacmd5_verify(const unsigned int mode, dst_key_t *key, void **context,
isc_mem_put(mctx, ctx, sizeof(MD5_CTX));
if (memcmp(digest, sig->base, MD5_LEN) != 0)
return (DST_R_VERIFY_FINAL_FAILURE);
return (DST_R_VERIFYFINALFAILURE);
}
else
*context = ctx;
......@@ -341,7 +341,7 @@ dst_hmacmd5_to_file(const dst_key_t *key) {
unsigned char keydata[HMAC_LEN];
if (key->opaque == NULL)
return (DST_R_NULL_KEY);
return (DST_R_NULLKEY);
hkey = (HMAC_Key *) key->opaque;
for (i = 0; i < HMAC_LEN; i++)
......
......@@ -13,21 +13,21 @@ typedef unsigned int dst_result_t;
#define DST_R_NOMEMORY ISC_R_NOMEMORY
#define DST_R_NOSPACE ISC_R_NOSPACE
#define DST_R_UNSUPPORTED_ALG (ISC_RESULTCLASS_DST + 0)
#define DST_R_UNSUPPORTED_TYPE (ISC_RESULTCLASS_DST + 1)
#define DST_R_UNSUPPORTED_MODE (ISC_RESULTCLASS_DST + 2)
#define DST_R_NULL_KEY (ISC_RESULTCLASS_DST + 3)
#define DST_R_INVALID_PUBLIC_KEY (ISC_RESULTCLASS_DST + 4)
#define DST_R_INVALID_PRIVATE_KEY (ISC_RESULTCLASS_DST + 5)
#define DST_R_NAME_TOO_LONG (ISC_RESULTCLASS_DST + 6)
#define DST_R_WRITE_ERROR (ISC_RESULTCLASS_DST + 7)
#define DST_R_INVALID_PARAM (ISC_RESULTCLASS_DST + 8)
#define DST_R_SIGN_INIT_FAILURE (ISC_RESULTCLASS_DST + 9)
#define DST_R_SIGN_UPDATE_FAILURE (ISC_RESULTCLASS_DST + 10)
#define DST_R_SIGN_FINAL_FAILURE (ISC_RESULTCLASS_DST + 11)
#define DST_R_VERIFY_INIT_FAILURE (ISC_RESULTCLASS_DST + 12)
#define DST_R_VERIFY_UPDATE_FAILURE (ISC_RESULTCLASS_DST + 13)
#define DST_R_VERIFY_FINAL_FAILURE (ISC_RESULTCLASS_DST + 14)
#define DST_R_UNSUPPORTEDALG (ISC_RESULTCLASS_DST + 0)
#define DST_R_UNSUPPORTEDTYPE (ISC_RESULTCLASS_DST + 1)
#define DST_R_UNSUPPORTEDMODE (ISC_RESULTCLASS_DST + 2)
#define DST_R_NULLKEY (ISC_RESULTCLASS_DST + 3)
#define DST_R_INVALIDPUBLICKEY (ISC_RESULTCLASS_DST + 4)
#define DST_R_INVALIDPRIVATEKEY (ISC_RESULTCLASS_DST + 5)
#define DST_R_NAMETOOLONG (ISC_RESULTCLASS_DST + 6)
#define DST_R_WRITEERROR (ISC_RESULTCLASS_DST + 7)
#define DST_R_INVALIDPARAM (ISC_RESULTCLASS_DST + 8)
#define DST_R_SIGNINITFAILURE (ISC_RESULTCLASS_DST + 9)
#define DST_R_SIGNUPDATEFAILURE (ISC_RESULTCLASS_DST + 10)
#define DST_R_SIGNFINALFAILURE (ISC_RESULTCLASS_DST + 11)
#define DST_R_VERIFYINITFAILURE (ISC_RESULTCLASS_DST + 12)
#define DST_R_VERIFYUPDATEFAILURE (ISC_RESULTCLASS_DST + 13)
#define DST_R_VERIFYFINALFAILURE (ISC_RESULTCLASS_DST + 14)
#define DST_R_NRESULTS 15 /* Number of results */
......