Skip to content

Commit 945975b

Browse files
committed
rsa: rsa_st struct is opaque since v1.1.0
1 parent 0141394 commit 945975b

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

source/deimos/openssl/evp.d

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct evp_pkey_st
137137
union pkey_ {
138138
char* ptr;
139139
version(OPENSSL_NO_RSA) {} else {
140-
rsa_st* rsa; /* RSA */
140+
RSA* rsa; /* RSA */
141141
}
142142
version(OPENSSL_NO_DSA) {} else {
143143
dsa_st* dsa; /* DSA */
@@ -901,9 +901,9 @@ int EVP_PKEY_assign(EVP_PKEY* pkey,int type,void* key);
901901
void* EVP_PKEY_get0(EVP_PKEY* pkey);
902902

903903
version(OPENSSL_NO_RSA) {} else {
904-
import deimos.openssl.rsa; /*struct rsa_st;*/
905-
int EVP_PKEY_set1_RSA(EVP_PKEY* pkey,rsa_st* key);
906-
rsa_st* EVP_PKEY_get1_RSA(EVP_PKEY* pkey);
904+
import deimos.openssl.rsa;
905+
int EVP_PKEY_set1_RSA(EVP_PKEY* pkey, RSA* key);
906+
RSA* EVP_PKEY_get1_RSA(EVP_PKEY* pkey);
907907
}
908908
version(OPENSSL_NO_DSA) {} else {
909909
import deimos.openssl.dsa; /*struct dsa_st;*/

source/deimos/openssl/rsa.d

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ extern (C):
3434
nothrow:
3535

3636
/* Declared already in types.h */
37-
/* typedef rsa_st RSA; */
3837
/* typedef rsa_meth_st RSA_METHOD; */
3938

4039
struct rsa_meth_st
@@ -81,8 +80,25 @@ struct rsa_meth_st
8180
ExternC!(int function(RSA* rsa, int bits, BIGNUM* e, BN_GENCB* cb)) rsa_keygen;
8281
};
8382

83+
static if (OPENSSL_VERSION_AT_LEAST(1, 1, 0))
84+
{
85+
// https://github.com/openssl/openssl/commit/9862e9aa98ee1e38fbcef8d1dd5db0e750eb5e8d
86+
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
87+
int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
88+
int RSA_set0_crt_params(RSA *r,BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
89+
void RSA_get0_key(const RSA *r, BIGNUM **n, BIGNUM **e, BIGNUM **d);
90+
void RSA_get0_factors(const RSA *r, BIGNUM **p, BIGNUM **q);
91+
void RSA_get0_crt_params(const RSA *r,
92+
BIGNUM **dmp1, BIGNUM **dmq1, BIGNUM **iqmp);
93+
void RSA_clear_flags(RSA *r, int flags);
94+
int RSA_test_flags(const RSA *r, int flags);
95+
void RSA_set_flags(RSA *r, int flags);
96+
ENGINE *RSA_get0_engine(RSA *r);
97+
}
98+
else
99+
{
84100
struct rsa_st
85-
{
101+
{
86102
/* The first parameter is used to pickup errors where
87103
* this is passed instead of aEVP_PKEY, it is set to 0 */
88104
int pad;
@@ -113,7 +129,8 @@ struct rsa_st
113129
char* bignum_data;
114130
BN_BLINDING* blinding;
115131
BN_BLINDING* mt_blinding;
116-
};
132+
}
133+
}
117134

118135
// #ifndef OPENSSL_RSA_MAX_MODULUS_BITS
119136
enum OPENSSL_RSA_MAX_MODULUS_BITS = 16384;

source/deimos/openssl/types.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ alias dsa_st DSA;
113113
alias dsa_method DSA_METHOD;
114114

115115
import deimos.openssl.rsa;
116-
/*struct rsa_st;*/
116+
private struct rsa_st;
117117
alias rsa_st RSA;
118118
/*struct rsa_meth_st;*/
119119
alias rsa_meth_st RSA_METHOD;

0 commit comments

Comments
 (0)