mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +00:00
dst error code cleanup
This commit is contained in:
parent
f1962da938
commit
a7d792804f
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dnssec-keygen.c,v 1.4 1999/10/10 17:13:29 halley Exp $ */
|
||||
/* $Id: dnssec-keygen.c,v 1.5 1999/10/20 22:14:14 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -238,13 +238,13 @@ main(int argc, char **argv) {
|
||||
ret = dst_key_generate(name, alg, size, param, flags, protocol, mctx,
|
||||
&key);
|
||||
|
||||
if (ret != DST_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
printf("Failed generating key %s\n", name);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
ret = dst_key_tofile(key, DST_TYPE_PUBLIC | DST_TYPE_PRIVATE);
|
||||
if (ret != DST_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
printf("Failed to write key %s(%d)\n", name, dst_key_id(key));
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ io(char *name, int id, int alg, int type, isc_mem_t *mctx, dst_result_t exp_resu
|
||||
}
|
||||
|
||||
ret = dst_key_fromfile(name, id, alg, type, mctx, &key);
|
||||
if (ret != DST_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
t_info("dst_key_fromfile(%d) returned: %s\n", alg, dst_result_totext(ret));
|
||||
++*nfails;
|
||||
return;
|
||||
@ -187,13 +187,13 @@ generate(int alg, isc_mem_t *mctx, int *nfails) {
|
||||
dst_key_t *key;
|
||||
|
||||
ret = dst_key_generate("test.", alg, 512, 0, 0, 0, mctx, &key);
|
||||
if (ret != DST_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
t_info("dst_key_generate(%d) returned: %s\n", alg, dst_result_totext(ret));
|
||||
++*nfails;
|
||||
return;
|
||||
}
|
||||
|
||||
use(key, DST_R_SUCCESS, nfails);
|
||||
use(key, ISC_R_SUCCESS, nfails);
|
||||
dst_key_free(key);
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ get_random(int *nfails) {
|
||||
|
||||
isc_buffer_init(&databuf1, data1, sizeof(data1), ISC_BUFFERTYPE_BINARY);
|
||||
ret = dst_random_get(sizeof(data1), &databuf1);
|
||||
if (ret != DST_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
t_info("random() returned: %s\n", dst_result_totext(ret));
|
||||
++*nfails;
|
||||
return;
|
||||
@ -218,7 +218,7 @@ get_random(int *nfails) {
|
||||
|
||||
isc_buffer_init(&databuf2, data2, sizeof(data2), ISC_BUFFERTYPE_BINARY);
|
||||
ret = dst_random_get(sizeof(data2), &databuf2);
|
||||
if (ret != DST_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
t_info("random() returned: %s\n", dst_result_totext(ret));
|
||||
++*nfails;
|
||||
return;
|
||||
@ -265,9 +265,9 @@ t1() {
|
||||
|
||||
t_info("testing use of stored keys\n");
|
||||
io("test.", 6204, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
|
||||
mctx, DST_R_SUCCESS, &nfails, &nprobs);
|
||||
mctx, ISC_R_SUCCESS, &nfails, &nprobs);
|
||||
io("test.", 54622, DST_ALG_RSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
|
||||
mctx, DST_R_SUCCESS, &nfails, &nprobs);
|
||||
mctx, ISC_R_SUCCESS, &nfails, &nprobs);
|
||||
|
||||
io("test.", 0, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
|
||||
mctx, DST_R_NULLKEY, &nfails, &nprobs);
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: keygen.c,v 1.4 1999/10/10 17:13:29 halley Exp $ */
|
||||
/* $Id: keygen.c,v 1.5 1999/10/20 22:14:14 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -238,13 +238,13 @@ main(int argc, char **argv) {
|
||||
ret = dst_key_generate(name, alg, size, param, flags, protocol, mctx,
|
||||
&key);
|
||||
|
||||
if (ret != DST_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
printf("Failed generating key %s\n", name);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
ret = dst_key_tofile(key, DST_TYPE_PUBLIC | DST_TYPE_PRIVATE);
|
||||
if (ret != DST_R_SUCCESS) {
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
printf("Failed to write key %s(%d)\n", name, dst_key_id(key));
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
/*
|
||||
* Principal Author: Brian Wellington
|
||||
* $Id: bsafe_link.c,v 1.9 1999/10/20 19:08:56 bwelling Exp $
|
||||
* $Id: bsafe_link.c,v 1.10 1999/10/20 22:14:14 bwelling Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -147,8 +147,8 @@ dst_s_bsafersa_init() {
|
||||
* signature buffer to store signature
|
||||
* mctx memory context for temporary allocations
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_bsafe_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
@ -165,11 +165,11 @@ dst_bsafe_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
md5_ctx = (B_ALGORITHM_OBJ *) isc_mem_get(mctx,
|
||||
sizeof(*md5_ctx));
|
||||
if (md5_ctx == NULL)
|
||||
return(DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
if ((status = B_CreateAlgorithmObject(md5_ctx)) != 0)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
if ((status = B_SetAlgorithmInfo(*md5_ctx, AI_MD5, NULL)) != 0)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
else if (context != NULL)
|
||||
md5_ctx = (B_ALGORITHM_OBJ *) *context;
|
||||
@ -178,11 +178,11 @@ dst_bsafe_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
isc_buffer_init(&digest, digest_array, sizeof(digest_array),
|
||||
ISC_BUFFERTYPE_BINARY);
|
||||
ret = dst_bsafe_md5digest(mode, md5_ctx, data, &digest);
|
||||
if (ret != DST_R_SUCCESS || (mode & DST_SIGMODE_FINAL)) {
|
||||
if (ret != ISC_R_SUCCESS || (mode & DST_SIGMODE_FINAL)) {
|
||||
B_DestroyAlgorithmObject(md5_ctx);
|
||||
memset(md5_ctx, 0, sizeof(*md5_ctx));
|
||||
isc_mem_put(mctx, md5_ctx, sizeof(*md5_ctx));
|
||||
if (ret != DST_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ dst_bsafe_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
isc_buffer_remaining(&digest, &digest_region);
|
||||
|
||||
if (sig_region.length * 8 < (unsigned int) key->key_size)
|
||||
return (DST_R_NOSPACE);
|
||||
return (ISC_R_NOSPACE);
|
||||
|
||||
rkey = (RSA_Key *) key->opaque;
|
||||
if (rkey == NULL)
|
||||
@ -204,7 +204,7 @@ dst_bsafe_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
return (DST_R_NOTPRIVATEKEY);
|
||||
|
||||
if ((status = B_CreateAlgorithmObject(&rsaEncryptor)) != 0)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
if ((status = B_SetAlgorithmInfo(rsaEncryptor,
|
||||
AI_PKCS_RSAPrivate,
|
||||
NULL_PTR)) != 0)
|
||||
@ -248,7 +248,7 @@ dst_bsafe_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
isc_buffer_add(sig, written);
|
||||
|
||||
B_DestroyAlgorithmObject(&rsaEncryptor);
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
finalfail:
|
||||
B_DestroyAlgorithmObject(&rsaEncryptor);
|
||||
return (DST_R_SIGNFINALFAILURE);
|
||||
@ -256,7 +256,7 @@ dst_bsafe_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
else
|
||||
*context = md5_ctx;
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -274,8 +274,8 @@ dst_bsafe_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
* signature signature
|
||||
* mctx memory context for temporary allocations
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_bsafe_verify(const unsigned int mode, dst_key_t *key, void **context,
|
||||
@ -293,11 +293,11 @@ dst_bsafe_verify(const unsigned int mode, dst_key_t *key, void **context,
|
||||
md5_ctx = (B_ALGORITHM_OBJ *) isc_mem_get(mctx,
|
||||
sizeof(*md5_ctx));
|
||||
if (md5_ctx == NULL)
|
||||
return(DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
if ((status = B_CreateAlgorithmObject(md5_ctx)) != 0)
|
||||
return(DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
if ((status = B_SetAlgorithmInfo(*md5_ctx, AI_MD5, NULL)) != 0)
|
||||
return(DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
else if (context != NULL)
|
||||
md5_ctx = (B_ALGORITHM_OBJ *) *context;
|
||||
@ -306,11 +306,11 @@ dst_bsafe_verify(const unsigned int mode, dst_key_t *key, void **context,
|
||||
isc_buffer_init(&digest, digest_array, sizeof(digest_array),
|
||||
ISC_BUFFERTYPE_BINARY);
|
||||
ret = dst_bsafe_md5digest(mode, md5_ctx, data, &digest);
|
||||
if (ret != DST_R_SUCCESS || (mode & DST_SIGMODE_FINAL)) {
|
||||
if (ret != ISC_R_SUCCESS || (mode & DST_SIGMODE_FINAL)) {
|
||||
B_DestroyAlgorithmObject(md5_ctx);
|
||||
memset(md5_ctx, 0, sizeof(*md5_ctx));
|
||||
isc_mem_put(mctx, md5_ctx, sizeof(*md5_ctx));
|
||||
if (ret != DST_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ dst_bsafe_verify(const unsigned int mode, dst_key_t *key, void **context,
|
||||
if (rkey->rk_Public_Key == NULL)
|
||||
return (DST_R_NOTPUBLICKEY);
|
||||
if ((status = B_CreateAlgorithmObject(&rsaEncryptor)) != 0)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
if ((status = B_SetAlgorithmInfo(rsaEncryptor,
|
||||
AI_PKCS_RSAPublic,
|
||||
NULL_PTR)) != 0)
|
||||
@ -366,7 +366,7 @@ dst_bsafe_verify(const unsigned int mode, dst_key_t *key, void **context,
|
||||
/* skip PKCS#1 header in output from Decrypt function */
|
||||
if (memcmp(digest_region.base, work_region.base + sizeof(pkcs1),
|
||||
digest_region.length) == 0)
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
else
|
||||
return (DST_R_VERIFYFINALFAILURE);
|
||||
finalfail:
|
||||
@ -376,7 +376,7 @@ dst_bsafe_verify(const unsigned int mode, dst_key_t *key, void **context,
|
||||
else
|
||||
*context = md5_ctx;
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -403,8 +403,8 @@ dst_bsafe_isprivate(const dst_key_t *key) {
|
||||
* key DST KEY structure
|
||||
* data output data
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
|
||||
static dst_result_t
|
||||
@ -419,15 +419,15 @@ 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_INVALIDPUBLICKEY);
|
||||
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)
|
||||
return(DST_R_NOSPACE);
|
||||
return (ISC_R_NOSPACE);
|
||||
isc_buffer_putuint8(data, (isc_uint8_t)pub->exponent.len);
|
||||
} else { /* key exponent is > 2040 bits */
|
||||
if (r.length < 3 + pub->exponent.len + pub->modulus.len)
|
||||
return(DST_R_NOSPACE);
|
||||
return (ISC_R_NOSPACE);
|
||||
isc_buffer_putuint8(data, 0);
|
||||
isc_buffer_putuint16(data, (isc_uint16_t)pub->exponent.len);
|
||||
}
|
||||
@ -438,7 +438,7 @@ dst_bsafe_to_dns(const dst_key_t *key, isc_buffer_t *data) {
|
||||
memcpy(r.base, pub->modulus.data, pub->modulus.len);
|
||||
isc_buffer_add(data, pub->exponent.len + pub->modulus.len);
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -449,8 +449,8 @@ dst_bsafe_to_dns(const dst_key_t *key, isc_buffer_t *data) {
|
||||
* key Partially filled key structure
|
||||
* data Buffer containing key in DNS format
|
||||
* Return
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_bsafe_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
@ -463,17 +463,17 @@ dst_bsafe_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
|
||||
isc_buffer_remaining(data, &r);
|
||||
if (r.length == 0)
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
rkey = (RSA_Key *) isc_mem_get(mctx, sizeof(RSA_Key));
|
||||
if (rkey == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
memset(rkey, 0, sizeof(RSA_Key));
|
||||
|
||||
if (B_CreateKeyObject(&rkey->rk_Public_Key) != 0) {
|
||||
isc_mem_put(mctx, rkey, sizeof(RSA_Key));
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
|
||||
/* length of exponent in bytes */
|
||||
@ -483,24 +483,24 @@ 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_INVALIDPUBLICKEY);
|
||||
return (DST_R_INVALIDPUBLICKEY);
|
||||
}
|
||||
|
||||
public = (A_RSA_KEY *) isc_mem_get(mctx, sizeof(A_RSA_KEY));
|
||||
if (public == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
memset(public, 0, sizeof(*public));
|
||||
public->exponent.len = bytes;
|
||||
public->exponent.data = (unsigned char *) isc_mem_get(mctx, bytes);
|
||||
if (public->exponent.data == NULL) {
|
||||
isc_mem_put(mctx, public, sizeof(*public));
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
|
||||
isc_buffer_remaining(data, &r);
|
||||
if (r.length < bytes) {
|
||||
isc_mem_put(mctx, public, sizeof(*public));
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
memcpy(public->exponent.data, r.base, bytes);
|
||||
isc_buffer_forward(data, bytes);
|
||||
@ -512,7 +512,7 @@ dst_bsafe_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
memset(public->exponent.data, 0, bytes);
|
||||
isc_mem_put(mctx, public->exponent.data, bytes);
|
||||
isc_mem_put(mctx, public, sizeof(*public));
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
public->modulus.len = r.length;
|
||||
public->modulus.data = (unsigned char *) isc_mem_get(mctx, r.length);
|
||||
@ -521,7 +521,7 @@ dst_bsafe_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
memset(public->exponent.data, 0, bytes);
|
||||
isc_mem_put(mctx, public->exponent.data, bytes);
|
||||
isc_mem_put(mctx, public, sizeof(*public));
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
memcpy(public->modulus.data, r.base, r.length);
|
||||
isc_buffer_forward(data, r.length);
|
||||
@ -545,7 +545,7 @@ dst_bsafe_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
|
||||
key->opaque = (void *) rkey;
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -555,8 +555,8 @@ dst_bsafe_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
* Parameters
|
||||
* key DST KEY structure
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_bsafe_to_file(const dst_key_t *key) {
|
||||
@ -618,8 +618,8 @@ dst_bsafe_to_file(const dst_key_t *key) {
|
||||
* id The key id
|
||||
* path The directory that the file will be read from
|
||||
* Return
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
|
||||
static dst_result_t
|
||||
@ -637,18 +637,18 @@ dst_bsafe_from_file(dst_key_t *key, const isc_uint16_t id, isc_mem_t *mctx) {
|
||||
/* read private key file */
|
||||
ret = dst_s_parse_private_key_file(key->key_name, key->key_alg,
|
||||
id, &priv, mctx);
|
||||
if (ret != DST_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
return (ret);
|
||||
/* allocate key*/
|
||||
private = (A_PKCS_RSA_PRIVATE_KEY *)
|
||||
isc_mem_get(mctx, sizeof(A_PKCS_RSA_PRIVATE_KEY));
|
||||
if (private == NULL)
|
||||
DST_RET(DST_R_NOMEMORY);
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
memset(private, 0, sizeof(*private));
|
||||
|
||||
public = (A_RSA_KEY *) isc_mem_get(mctx, sizeof(A_RSA_KEY));
|
||||
if (public == NULL)
|
||||
DST_RET(DST_R_NOMEMORY);
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
memset(public, 0, sizeof(*public));
|
||||
|
||||
for (i=0; i < priv.nelements; i++) {
|
||||
@ -704,16 +704,16 @@ dst_bsafe_from_file(dst_key_t *key, const isc_uint16_t id, isc_mem_t *mctx) {
|
||||
|
||||
rkey = (RSA_Key *) isc_mem_get(mctx, sizeof(RSA_Key));
|
||||
if (rkey == NULL)
|
||||
DST_RET(DST_R_NOMEMORY);
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
memset(rkey, 0, sizeof(*rkey));
|
||||
if ((status = B_CreateKeyObject(&(rkey->rk_Public_Key))) != 0)
|
||||
DST_RET(DST_R_NOMEMORY);
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
if ((status = B_SetKeyInfo(rkey->rk_Public_Key, KI_RSAPublic,
|
||||
(POINTER) public)) != 0)
|
||||
DST_RET(DST_R_INVALIDPUBLICKEY);
|
||||
|
||||
if ((status = B_CreateKeyObject(&rkey->rk_Private_Key)) != 0)
|
||||
DST_RET(DST_R_NOMEMORY);
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
|
||||
if ((status = B_SetKeyInfo(rkey->rk_Private_Key, KI_PKCS_RSAPrivate,
|
||||
(POINTER) private)) != 0)
|
||||
@ -767,8 +767,8 @@ dst_bsafe_destroy(void *key, isc_mem_t *mctx)
|
||||
* exp the public exponent
|
||||
* mctx memory context to allocate key
|
||||
* Return
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
|
||||
static dst_result_t
|
||||
@ -789,14 +789,14 @@ dst_bsafe_generate(dst_key_t *key, int exp, isc_mem_t *mctx) {
|
||||
|
||||
rsa = (RSA_Key *) isc_mem_get(mctx, sizeof(RSA_Key));
|
||||
if (rsa == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
memset(rsa, 0, sizeof(*rsa));
|
||||
keygenParams.publicExponent.data = NULL;
|
||||
|
||||
#define do_fail(code) {ret = code; goto fail;}
|
||||
if ((status = B_CreateAlgorithmObject(&keypairGenerator)) != 0)
|
||||
do_fail(DST_R_NOMEMORY);
|
||||
do_fail(ISC_R_NOMEMORY);
|
||||
|
||||
keygenParams.modulusBits = key->key_size;
|
||||
|
||||
@ -830,7 +830,7 @@ dst_bsafe_generate(dst_key_t *key, int exp, isc_mem_t *mctx) {
|
||||
keygenParams.publicExponent.data = (unsigned char *) isc_mem_get(mctx,
|
||||
exponent_len);
|
||||
if (keygenParams.publicExponent.data == NULL)
|
||||
do_fail(DST_R_NOMEMORY);
|
||||
do_fail(ISC_R_NOMEMORY);
|
||||
|
||||
memcpy(keygenParams.publicExponent.data, exponent, exponent_len);
|
||||
keygenParams.publicExponent.len = exponent_len;
|
||||
@ -843,34 +843,34 @@ dst_bsafe_generate(dst_key_t *key, int exp, isc_mem_t *mctx) {
|
||||
|
||||
if ((status = B_GenerateInit(keypairGenerator, CHOOSER,
|
||||
NULL_SURRENDER)) != 0)
|
||||
do_fail(DST_R_NOMEMORY);
|
||||
do_fail(ISC_R_NOMEMORY);
|
||||
|
||||
if ((status = B_CreateKeyObject(&public)) != 0)
|
||||
do_fail(DST_R_NOMEMORY);
|
||||
do_fail(ISC_R_NOMEMORY);
|
||||
|
||||
if ((status = B_CreateKeyObject(&private)) != 0)
|
||||
do_fail(DST_R_NOMEMORY);
|
||||
do_fail(ISC_R_NOMEMORY);
|
||||
|
||||
if ((status = B_CreateAlgorithmObject(&randomAlgorithm)) != 0)
|
||||
do_fail(DST_R_NOMEMORY);
|
||||
do_fail(ISC_R_NOMEMORY);
|
||||
|
||||
if ((status = B_SetAlgorithmInfo(randomAlgorithm, AI_MD5Random,
|
||||
NULL_PTR)) != 0)
|
||||
do_fail(DST_R_NOMEMORY);
|
||||
do_fail(ISC_R_NOMEMORY);
|
||||
|
||||
if ((status = B_RandomInit(randomAlgorithm, CHOOSER,
|
||||
NULL_SURRENDER)) != 0)
|
||||
do_fail(DST_R_NOMEMORY);
|
||||
do_fail(ISC_R_NOMEMORY);
|
||||
|
||||
isc_buffer_init(&rand, randomSeed, sizeof(randomSeed),
|
||||
ISC_BUFFERTYPE_BINARY);
|
||||
ret = dst_random_get(sizeof(randomSeed), &rand);
|
||||
if (ret != DST_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
if ((status = B_RandomUpdate(randomAlgorithm, randomSeed,
|
||||
sizeof(randomSeed), NULL_SURRENDER)) != 0)
|
||||
do_fail(DST_R_NOMEMORY);
|
||||
do_fail(ISC_R_NOMEMORY);
|
||||
|
||||
memset(randomSeed, 0, sizeof(randomSeed));
|
||||
|
||||
@ -892,7 +892,7 @@ dst_bsafe_generate(dst_key_t *key, int exp, isc_mem_t *mctx) {
|
||||
2, ISC_BUFFERTYPE_BINARY);
|
||||
isc_buffer_add(&b, 2);
|
||||
key->key_id = isc_buffer_getuint16(&b);
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
fail:
|
||||
if (rsa != NULL) {
|
||||
@ -938,7 +938,7 @@ dst_bsafe_compare(const dst_key_t *key1, const dst_key_t *key2) {
|
||||
rkey2 = (RSA_Key *) key2->opaque;
|
||||
|
||||
if (rkey1 == NULL && rkey2 == NULL)
|
||||
return(ISC_TRUE);
|
||||
return (ISC_TRUE);
|
||||
else if (rkey1 == NULL || rkey2 == NULL)
|
||||
return (ISC_FALSE);
|
||||
|
||||
@ -1048,7 +1048,7 @@ dst_bsafe_md5digest(const unsigned int mode, B_ALGORITHM_OBJ *digest_obj,
|
||||
return (DST_R_SIGNFINALFAILURE);
|
||||
isc_buffer_add(digest, written);
|
||||
}
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -1088,6 +1088,6 @@ T_memset(POINTER output, int value, unsigned int len) {
|
||||
|
||||
POINTER
|
||||
T_realloc(POINTER block, unsigned int len) {
|
||||
return dst_mem_realloc(block, len);
|
||||
return (dst_mem_realloc(block, len));
|
||||
}
|
||||
#endif /* BSAFE || DNSSAFE */
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/*
|
||||
* Principal Author: Brian Wellington
|
||||
* $Id: dst_api.c,v 1.16 1999/10/20 19:08:57 bwelling Exp $
|
||||
* $Id: dst_api.c,v 1.17 1999/10/20 22:14:14 bwelling Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -353,7 +353,7 @@ dst_key_fromfile(const char *name, const isc_uint16_t id, const int alg,
|
||||
}
|
||||
|
||||
if (key == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
/* Fill in private key and some fields in the general key structure */
|
||||
ret = key->func->from_file(key, id, mctx);
|
||||
@ -389,7 +389,7 @@ dst_key_todns(const dst_key_t *key, isc_buffer_t *target) {
|
||||
|
||||
isc_buffer_available(target, &r);
|
||||
if (r.length < 4)
|
||||
return (DST_R_NOSPACE);
|
||||
return (ISC_R_NOSPACE);
|
||||
isc_buffer_putuint16(target, (isc_uint16_t)(key->key_flags & 0xffff));
|
||||
isc_buffer_putuint8(target, (isc_uint8_t)key->key_proto);
|
||||
isc_buffer_putuint8(target, (isc_uint8_t)key->key_alg);
|
||||
@ -397,7 +397,7 @@ dst_key_todns(const dst_key_t *key, isc_buffer_t *target) {
|
||||
if (key->key_flags & DNS_KEYFLAG_EXTENDED) {
|
||||
isc_buffer_available(target, &r);
|
||||
if (r.length < 2)
|
||||
return (DST_R_NOSPACE);
|
||||
return (ISC_R_NOSPACE);
|
||||
isc_buffer_putuint16(target,
|
||||
(isc_uint16_t)((key->key_flags >> 16)
|
||||
& 0xffff));
|
||||
@ -457,7 +457,7 @@ dst_key_fromdns(const char *name, isc_buffer_t *source, isc_mem_t *mctx,
|
||||
|
||||
*keyp = get_key_struct(name, alg, flags, proto, 0, mctx);
|
||||
if (*keyp == NULL)
|
||||
return(DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
ret = (*keyp)->func->from_dns(*keyp, source, mctx);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
@ -500,7 +500,7 @@ dst_key_frombuffer(const char *name, const int alg, const int flags,
|
||||
*keyp = get_key_struct(name, alg, flags, protocol, 0, mctx);
|
||||
|
||||
if (*keyp == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
ret = (*keyp)->func->from_dns((*keyp), source, mctx);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
@ -577,7 +577,7 @@ dst_key_generate(const char *name, const int alg, const int bits,
|
||||
|
||||
*keyp = get_key_struct(name, alg, flags, protocol, bits, mctx);
|
||||
if (*keyp == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
if (bits == 0) { /* NULL KEY */
|
||||
(*keyp)->key_flags |= DNS_KEYTYPE_NOKEY;
|
||||
@ -674,37 +674,37 @@ dst_key_free(dst_key_t *key) {
|
||||
char *
|
||||
dst_key_name(const dst_key_t *key) {
|
||||
REQUIRE(VALID_KEY(key));
|
||||
return key->key_name;
|
||||
return (key->key_name);
|
||||
}
|
||||
|
||||
int
|
||||
dst_key_size(const dst_key_t *key) {
|
||||
REQUIRE(VALID_KEY(key));
|
||||
return key->key_size;
|
||||
return (key->key_size);
|
||||
}
|
||||
|
||||
int
|
||||
dst_key_proto(const dst_key_t *key) {
|
||||
REQUIRE(VALID_KEY(key));
|
||||
return key->key_proto;
|
||||
return (key->key_proto);
|
||||
}
|
||||
|
||||
int
|
||||
dst_key_alg(const dst_key_t *key) {
|
||||
REQUIRE(VALID_KEY(key));
|
||||
return key->key_alg;
|
||||
return (key->key_alg);
|
||||
}
|
||||
|
||||
isc_uint32_t
|
||||
dst_key_flags(const dst_key_t *key) {
|
||||
REQUIRE(VALID_KEY(key));
|
||||
return key->key_flags;
|
||||
return (key->key_flags);
|
||||
}
|
||||
|
||||
isc_uint16_t
|
||||
dst_key_id(const dst_key_t *key) {
|
||||
REQUIRE(VALID_KEY(key));
|
||||
return key->key_id;
|
||||
return (key->key_id);
|
||||
}
|
||||
|
||||
isc_boolean_t
|
||||
@ -793,7 +793,7 @@ dst_random_get(const unsigned int wanted, isc_buffer_t *target) {
|
||||
|
||||
isc_buffer_available(target, &r);
|
||||
if (r.length < wanted)
|
||||
return (DST_R_NOSPACE);
|
||||
return (ISC_R_NOSPACE);
|
||||
|
||||
RUNTIME_CHECK(isc_mutex_lock((&random_lock)) == ISC_R_SUCCESS);
|
||||
RAND_bytes(r.base, wanted);
|
||||
@ -913,7 +913,7 @@ read_public_key(const char *name, const isc_uint16_t id, int alg,
|
||||
/* 1500 should be large enough for any key */
|
||||
ret = isc_lex_create(mctx, 1500, &lex);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
ret = isc_lex_openfile(lex, filename);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
@ -1065,5 +1065,5 @@ dst_mem_realloc(void *ptr, size_t size) {
|
||||
}
|
||||
if (ptr != NULL)
|
||||
dst_mem_free(ptr);
|
||||
return(p);
|
||||
return (p);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/*
|
||||
* Principal Author: Brian Wellington
|
||||
* $Id: dst_parse.c,v 1.8 1999/10/08 22:25:14 tale Exp $
|
||||
* $Id: dst_parse.c,v 1.9 1999/10/20 22:14:14 bwelling Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -218,7 +218,7 @@ dst_s_parse_private_key_file(const char *name, const int alg,
|
||||
|
||||
iret = isc_lex_create(mctx, 1024, &lex);
|
||||
if (iret != ISC_R_SUCCESS)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
iret = isc_lex_openfile(lex, filename);
|
||||
if (iret != ISC_R_SUCCESS)
|
||||
@ -312,7 +312,7 @@ dst_s_parse_private_key_file(const char *name, const int alg,
|
||||
isc_lex_close(lex);
|
||||
isc_lex_destroy(&lex);
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
fail:
|
||||
if (lex != NULL) {
|
||||
@ -377,7 +377,7 @@ dst_s_write_private_key_file(const char *name, const int alg,
|
||||
iret = isc_base64_totext(&r, sizeof(buffer), "", &b);
|
||||
if (iret != ISC_R_SUCCESS) {
|
||||
fclose(fp);
|
||||
return(DST_R_INVALIDPRIVATEKEY);
|
||||
return (DST_R_INVALIDPRIVATEKEY);
|
||||
}
|
||||
isc_buffer_used(&b, &r);
|
||||
|
||||
@ -387,5 +387,5 @@ dst_s_write_private_key_file(const char *name, const int alg,
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/*
|
||||
* Principal Author: Brian Wellington
|
||||
* $Id: hmac_link.c,v 1.11 1999/10/20 19:08:57 bwelling Exp $
|
||||
* $Id: hmac_link.c,v 1.12 1999/10/20 22:14:14 bwelling Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -119,8 +119,8 @@ dst_s_hmacmd5_init()
|
||||
* signature buffer to store signature
|
||||
* mctx memory context for temporary allocations
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_hmacmd5_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
@ -160,7 +160,7 @@ dst_hmacmd5_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
RETERR(dst_s_md5(DST_SIGMODE_FINAL, context, NULL, sig, mctx));
|
||||
}
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -178,8 +178,8 @@ dst_hmacmd5_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
* signature signature
|
||||
* mctx memory context for temporary allocations
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_hmacmd5_verify(const unsigned int mode, dst_key_t *key, void **context,
|
||||
@ -223,7 +223,7 @@ dst_hmacmd5_verify(const unsigned int mode, dst_key_t *key, void **context,
|
||||
return (DST_R_VERIFYFINALFAILURE);
|
||||
}
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -249,8 +249,8 @@ dst_hmacmd5_isprivate(const dst_key_t *key) {
|
||||
* key DST KEY structure
|
||||
* data output data
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
|
||||
static dst_result_t
|
||||
@ -267,14 +267,14 @@ dst_hmacmd5_to_dns(const dst_key_t *key, isc_buffer_t *data) {
|
||||
|
||||
bytes = (key->key_size + 7) / 8;
|
||||
if (r.length < bytes)
|
||||
return (DST_R_NOSPACE);
|
||||
return (ISC_R_NOSPACE);
|
||||
|
||||
for (i = 0; i < bytes; i++)
|
||||
*r.base++ = hkey->ipad[i] ^ HMAC_IPAD;
|
||||
|
||||
isc_buffer_add(data, bytes);
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -285,8 +285,8 @@ dst_hmacmd5_to_dns(const dst_key_t *key, isc_buffer_t *data) {
|
||||
* key Partially filled key structure
|
||||
* data Buffer containing key in DNS format
|
||||
* Return
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_hmacmd5_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
@ -296,11 +296,11 @@ dst_hmacmd5_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
|
||||
isc_buffer_remaining(data, &r);
|
||||
if (r.length == 0)
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
hkey = (HMAC_Key *) isc_mem_get(mctx, sizeof(HMAC_Key));
|
||||
if (hkey == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
memset(hkey->ipad, 0, sizeof(hkey->ipad));
|
||||
memset(hkey->opad, 0, sizeof(hkey->opad));
|
||||
@ -330,7 +330,7 @@ dst_hmacmd5_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
key->key_size = keylen * 8;
|
||||
key->opaque = hkey;
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -340,8 +340,8 @@ dst_hmacmd5_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
* Parameters
|
||||
* key DST KEY structure
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_hmacmd5_to_file(const dst_key_t *key) {
|
||||
@ -375,8 +375,8 @@ dst_hmacmd5_to_file(const dst_key_t *key) {
|
||||
* id The key id
|
||||
* path The directory that the file will be read from
|
||||
* Return
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
|
||||
static dst_result_t
|
||||
@ -390,21 +390,21 @@ dst_hmacmd5_from_file(dst_key_t *key, const isc_uint16_t id, isc_mem_t *mctx) {
|
||||
/* read private key file */
|
||||
ret = dst_s_parse_private_key_file(key->key_name, key->key_alg,
|
||||
id, &priv, mctx);
|
||||
if (ret != DST_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
return (ret);
|
||||
|
||||
hkey = (HMAC_Key *) isc_mem_get(mctx, sizeof(HMAC_Key *));
|
||||
if (hkey == NULL)
|
||||
DST_RET(DST_R_NOMEMORY);
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
|
||||
key->opaque = hkey;
|
||||
isc_buffer_init(&b, priv.elements[0].data, priv.elements[0].length,
|
||||
ISC_BUFFERTYPE_BINARY);
|
||||
ret = dst_hmacmd5_from_dns(key, &b, mctx);
|
||||
if (ret != DST_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
DST_RET(ret);
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
err:
|
||||
dst_hmacmd5_destroy(hkey, mctx);
|
||||
@ -434,8 +434,8 @@ dst_hmacmd5_destroy(void *key, isc_mem_t *mctx) {
|
||||
* unused algorithm specific data, unused for HMAC-MD5.
|
||||
* mctx memory context to allocate key
|
||||
* Return
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
|
||||
static dst_result_t
|
||||
@ -456,13 +456,13 @@ dst_hmacmd5_generate(dst_key_t *key, int unused, isc_mem_t *mctx) {
|
||||
memset(data, 0, HMAC_LEN);
|
||||
isc_buffer_init(&b, data, sizeof(data), ISC_BUFFERTYPE_BINARY);
|
||||
ret = dst_random_get(bytes, &b);
|
||||
if (ret != DST_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
return (ret);
|
||||
|
||||
ret = dst_hmacmd5_from_dns(key, &b, mctx);
|
||||
memset(data, 0, HMAC_LEN);
|
||||
|
||||
return ret;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
@ -481,7 +481,7 @@ dst_hmacmd5_compare(const dst_key_t *key1, const dst_key_t *key2) {
|
||||
hkey2 = (HMAC_Key *) key2->opaque;
|
||||
|
||||
if (hkey1 == NULL && hkey2 == NULL)
|
||||
return(ISC_TRUE);
|
||||
return (ISC_TRUE);
|
||||
else if (hkey1 == NULL || hkey2 == NULL)
|
||||
return (ISC_FALSE);
|
||||
|
||||
|
@ -9,10 +9,6 @@ ISC_LANG_BEGINDECLS
|
||||
|
||||
typedef unsigned int dst_result_t;
|
||||
|
||||
#define DST_R_SUCCESS ISC_R_SUCCESS
|
||||
#define DST_R_NOMEMORY ISC_R_NOMEMORY
|
||||
#define DST_R_NOSPACE ISC_R_NOSPACE
|
||||
|
||||
#define DST_R_UNSUPPORTEDALG (ISC_RESULTCLASS_DST + 0)
|
||||
#define DST_R_UNSUPPORTEDTYPE (ISC_RESULTCLASS_DST + 1)
|
||||
#define DST_R_UNSUPPORTEDMODE (ISC_RESULTCLASS_DST + 2)
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
/*
|
||||
* Principal Author: Brian Wellington
|
||||
* $Id: openssl_link.c,v 1.10 1999/10/20 19:08:57 bwelling Exp $
|
||||
* $Id: openssl_link.c,v 1.11 1999/10/20 22:14:14 bwelling Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -110,8 +110,8 @@ dst_s_openssldsa_init() {
|
||||
* signature buffer to store signature
|
||||
* mctx memory context for temporary allocations
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_openssl_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
@ -123,7 +123,7 @@ dst_openssl_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
if (mode & DST_SIGMODE_INIT) {
|
||||
ctx = (SHA_CTX *) isc_mem_get(mctx, sizeof(SHA_CTX));
|
||||
if (ctx == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
else if (context != NULL)
|
||||
ctx = (SHA_CTX *) *context;
|
||||
@ -142,7 +142,7 @@ dst_openssl_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
|
||||
isc_buffer_available(sig, &r);
|
||||
if (r.length < SHA_DIGEST_LENGTH * 2 + 1)
|
||||
return DST_R_NOSPACE;
|
||||
return (ISC_R_NOSPACE);
|
||||
|
||||
dsa = key->opaque;
|
||||
|
||||
@ -164,7 +164,7 @@ dst_openssl_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
else
|
||||
*context = ctx;
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -182,8 +182,8 @@ dst_openssl_sign(const unsigned int mode, dst_key_t *key, void **context,
|
||||
* signature signature
|
||||
* mctx memory context for temporary allocations
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_openssl_verify(const unsigned int mode, dst_key_t *key, void **context,
|
||||
@ -195,7 +195,7 @@ dst_openssl_verify(const unsigned int mode, dst_key_t *key, void **context,
|
||||
if (mode & DST_SIGMODE_INIT) {
|
||||
ctx = (SHA_CTX *) isc_mem_get(mctx, sizeof(SHA_CTX));
|
||||
if (ctx == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
else if (context != NULL)
|
||||
ctx = (SHA_CTX *) *context;
|
||||
@ -236,7 +236,7 @@ dst_openssl_verify(const unsigned int mode, dst_key_t *key, void **context,
|
||||
else
|
||||
*context = ctx;
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -263,8 +263,8 @@ dst_openssl_isprivate(const dst_key_t *key) {
|
||||
* key DST KEY structure
|
||||
* data output data
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
|
||||
static dst_result_t
|
||||
@ -286,7 +286,7 @@ dst_openssl_to_dns(const dst_key_t *key, isc_buffer_t *data) {
|
||||
|
||||
dnslen = 1 + (key->key_size * 3)/8 + SHA_DIGEST_LENGTH;
|
||||
if (r.length < (unsigned int) dnslen)
|
||||
return (DST_R_NOSPACE);
|
||||
return (ISC_R_NOSPACE);
|
||||
|
||||
*r.base++ = t;
|
||||
BN_bn2bin_fixed(dsa->q, r.base, SHA_DIGEST_LENGTH);
|
||||
@ -300,7 +300,7 @@ dst_openssl_to_dns(const dst_key_t *key, isc_buffer_t *data) {
|
||||
|
||||
isc_buffer_add(data, dnslen);
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -311,8 +311,8 @@ dst_openssl_to_dns(const dst_key_t *key, isc_buffer_t *data) {
|
||||
* key Partially filled key structure
|
||||
* data Buffer containing key in DNS format
|
||||
* Return
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_openssl_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
@ -324,12 +324,12 @@ dst_openssl_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
|
||||
isc_buffer_remaining(data, &r);
|
||||
if (r.length == 0)
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
dsa = DSA_new();
|
||||
/* dsa = (DSA *) isc_mem_get(mctx, sizeof(DSA));*/
|
||||
if (dsa == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
memset(dsa, 0, sizeof(DSA));
|
||||
|
||||
@ -366,7 +366,7 @@ dst_openssl_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
|
||||
key->opaque = (void *) dsa;
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -376,8 +376,8 @@ dst_openssl_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
* Parameters
|
||||
* key DST KEY structure
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_openssl_to_file(const dst_key_t *key) {
|
||||
@ -435,8 +435,8 @@ dst_openssl_to_file(const dst_key_t *key) {
|
||||
* id The key id
|
||||
* path The directory that the file will be read from
|
||||
* Return
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
|
||||
static dst_result_t
|
||||
@ -453,12 +453,12 @@ dst_openssl_from_file(dst_key_t *key, const isc_uint16_t id, isc_mem_t *mctx) {
|
||||
/* read private key file */
|
||||
ret = dst_s_parse_private_key_file(key->key_name, key->key_alg,
|
||||
id, &priv, mctx);
|
||||
if (ret != DST_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
return (ret);
|
||||
|
||||
dsa = DSA_new();
|
||||
if (dsa == NULL)
|
||||
DST_RET(DST_R_NOMEMORY);
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
memset(dsa, 0, sizeof(DSA));
|
||||
key->opaque = dsa;
|
||||
|
||||
@ -467,7 +467,7 @@ dst_openssl_from_file(dst_key_t *key, const isc_uint16_t id, isc_mem_t *mctx) {
|
||||
bn = BN_bin2bn(priv.elements[i].data,
|
||||
priv.elements[i].length, NULL);
|
||||
if (bn == NULL)
|
||||
DST_RET(DST_R_NOMEMORY);
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
|
||||
switch (priv.elements[i].tag) {
|
||||
case TAG_DSA_PRIME:
|
||||
@ -493,7 +493,7 @@ dst_openssl_from_file(dst_key_t *key, const isc_uint16_t id, isc_mem_t *mctx) {
|
||||
isc_buffer_init(&dns, dns_array, sizeof(dns_array),
|
||||
ISC_BUFFERTYPE_BINARY);
|
||||
ret = dst_openssl_to_dns(key, &dns);
|
||||
if (ret != DST_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
DST_RET(ret);
|
||||
isc_buffer_used(&dns, &r);
|
||||
key->key_id = dst_s_id_calc(r.base, r.length);
|
||||
@ -501,7 +501,7 @@ dst_openssl_from_file(dst_key_t *key, const isc_uint16_t id, isc_mem_t *mctx) {
|
||||
if (key->key_id != id)
|
||||
DST_RET(DST_R_INVALIDPRIVATEKEY);
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
err:
|
||||
key->opaque = NULL;
|
||||
@ -535,8 +535,8 @@ dst_openssl_destroy(void *key, isc_mem_t *mctx) {
|
||||
* unused algorithm specific data, unused for DSA.
|
||||
* mctx memory context to allocate key
|
||||
* Return
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
|
||||
static dst_result_t
|
||||
@ -554,7 +554,7 @@ dst_openssl_generate(dst_key_t *key, int unused, isc_mem_t *mctx) {
|
||||
isc_buffer_init(&rand, rand_array, sizeof(rand_array),
|
||||
ISC_BUFFERTYPE_BINARY);
|
||||
ret = dst_random_get(SHA_DIGEST_LENGTH, &rand);
|
||||
if (ret != DST_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
return (ret);
|
||||
|
||||
dsa = DSA_generate_parameters(key->key_size, rand_array,
|
||||
@ -562,10 +562,10 @@ dst_openssl_generate(dst_key_t *key, int unused, isc_mem_t *mctx) {
|
||||
NULL, NULL);
|
||||
|
||||
if (dsa == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
if (DSA_generate_key(dsa) == 0)
|
||||
return(DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
key->opaque = dsa;
|
||||
|
||||
@ -575,7 +575,7 @@ dst_openssl_generate(dst_key_t *key, int unused, isc_mem_t *mctx) {
|
||||
isc_buffer_used(&dns, &r);
|
||||
key->key_id = dst_s_id_calc(r.base, r.length);
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -595,7 +595,7 @@ dst_openssl_compare(const dst_key_t *key1, const dst_key_t *key2) {
|
||||
dsa2 = (DSA *) key2->opaque;
|
||||
|
||||
if (dsa1 == NULL && dsa2 == NULL)
|
||||
return(ISC_TRUE);
|
||||
return (ISC_TRUE);
|
||||
else if (dsa1 == NULL || dsa2 == NULL)
|
||||
return (ISC_FALSE);
|
||||
|
||||
@ -622,7 +622,7 @@ BN_bn2bin_fixed(BIGNUM *bn, unsigned char *buf, int size) {
|
||||
while (bytes-- > 0)
|
||||
*buf++ = 0;
|
||||
BN_bn2bin(bn, buf);
|
||||
return size;
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
/*
|
||||
* Principal Author: Brian Wellington
|
||||
* $Id: openssldh_link.c,v 1.3 1999/10/08 13:08:57 bwelling Exp $
|
||||
* $Id: openssldh_link.c,v 1.4 1999/10/20 22:14:14 bwelling Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -115,8 +115,8 @@ dst_s_openssldh_init()
|
||||
* priv The private key
|
||||
* secret A buffer into which the secret is written
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_openssldh_computesecret(const dst_key_t *pub, const dst_key_t *priv,
|
||||
@ -136,12 +136,12 @@ dst_openssldh_computesecret(const dst_key_t *pub, const dst_key_t *priv,
|
||||
len = DH_size(dhpriv);
|
||||
isc_buffer_available(secret, &r);
|
||||
if (r.length < len)
|
||||
return (DST_R_NOSPACE);
|
||||
return (ISC_R_NOSPACE);
|
||||
ret = DH_compute_key(r.base, dhpub->pub_key, dhpriv);
|
||||
if (ret == 0)
|
||||
return(DST_R_COMPUTESECRETFAILURE);
|
||||
return (DST_R_COMPUTESECRETFAILURE);
|
||||
isc_buffer_add(secret, len);
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -167,8 +167,8 @@ dst_openssldh_isprivate(const dst_key_t *key) {
|
||||
* key DST KEY structure
|
||||
* data output data
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
|
||||
static dst_result_t
|
||||
@ -194,7 +194,7 @@ dst_openssldh_to_dns(const dst_key_t *key, isc_buffer_t *data) {
|
||||
publen = BN_num_bytes(dh->pub_key);
|
||||
dnslen = plen + glen + publen + 6;
|
||||
if (r.length < (unsigned int) dnslen)
|
||||
return (DST_R_NOSPACE);
|
||||
return (ISC_R_NOSPACE);
|
||||
|
||||
uint16_toregion(plen, &r);
|
||||
if (plen == 1) {
|
||||
@ -218,7 +218,7 @@ dst_openssldh_to_dns(const dst_key_t *key, isc_buffer_t *data) {
|
||||
|
||||
isc_buffer_add(data, dnslen);
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -229,8 +229,8 @@ dst_openssldh_to_dns(const dst_key_t *key, isc_buffer_t *data) {
|
||||
* key Partially filled key structure
|
||||
* data Buffer containing key in DNS format
|
||||
* Return
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_openssldh_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
@ -243,11 +243,11 @@ dst_openssldh_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
|
||||
isc_buffer_remaining(data, &r);
|
||||
if (r.length == 0)
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
dh = DH_new();
|
||||
if (dh == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
memset(dh, 0, sizeof(DH));
|
||||
|
||||
@ -348,7 +348,7 @@ dst_openssldh_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
|
||||
key->opaque = (void *) dh;
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -358,8 +358,8 @@ dst_openssldh_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx) {
|
||||
* Parameters
|
||||
* key DST KEY structure
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
static dst_result_t
|
||||
dst_openssldh_to_file(const dst_key_t *key) {
|
||||
@ -411,8 +411,8 @@ dst_openssldh_to_file(const dst_key_t *key) {
|
||||
* id The key id
|
||||
* path The directory that the file will be read from
|
||||
* Return
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
|
||||
static dst_result_t
|
||||
@ -429,12 +429,12 @@ dst_openssldh_from_file(dst_key_t *key, const isc_uint16_t id, isc_mem_t *mctx)
|
||||
/* read private key file */
|
||||
ret = dst_s_parse_private_key_file(key->key_name, key->key_alg,
|
||||
id, &priv, mctx);
|
||||
if (ret != DST_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
return (ret);
|
||||
|
||||
dh = DH_new();
|
||||
if (dh == NULL)
|
||||
DST_RET(DST_R_NOMEMORY);
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
memset(dh, 0, sizeof(DH));
|
||||
key->opaque = dh;
|
||||
|
||||
@ -443,7 +443,7 @@ dst_openssldh_from_file(dst_key_t *key, const isc_uint16_t id, isc_mem_t *mctx)
|
||||
bn = BN_bin2bn(priv.elements[i].data,
|
||||
priv.elements[i].length, NULL);
|
||||
if (bn == NULL)
|
||||
DST_RET(DST_R_NOMEMORY);
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
|
||||
switch (priv.elements[i].tag) {
|
||||
case TAG_DH_PRIME:
|
||||
@ -483,7 +483,7 @@ dst_openssldh_from_file(dst_key_t *key, const isc_uint16_t id, isc_mem_t *mctx)
|
||||
isc_buffer_init(&dns, dns_array, sizeof(dns_array),
|
||||
ISC_BUFFERTYPE_BINARY);
|
||||
ret = dst_openssldh_to_dns(key, &dns);
|
||||
if (ret != DST_R_SUCCESS)
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
DST_RET(ret);
|
||||
isc_buffer_used(&dns, &r);
|
||||
key->key_id = dst_s_id_calc(r.base, r.length);
|
||||
@ -491,7 +491,7 @@ dst_openssldh_from_file(dst_key_t *key, const isc_uint16_t id, isc_mem_t *mctx)
|
||||
if (key->key_id != id)
|
||||
DST_RET(DST_R_INVALIDPRIVATEKEY);
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
err:
|
||||
key->opaque = NULL;
|
||||
@ -529,8 +529,8 @@ dst_openssldh_destroy(void *key, isc_mem_t *mctx) {
|
||||
* generator generator
|
||||
* mctx memory context to allocate key
|
||||
* Return
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
|
||||
static dst_result_t
|
||||
@ -546,7 +546,7 @@ dst_openssldh_generate(dst_key_t *key, int generator, isc_mem_t *mctx) {
|
||||
if (key->key_size == 768 || key->key_size == 1024) {
|
||||
dh = DH_new();
|
||||
if (dh == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
if (key->key_size == 768)
|
||||
dh->p = bn768;
|
||||
else
|
||||
@ -566,7 +566,7 @@ dst_openssldh_generate(dst_key_t *key, int generator, isc_mem_t *mctx) {
|
||||
|
||||
if (DH_generate_key(dh) == 0) {
|
||||
DH_free(dh);
|
||||
return(DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
|
||||
key->opaque = dh;
|
||||
@ -577,7 +577,7 @@ dst_openssldh_generate(dst_key_t *key, int generator, isc_mem_t *mctx) {
|
||||
isc_buffer_used(&dns, &r);
|
||||
key->key_id = dst_s_id_calc(r.base, r.length);
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -597,7 +597,7 @@ dst_openssldh_compare(const dst_key_t *key1, const dst_key_t *key2) {
|
||||
dh2 = (DH *) key2->opaque;
|
||||
|
||||
if (dh1 == NULL && dh2 == NULL)
|
||||
return(ISC_TRUE);
|
||||
return (ISC_TRUE);
|
||||
else if (dh1 == NULL || dh2 == NULL)
|
||||
return (ISC_FALSE);
|
||||
|
||||
@ -633,7 +633,7 @@ dst_openssldh_paramcompare(const dst_key_t *key1, const dst_key_t *key2) {
|
||||
dh2 = (DH *) key2->opaque;
|
||||
|
||||
if (dh1 == NULL && dh2 == NULL)
|
||||
return(ISC_TRUE);
|
||||
return (ISC_TRUE);
|
||||
else if (dh1 == NULL || dh2 == NULL)
|
||||
return (ISC_FALSE);
|
||||
|
||||
@ -660,7 +660,7 @@ uint16_fromregion(isc_region_t *region) {
|
||||
val |= ((unsigned int)(cp[1]));
|
||||
|
||||
region->base += 2;
|
||||
return val;
|
||||
return (val);
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
/*
|
||||
* Principal Author: Brian Wellington
|
||||
* $Id: opensslmd5_link.c,v 1.1 1999/10/18 21:35:46 bwelling Exp $
|
||||
* $Id: opensslmd5_link.c,v 1.2 1999/10/20 22:14:15 bwelling Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -59,8 +59,8 @@
|
||||
* digest buffer to store digest
|
||||
* mctx memory context for temporary allocations
|
||||
* Returns
|
||||
* DST_R_SUCCESS Success
|
||||
* !DST_R_SUCCESS Failure
|
||||
* ISC_R_SUCCESS Success
|
||||
* !ISC_R_SUCCESS Failure
|
||||
*/
|
||||
dst_result_t
|
||||
dst_s_md5(const unsigned int mode, void **context, isc_region_t *data,
|
||||
@ -72,7 +72,7 @@ dst_s_md5(const unsigned int mode, void **context, isc_region_t *data,
|
||||
if (mode & DST_SIGMODE_INIT) {
|
||||
ctx = (MD5_CTX *) isc_mem_get(mctx, sizeof(MD5_CTX));
|
||||
if (ctx == NULL)
|
||||
return (DST_R_NOMEMORY);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
else if (context != NULL)
|
||||
ctx = (MD5_CTX *) *context;
|
||||
@ -87,7 +87,7 @@ dst_s_md5(const unsigned int mode, void **context, isc_region_t *data,
|
||||
if (mode & DST_SIGMODE_FINAL) {
|
||||
isc_buffer_available(digest, &r);
|
||||
if (r.length < MD5_DIGEST_LENGTH)
|
||||
return DST_R_NOSPACE;
|
||||
return (ISC_R_NOSPACE);
|
||||
|
||||
MD5Final(r.base, ctx);
|
||||
isc_buffer_add(digest, MD5_DIGEST_LENGTH);
|
||||
@ -96,7 +96,7 @@ dst_s_md5(const unsigned int mode, void **context, isc_region_t *data,
|
||||
else
|
||||
*context = ctx;
|
||||
|
||||
return (DST_R_SUCCESS);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user