You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.3 KiB
59 lines
2.3 KiB
1 year ago
|
From ee22888d289afda535647081a9836111de997dd7 Mon Sep 17 00:00:00 2001
|
||
|
From: Fabio Valentini <decathorpe@gmail.com>
|
||
|
Date: Tue, 19 Dec 2023 18:09:31 +0100
|
||
|
Subject: [PATCH] port to ring 0.17
|
||
|
|
||
|
---
|
||
|
src/rr/dnssec/key_format.rs | 5 ++++-
|
||
|
src/rr/dnssec/rdata/tsig.rs | 6 +++---
|
||
|
2 files changed, 7 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/src/rr/dnssec/key_format.rs b/src/rr/dnssec/key_format.rs
|
||
|
index 6aead61..22a9d85 100644
|
||
|
--- a/src/rr/dnssec/key_format.rs
|
||
|
+++ b/src/rr/dnssec/key_format.rs
|
||
|
@@ -5,6 +5,8 @@ use openssl::rsa::Rsa;
|
||
|
#[cfg(feature = "openssl")]
|
||
|
use openssl::symm::Cipher;
|
||
|
#[cfg(feature = "ring")]
|
||
|
+use ring::rand::SystemRandom;
|
||
|
+#[cfg(feature = "ring")]
|
||
|
use ring::signature::{
|
||
|
EcdsaKeyPair, Ed25519KeyPair, ECDSA_P256_SHA256_FIXED_SIGNING, ECDSA_P384_SHA384_FIXED_SIGNING,
|
||
|
};
|
||
|
@@ -86,12 +88,13 @@ impl KeyFormat {
|
||
|
}
|
||
|
#[cfg(feature = "ring")]
|
||
|
Self::Pkcs8 => {
|
||
|
+ let rng = SystemRandom::new();
|
||
|
let ring_algorithm = if algorithm == Algorithm::ECDSAP256SHA256 {
|
||
|
&ECDSA_P256_SHA256_FIXED_SIGNING
|
||
|
} else {
|
||
|
&ECDSA_P384_SHA384_FIXED_SIGNING
|
||
|
};
|
||
|
- let key = EcdsaKeyPair::from_pkcs8(ring_algorithm, bytes)?;
|
||
|
+ let key = EcdsaKeyPair::from_pkcs8(ring_algorithm, bytes, &rng)?;
|
||
|
|
||
|
Ok(KeyPair::from_ecdsa(key))
|
||
|
}
|
||
|
diff --git a/src/rr/dnssec/rdata/tsig.rs b/src/rr/dnssec/rdata/tsig.rs
|
||
|
index 1b1ea4d..4c0e3bc 100644
|
||
|
--- a/src/rr/dnssec/rdata/tsig.rs
|
||
|
+++ b/src/rr/dnssec/rdata/tsig.rs
|
||
|
@@ -635,9 +635,9 @@ impl TsigAlgorithm {
|
||
|
use TsigAlgorithm::*;
|
||
|
|
||
|
let len = match self {
|
||
|
- HmacSha256 => hmac::HMAC_SHA256.digest_algorithm().output_len,
|
||
|
- HmacSha384 => hmac::HMAC_SHA384.digest_algorithm().output_len,
|
||
|
- HmacSha512 => hmac::HMAC_SHA512.digest_algorithm().output_len,
|
||
|
+ HmacSha256 => hmac::HMAC_SHA256.digest_algorithm().output_len(),
|
||
|
+ HmacSha384 => hmac::HMAC_SHA384.digest_algorithm().output_len(),
|
||
|
+ HmacSha512 => hmac::HMAC_SHA512.digest_algorithm().output_len(),
|
||
|
_ => return Err(ProtoErrorKind::TsigUnsupportedMacAlgorithm(self.clone()).into()),
|
||
|
};
|
||
|
|
||
|
--
|
||
|
2.43.0
|
||
|
|