Coverage Report

Created: 2024-04-26 06:25

/rust/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.98/src/rsa.rs
Line
Count
Source (jump to first uncovered line)
1
use libc::*;
2
use std::ptr;
3
4
use super::super::*;
5
6
pub const RSA_F4: c_long = 0x10001;
7
8
cfg_if! {
9
    if #[cfg(not(ossl300))] {
10
0
        pub unsafe fn EVP_PKEY_CTX_set_rsa_padding(ctx: *mut EVP_PKEY_CTX, pad: c_int) -> c_int {
11
0
            EVP_PKEY_CTX_ctrl(
12
0
                ctx,
13
0
                EVP_PKEY_RSA,
14
0
                -1,
15
0
                EVP_PKEY_CTRL_RSA_PADDING,
16
0
                pad,
17
0
                ptr::null_mut(),
18
0
            )
19
0
        }
20
0
        pub unsafe fn EVP_PKEY_CTX_get_rsa_padding(ctx: *mut EVP_PKEY_CTX, ppad: *mut c_int) -> c_int {
21
0
            EVP_PKEY_CTX_ctrl(
22
0
                ctx,
23
0
                EVP_PKEY_RSA,
24
0
                -1,
25
0
                EVP_PKEY_CTRL_GET_RSA_PADDING,
26
0
                0,
27
0
                ppad as *mut c_void,
28
0
            )
29
0
        }
30
31
0
        pub unsafe fn EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx: *mut EVP_PKEY_CTX, len: c_int) -> c_int {
32
0
            EVP_PKEY_CTX_ctrl(
33
0
                ctx,
34
0
                EVP_PKEY_RSA,
35
0
                EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY,
36
0
                EVP_PKEY_CTRL_RSA_PSS_SALTLEN,
37
0
                len,
38
0
                ptr::null_mut(),
39
0
            )
40
0
        }
41
42
0
        pub unsafe fn EVP_PKEY_CTX_set_rsa_mgf1_md(ctx: *mut EVP_PKEY_CTX, md: *mut EVP_MD) -> c_int {
43
0
            EVP_PKEY_CTX_ctrl(
44
0
                ctx,
45
0
                EVP_PKEY_RSA,
46
0
                EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT,
47
0
                EVP_PKEY_CTRL_RSA_MGF1_MD,
48
0
                0,
49
0
                md as *mut c_void,
50
0
            )
51
0
        }
52
    }
53
}
54
55
#[cfg(any(ossl102, libressl310))]
56
0
pub unsafe fn EVP_PKEY_CTX_set_rsa_oaep_md(ctx: *mut EVP_PKEY_CTX, md: *mut EVP_MD) -> c_int {
57
0
    EVP_PKEY_CTX_ctrl(
58
0
        ctx,
59
0
        EVP_PKEY_RSA,
60
0
        EVP_PKEY_OP_TYPE_CRYPT,
61
0
        EVP_PKEY_CTRL_RSA_OAEP_MD,
62
0
        0,
63
0
        md as *mut c_void,
64
0
    )
65
0
}
66
67
#[cfg(any(ossl102, libressl310))]
68
0
pub unsafe fn EVP_PKEY_CTX_set0_rsa_oaep_label(
69
0
    ctx: *mut EVP_PKEY_CTX,
70
0
    label: *mut c_void,
71
0
    len: c_int,
72
0
) -> c_int {
73
0
    EVP_PKEY_CTX_ctrl(
74
0
        ctx,
75
0
        EVP_PKEY_RSA,
76
0
        EVP_PKEY_OP_TYPE_CRYPT,
77
0
        EVP_PKEY_CTRL_RSA_OAEP_LABEL,
78
0
        len,
79
0
        label,
80
0
    )
81
0
}
82
83
pub const EVP_PKEY_CTRL_RSA_PADDING: c_int = EVP_PKEY_ALG_CTRL + 1;
84
pub const EVP_PKEY_CTRL_RSA_PSS_SALTLEN: c_int = EVP_PKEY_ALG_CTRL + 2;
85
86
pub const EVP_PKEY_CTRL_RSA_MGF1_MD: c_int = EVP_PKEY_ALG_CTRL + 5;
87
88
pub const EVP_PKEY_CTRL_GET_RSA_PADDING: c_int = EVP_PKEY_ALG_CTRL + 6;
89
90
#[cfg(any(ossl102, libressl310))]
91
pub const EVP_PKEY_CTRL_RSA_OAEP_MD: c_int = EVP_PKEY_ALG_CTRL + 9;
92
#[cfg(any(ossl102, libressl310))]
93
pub const EVP_PKEY_CTRL_RSA_OAEP_LABEL: c_int = EVP_PKEY_ALG_CTRL + 10;
94
95
pub const RSA_PKCS1_PADDING: c_int = 1;
96
#[cfg(not(ossl300))]
97
pub const RSA_SSLV23_PADDING: c_int = 2;
98
pub const RSA_NO_PADDING: c_int = 3;
99
pub const RSA_PKCS1_OAEP_PADDING: c_int = 4;
100
pub const RSA_X931_PADDING: c_int = 5;
101
pub const RSA_PKCS1_PSS_PADDING: c_int = 6;