mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-05 00:55:24 +00:00
dst_sig_size changes
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
/*
|
||||
* Principal Author: Brian Wellington
|
||||
* $Id: dst_api.c,v 1.18 1999/10/25 21:04:53 bwelling Exp $
|
||||
* $Id: dst_api.c,v 1.19 1999/10/26 19:31:52 bwelling Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@@ -718,30 +718,36 @@ dst_key_isprivate(const dst_key_t *key) {
|
||||
* Computes the maximum size of a signature generated by the given key
|
||||
* Parameters
|
||||
* key The DST key
|
||||
* n Stores the number of bytes necessary to hold a signature
|
||||
* with the key.
|
||||
* Returns
|
||||
* n The number of bytes necessary to hold a signature with the key.
|
||||
* ISC_R_SUCCESS
|
||||
* DST_R_UNSUPPORTEDALG
|
||||
*/
|
||||
int
|
||||
dst_sig_size(const dst_key_t *key) {
|
||||
isc_result_t
|
||||
dst_sig_size(const dst_key_t *key, unsigned int *n) {
|
||||
RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS);
|
||||
REQUIRE(VALID_KEY(key));
|
||||
REQUIRE(dst_supported_algorithm(key->key_alg) == ISC_TRUE);
|
||||
REQUIRE(n != NULL);
|
||||
|
||||
switch (key->key_alg) {
|
||||
case DST_ALG_RSA:
|
||||
return (key->key_size + 7) / 8;
|
||||
*n = (key->key_size + 7) / 8;
|
||||
break;
|
||||
case DST_ALG_DSA:
|
||||
return (DNS_SIG_DSASIGSIZE);
|
||||
*n = DNS_SIG_DSASIGSIZE;
|
||||
break;
|
||||
case DST_ALG_HMACMD5:
|
||||
return (16);
|
||||
*n = 16;
|
||||
break;
|
||||
case DST_ALG_HMACSHA1:
|
||||
return (20);
|
||||
*n = 20;
|
||||
break;
|
||||
case DST_ALG_DH:
|
||||
return (-1);
|
||||
default:
|
||||
REQUIRE(ISC_FALSE);
|
||||
return (-1);
|
||||
return (DST_R_UNSUPPORTEDALG);
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -749,27 +755,30 @@ dst_sig_size(const dst_key_t *key) {
|
||||
* Computes the maximum size of a shared secret generated by the given key
|
||||
* Parameters
|
||||
* key The DST key
|
||||
* n Stores the number of bytes necessary to hold a shared secret
|
||||
* generated by the key.
|
||||
* Returns
|
||||
* n The number of bytes necessary to hold the shared secret
|
||||
* ISC_R_SUCCESS
|
||||
* DST_R_UNSUPPORTEDALG
|
||||
*/
|
||||
int
|
||||
dst_secret_size(const dst_key_t *key) {
|
||||
isc_result_t
|
||||
dst_secret_size(const dst_key_t *key, unsigned int *n) {
|
||||
RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS);
|
||||
REQUIRE(VALID_KEY(key));
|
||||
REQUIRE(dst_supported_algorithm(key->key_alg) == ISC_TRUE);
|
||||
REQUIRE(n != NULL);
|
||||
|
||||
switch (key->key_alg) {
|
||||
case DST_ALG_DH:
|
||||
*n = (key->key_size + 7) / 8;
|
||||
break;
|
||||
case DST_ALG_RSA:
|
||||
case DST_ALG_DSA:
|
||||
case DST_ALG_HMACMD5:
|
||||
case DST_ALG_HMACSHA1:
|
||||
return (-1);
|
||||
case DST_ALG_DH:
|
||||
return (key->key_size + 7) / 8;
|
||||
default:
|
||||
REQUIRE(ISC_FALSE);
|
||||
return (-1);
|
||||
return (DST_R_UNSUPPORTEDALG);
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user