Browse Source

Remove the useless calls to `map_err`

pull/39/head
Rodolphe Breard 4 years ago
parent
commit
387adc7c4f
  1. 6
      acme_common/src/crypto/openssl_keys.rs

6
acme_common/src/crypto/openssl_keys.rs

@ -174,15 +174,13 @@ impl KeyPair {
} }
fn gen_rsa_pair(nb_bits: u32) -> Result<PKey<Private>, Error> { fn gen_rsa_pair(nb_bits: u32) -> Result<PKey<Private>, Error> {
// TODO: check if map_err is required
let priv_key = Rsa::generate(nb_bits).map_err(|_| Error::from(""))?;
let priv_key = Rsa::generate(nb_bits)?;
let pk = PKey::from_rsa(priv_key).map_err(|_| Error::from(""))?; let pk = PKey::from_rsa(priv_key).map_err(|_| Error::from(""))?;
Ok(pk) Ok(pk)
} }
fn gen_ec_pair(nid: Nid) -> Result<PKey<Private>, Error> { fn gen_ec_pair(nid: Nid) -> Result<PKey<Private>, Error> {
// TODO: check if map_err is required
let mut group = EcGroup::from_curve_name(nid).map_err(|_| Error::from(""))?;
let mut group = EcGroup::from_curve_name(nid)?;
// Use NAMED_CURVE format; OpenSSL 1.0.1 and 1.0.2 default to EXPLICIT_CURVE which won't work (see #9) // Use NAMED_CURVE format; OpenSSL 1.0.1 and 1.0.2 default to EXPLICIT_CURVE which won't work (see #9)
group.set_asn1_flag(Asn1Flag::NAMED_CURVE); group.set_asn1_flag(Asn1Flag::NAMED_CURVE);

Loading…
Cancel
Save