[v9_8] fix md5 key id computation
3630. [bug] Ensure correct ID computation for MD5 keys. [RT #33033] (cherry picked from commit5d4343a998) (cherry picked from commit70858bf974)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
3630. [bug] Ensure correct ID computation for MD5 keys. [RT #33033]
|
||||
|
||||
3627. [bug] RPZ changes were not effective on slaves. [RT #34450]
|
||||
|
||||
3625. [bug] Don't send notify messages to machines outside of the
|
||||
|
||||
@@ -173,6 +173,15 @@ fromwire_dnskey(ARGS_FROMWIRE) {
|
||||
dns_name_init(&name, NULL);
|
||||
RETERR(dns_name_fromwire(&name, source, dctx, options, target));
|
||||
}
|
||||
|
||||
/*
|
||||
* RSAMD5 computes key ID differently from other
|
||||
* algorithms: we need to ensure there's enough data
|
||||
* present for the computation
|
||||
*/
|
||||
if (algorithm == DST_ALG_RSAMD5 && sr.length < 3)
|
||||
return (ISC_R_UNEXPECTEDEND);
|
||||
|
||||
isc_buffer_activeregion(source, &sr);
|
||||
isc_buffer_forward(source, sr.length);
|
||||
return (mem_tobuffer(target, sr.base, sr.length));
|
||||
|
||||
@@ -173,6 +173,15 @@ fromwire_key(ARGS_FROMWIRE) {
|
||||
dns_name_init(&name, NULL);
|
||||
RETERR(dns_name_fromwire(&name, source, dctx, options, target));
|
||||
}
|
||||
|
||||
/*
|
||||
* RSAMD5 computes key ID differently from other
|
||||
* algorithms: we need to ensure there's enough data
|
||||
* present for the computation
|
||||
*/
|
||||
if (algorithm == DST_ALG_RSAMD5 && sr.length < 3)
|
||||
return (ISC_R_UNEXPECTEDEND);
|
||||
|
||||
isc_buffer_activeregion(source, &sr);
|
||||
isc_buffer_forward(source, sr.length);
|
||||
return (mem_tobuffer(target, sr.base, sr.length));
|
||||
|
||||
@@ -167,6 +167,7 @@ totext_keydata(ARGS_TOTEXT) {
|
||||
static inline isc_result_t
|
||||
fromwire_keydata(ARGS_FROMWIRE) {
|
||||
isc_region_t sr;
|
||||
unsigned char algorithm;
|
||||
|
||||
REQUIRE(type == 65533);
|
||||
|
||||
@@ -179,6 +180,15 @@ fromwire_keydata(ARGS_FROMWIRE) {
|
||||
if (sr.length < 16)
|
||||
return (ISC_R_UNEXPECTEDEND);
|
||||
|
||||
/*
|
||||
* RSAMD5 computes key ID differently from other
|
||||
* algorithms: we need to ensure there's enough data
|
||||
* present for the computation
|
||||
*/
|
||||
algorithm = sr.base[15];
|
||||
if (algorithm == DST_ALG_RSAMD5 && sr.length < 19)
|
||||
return (ISC_R_UNEXPECTEDEND);
|
||||
|
||||
isc_buffer_forward(source, sr.length);
|
||||
return (mem_tobuffer(target, sr.base, sr.length));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user