Merge pull request #1342 from hidekatsu-izuno/support-ecx
Add ecx (X25519, X448) support
This commit is contained in:
commit
0a0da84f93
|
|
@ -11,8 +11,12 @@ pub const EVP_PKEY_DSA: c_int = NID_dsa;
|
||||||
pub const EVP_PKEY_DH: c_int = NID_dhKeyAgreement;
|
pub const EVP_PKEY_DH: c_int = NID_dhKeyAgreement;
|
||||||
pub const EVP_PKEY_EC: c_int = NID_X9_62_id_ecPublicKey;
|
pub const EVP_PKEY_EC: c_int = NID_X9_62_id_ecPublicKey;
|
||||||
#[cfg(ossl111)]
|
#[cfg(ossl111)]
|
||||||
|
pub const EVP_PKEY_X25519: c_int = NID_X25519;
|
||||||
|
#[cfg(ossl111)]
|
||||||
pub const EVP_PKEY_ED25519: c_int = NID_ED25519;
|
pub const EVP_PKEY_ED25519: c_int = NID_ED25519;
|
||||||
#[cfg(ossl111)]
|
#[cfg(ossl111)]
|
||||||
|
pub const EVP_PKEY_X448: c_int = NID_X448;
|
||||||
|
#[cfg(ossl111)]
|
||||||
pub const EVP_PKEY_ED448: c_int = NID_ED448;
|
pub const EVP_PKEY_ED448: c_int = NID_ED448;
|
||||||
pub const EVP_PKEY_HMAC: c_int = NID_hmac;
|
pub const EVP_PKEY_HMAC: c_int = NID_hmac;
|
||||||
pub const EVP_PKEY_CMAC: c_int = NID_cmac;
|
pub const EVP_PKEY_CMAC: c_int = NID_cmac;
|
||||||
|
|
|
||||||
|
|
@ -913,6 +913,10 @@ pub const NID_aes_128_cbc_hmac_sha1: c_int = 916;
|
||||||
pub const NID_aes_192_cbc_hmac_sha1: c_int = 917;
|
pub const NID_aes_192_cbc_hmac_sha1: c_int = 917;
|
||||||
pub const NID_aes_256_cbc_hmac_sha1: c_int = 918;
|
pub const NID_aes_256_cbc_hmac_sha1: c_int = 918;
|
||||||
#[cfg(ossl111)]
|
#[cfg(ossl111)]
|
||||||
|
pub const NID_X25519: c_int = 1034;
|
||||||
|
#[cfg(ossl111)]
|
||||||
|
pub const NID_X448: c_int = 1035;
|
||||||
|
#[cfg(ossl111)]
|
||||||
pub const NID_ED25519: c_int = 1087;
|
pub const NID_ED25519: c_int = 1087;
|
||||||
#[cfg(ossl111)]
|
#[cfg(ossl111)]
|
||||||
pub const NID_ED448: c_int = 1088;
|
pub const NID_ED448: c_int = 1088;
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,10 @@ impl Id {
|
||||||
pub const ED25519: Id = Id(ffi::EVP_PKEY_ED25519);
|
pub const ED25519: Id = Id(ffi::EVP_PKEY_ED25519);
|
||||||
#[cfg(ossl111)]
|
#[cfg(ossl111)]
|
||||||
pub const ED448: Id = Id(ffi::EVP_PKEY_ED448);
|
pub const ED448: Id = Id(ffi::EVP_PKEY_ED448);
|
||||||
|
#[cfg(ossl111)]
|
||||||
|
pub const X25519: Id = Id(ffi::EVP_PKEY_X25519);
|
||||||
|
#[cfg(ossl111)]
|
||||||
|
pub const X448: Id = Id(ffi::EVP_PKEY_X448);
|
||||||
|
|
||||||
/// Creates a `Id` from an integer representation.
|
/// Creates a `Id` from an integer representation.
|
||||||
pub fn from_raw(value: c_int) -> Id {
|
pub fn from_raw(value: c_int) -> Id {
|
||||||
|
|
@ -494,6 +498,18 @@ impl PKey<Private> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Generates a new private Ed25519 key
|
||||||
|
#[cfg(ossl111)]
|
||||||
|
pub fn generate_x25519() -> Result<PKey<Private>, ErrorStack> {
|
||||||
|
PKey::generate_eddsa(ffi::EVP_PKEY_X25519)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Generates a new private Ed448 key
|
||||||
|
#[cfg(ossl111)]
|
||||||
|
pub fn generate_x448() -> Result<PKey<Private>, ErrorStack> {
|
||||||
|
PKey::generate_eddsa(ffi::EVP_PKEY_X448)
|
||||||
|
}
|
||||||
|
|
||||||
/// Generates a new private Ed25519 key
|
/// Generates a new private Ed25519 key
|
||||||
#[cfg(ossl111)]
|
#[cfg(ossl111)]
|
||||||
pub fn generate_ed25519() -> Result<PKey<Private>, ErrorStack> {
|
pub fn generate_ed25519() -> Result<PKey<Private>, ErrorStack> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue