Skip to content

Commit

Permalink
Merge pull request #1384 from dodomorandi/rsa-oaep
Browse files Browse the repository at this point in the history
Add encrypt module and RSA OAEP support
  • Loading branch information
sfackler authored Dec 13, 2020
2 parents 7254b60 + c4b3f59 commit 74f380e
Show file tree
Hide file tree
Showing 3 changed files with 506 additions and 0 deletions.
15 changes: 15 additions & 0 deletions openssl-sys/src/rsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,28 @@ pub unsafe fn EVP_PKEY_CTX_set_rsa_mgf1_md(ctx: *mut EVP_PKEY_CTX, md: *mut EVP_
)
}

#[cfg(any(ossl102, libressl310))]
pub unsafe fn EVP_PKEY_CTX_set_rsa_oaep_md(ctx: *mut EVP_PKEY_CTX, md: *mut EVP_MD) -> c_int {
EVP_PKEY_CTX_ctrl(
ctx,
EVP_PKEY_RSA,
EVP_PKEY_OP_TYPE_CRYPT,
EVP_PKEY_CTRL_RSA_OAEP_MD,
0,
md as *mut c_void,
)
}

pub const EVP_PKEY_CTRL_RSA_PADDING: c_int = EVP_PKEY_ALG_CTRL + 1;
pub const EVP_PKEY_CTRL_RSA_PSS_SALTLEN: c_int = EVP_PKEY_ALG_CTRL + 2;

pub const EVP_PKEY_CTRL_RSA_MGF1_MD: c_int = EVP_PKEY_ALG_CTRL + 5;

pub const EVP_PKEY_CTRL_GET_RSA_PADDING: c_int = EVP_PKEY_ALG_CTRL + 6;

#[cfg(any(ossl102, libressl310))]
pub const EVP_PKEY_CTRL_RSA_OAEP_MD: c_int = EVP_PKEY_ALG_CTRL + 9;

pub const RSA_PKCS1_PADDING: c_int = 1;
pub const RSA_SSLV23_PADDING: c_int = 2;
pub const RSA_NO_PADDING: c_int = 3;
Expand Down
Loading

0 comments on commit 74f380e

Please sign in to comment.