Skip to content

Commit

Permalink
Fix build dependencies with ECC in ossl
Browse files Browse the repository at this point in the history
Signed-off-by: Simo Sorce <[email protected]>
  • Loading branch information
simo5 committed Nov 22, 2024
1 parent 41a2b4e commit ccb19e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
13 changes: 8 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ zeroize = "1.6.0"

[features]
aes = []
ecdsa = []
ecdh = []
eddsa = []
ec_montgomery = []
ecc = []
ecdsa = ["ecc"]
ecdh = ["ecc"]
eddsa = ["ecc"]
ec_montgomery = ["ecc"]
hash = []
hkdf = []
hmac = ["hash"]
Expand All @@ -69,7 +70,9 @@ sqlitedb = ["dep:rusqlite"]
# these are always required, so easier to specify this way
default = [ "aes", "hmac", "pbkdf2", "sqlitedb" ]

standard = [ "ecdsa", "ec_montgomery", "eddsa", "ecdh", "hash", "hkdf", "rsa", "sp800_108", "sshkdf", "tlskdf"]
ecc_all = ["ecdsa", "ec_montgomery", "eddsa", "ecdh"]

standard = [ "ecc_all", "hash", "hkdf", "rsa", "sp800_108", "sshkdf", "tlskdf"]

fips = [ "rusqlite/bundled", "ecdsa", "ecdh", "hash", "hkdf", "rsa", "sp800_108", "sshkdf", "tlskdf"]

Expand Down
2 changes: 1 addition & 1 deletion src/enabled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ compile_error!("Feature 'ecdh' requires either 'ecdsa' or 'ec_montgomery'");
#[cfg(feature = "aes")]
mod aes;

#[cfg(any(feature = "ecdsa", feature = "eddsa", feature = "ec_montgomery"))]
#[cfg(feature = "ecc")]
mod ec;

#[cfg(feature = "hash")]
Expand Down
4 changes: 3 additions & 1 deletion src/ossl/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use std::borrow::Cow;
use std::ffi::{c_char, c_int, c_uint, c_void};

use crate::ec::get_oid_from_obj;
use crate::error::Result;
use crate::interface::*;
use crate::kasn1::oid;
Expand All @@ -13,6 +12,8 @@ use crate::ossl::bindings::*;
use crate::ossl::get_libctx;
use crate::{byte_ptr, void_ptr};

#[cfg(feature = "ecc")]
use crate::ec::get_oid_from_obj;
#[cfg(feature = "ecdsa")]
use crate::ossl::ecdsa;
#[cfg(feature = "eddsa")]
Expand Down Expand Up @@ -886,6 +887,7 @@ fn oid_to_ossl_name(oid: &asn1::ObjectIdentifier) -> Result<&'static [u8]> {
}
}

#[cfg(feature = "ecc")]
pub fn get_ossl_name_from_obj(key: &Object) -> Result<&'static [u8]> {
oid_to_ossl_name(&get_oid_from_obj(key)?)
}

0 comments on commit ccb19e2

Please sign in to comment.