aboutsummaryrefslogtreecommitdiff
path: root/openssl-sys/src/lib.rs
diff options
context:
space:
mode:
authorBrian Chin <[email protected]>2017-01-27 18:16:22 -0800
committerBrian Chin <[email protected]>2017-01-30 15:04:44 -0800
commitddc0066211fb9adadd658bd04547dc143dcfbc5a (patch)
tree64de174c6c6901016100b9ba63717adb92718438 /openssl-sys/src/lib.rs
parentMerge pull request #569 from sfackler/expando (diff)
downloadrust-openssl-ddc0066211fb9adadd658bd04547dc143dcfbc5a.tar.xz
rust-openssl-ddc0066211fb9adadd658bd04547dc143dcfbc5a.zip
Add the necessary constants to access the pkey ctx stuff.
Diffstat (limited to 'openssl-sys/src/lib.rs')
-rw-r--r--openssl-sys/src/lib.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs
index 01be1b23..6b61aab7 100644
--- a/openssl-sys/src/lib.rs
+++ b/openssl-sys/src/lib.rs
@@ -151,6 +151,8 @@ pub const EVP_PKEY_DSA: c_int = NID_dsa;
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_ALG_CTRL: c_int = 0x1000;
+
pub const EVP_CTRL_GCM_SET_IVLEN: c_int = 0x9;
pub const EVP_CTRL_GCM_GET_TAG: c_int = 0x10;
pub const EVP_CTRL_GCM_SET_TAG: c_int = 0x11;
@@ -1121,6 +1123,10 @@ pub const RSA_NO_PADDING: c_int = 3;
pub const RSA_PKCS1_OAEP_PADDING: c_int = 4;
pub const RSA_X931_PADDING: c_int = 5;
+pub const RSA_PKEY_CTRL_RSA_PADDING: c_int = EVP_PKEY_ALG_CTRL + 1;
+
+pub const RSA_PKEY_CTRL_GET_RSA_PADDING: c_int = EVP_PKEY_ALG_CTRL + 6;
+
pub const SSL_CTRL_SET_TMP_DH: c_int = 3;
pub const SSL_CTRL_SET_TMP_ECDH: c_int = 4;
pub const SSL_CTRL_EXTRA_CHAIN_CERT: c_int = 14;
@@ -1726,6 +1732,7 @@ extern {
pub fn RSA_new() -> *mut RSA;
pub fn RSA_free(rsa: *mut RSA);
pub fn RSA_generate_key_ex(rsa: *mut RSA, bits: c_int, e: *mut BIGNUM, cb: *mut BN_GENCB) -> c_int;
+ pub fn RSA_pkey_ctx_ctrl(ctx: *mut EVP_PKEY_CTX, optype: c_int, cmd: c_int, p1: c_int, p2: *mut c_void) -> c_int;
pub fn RSA_private_decrypt(flen: c_int, from: *const u8, to: *mut u8, k: *mut RSA,
pad: c_int) -> c_int;
pub fn RSA_public_decrypt(flen: c_int, from: *const u8, to: *mut u8, k: *mut RSA,
@@ -1996,3 +2003,12 @@ extern {
md: *mut c_uchar,
len: *mut c_uint) -> c_int;
}
+
+// EVP_PKEY_CTX_ctrl macros
+unsafe fn EVP_PKEY_CTX_set_rsa_padding(ctx: *mut EVP_PKEY_CTX, pad: c_int) -> c_int {
+ RSA_pkey_ctx_ctrl(ctx, -1, RSA_PKEY_CTRL_RSA_PADDING, pad, ptr::null_mut())
+}
+
+unsafe fn EVP_PKEY_CTX_get_rsa_padding(ctx: *mut EVP_PKEY_CTX, ppad: *mut c_int) -> c_int {
+ RSA_pkey_ctx_ctrl(ctx, -1, RSA_PKEY_CTRL_GET_RSA_PADDING, 0, ppad as *mut c_void)
+}