mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
Pass key length to raw_key_to_ossl() by value
As raw_key_to_ossl() no longer stores anything at the pointer passed to it in the 'key_len' parameter, change the type of the latter to size_t.
This commit is contained in:
committed by
Mark Andrews
parent
a482a6b204
commit
a9ab2bf60b
@@ -58,7 +58,7 @@
|
|||||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
raw_key_to_ossl(unsigned int key_alg, int private, const unsigned char *key,
|
raw_key_to_ossl(unsigned int key_alg, int private, const unsigned char *key,
|
||||||
size_t *key_len, EVP_PKEY **pkey) {
|
size_t key_len, EVP_PKEY **pkey) {
|
||||||
isc_result_t ret;
|
isc_result_t ret;
|
||||||
int status;
|
int status;
|
||||||
const char *groupname;
|
const char *groupname;
|
||||||
@@ -90,7 +90,7 @@ raw_key_to_ossl(unsigned int key_alg, int private, const unsigned char *key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (private) {
|
if (private) {
|
||||||
priv = BN_bin2bn(key, *key_len, NULL);
|
priv = BN_bin2bn(key, key_len, NULL);
|
||||||
if (priv == NULL) {
|
if (priv == NULL) {
|
||||||
DST_RET(dst__openssl_toresult2("BN_bin2bn",
|
DST_RET(dst__openssl_toresult2("BN_bin2bn",
|
||||||
DST_R_OPENSSLFAILURE));
|
DST_R_OPENSSLFAILURE));
|
||||||
@@ -103,12 +103,12 @@ raw_key_to_ossl(unsigned int key_alg, int private, const unsigned char *key,
|
|||||||
DST_R_OPENSSLFAILURE));
|
DST_R_OPENSSLFAILURE));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
INSIST(*key_len < sizeof(buf));
|
INSIST(key_len < sizeof(buf));
|
||||||
buf[0] = POINT_CONVERSION_UNCOMPRESSED;
|
buf[0] = POINT_CONVERSION_UNCOMPRESSED;
|
||||||
memmove(buf + 1, key, *key_len);
|
memmove(buf + 1, key, key_len);
|
||||||
|
|
||||||
status = OSSL_PARAM_BLD_push_octet_string(
|
status = OSSL_PARAM_BLD_push_octet_string(
|
||||||
bld, OSSL_PKEY_PARAM_PUB_KEY, buf, 1 + *key_len);
|
bld, OSSL_PKEY_PARAM_PUB_KEY, buf, 1 + key_len);
|
||||||
if (status != 1) {
|
if (status != 1) {
|
||||||
DST_RET(dst__openssl_toresult2("OSSL_PARAM_BLD_push_"
|
DST_RET(dst__openssl_toresult2("OSSL_PARAM_BLD_push_"
|
||||||
"octet_string",
|
"octet_string",
|
||||||
@@ -789,7 +789,7 @@ opensslecdsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
len = r.length;
|
len = r.length;
|
||||||
ret = raw_key_to_ossl(key->key_alg, 0, r.base, &len, &pkey);
|
ret = raw_key_to_ossl(key->key_alg, 0, r.base, len, &pkey);
|
||||||
if (ret != ISC_R_SUCCESS) {
|
if (ret != ISC_R_SUCCESS) {
|
||||||
DST_RET(ret);
|
DST_RET(ret);
|
||||||
}
|
}
|
||||||
@@ -1249,7 +1249,7 @@ opensslecdsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
|||||||
|
|
||||||
ret = raw_key_to_ossl(key->key_alg, 1,
|
ret = raw_key_to_ossl(key->key_alg, 1,
|
||||||
priv.elements[privkey_index].data,
|
priv.elements[privkey_index].data,
|
||||||
&priv.elements[privkey_index].length,
|
priv.elements[privkey_index].length,
|
||||||
&key->keydata.pkey);
|
&key->keydata.pkey);
|
||||||
#endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */
|
#endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user