Skip to content

Commit ff5c95d

Browse files
committed
Manual patching required after generating x509v3.d
* struct definitions removed from x509v3 are instead added as declarations in ossl_typ. * imports translated according to #include's in header-file, dstep doesn't resolve imports. * macros used as function aliasesas without argument list are incorrectly generated into enum types. * "#ifndef OPENSSL_NO_*" translated into "version".
1 parent 4fbfe5c commit ff5c95d

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

deimos/openssl/conf.d

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ struct CONF_VALUE
7878
char* value;
7979
}
8080

81+
struct lhash_st_CONF_VALUE; // declare type to make it compile, needed until this module and lhash.d is uplifted to >= 1.1.0h and supports "DEFINE_LHASH_OF"
82+
8183
/+mixin DECLARE_STACK_OF!(CONF_VALUE);+/
8284
mixin DECLARE_LHASH_OF!(CONF_VALUE);
8385

deimos/openssl/crypto.d

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ public import deimos.openssl.symhacks;
142142
extern (C):
143143
nothrow:
144144

145+
alias OPENSSL_buf2hexstr = char* function(const ubyte*, long);
146+
alias OPENSSL_hexstr2buf = ubyte* function(const char*, long*);
147+
145148
/* Backward compatibility to SSLeay */
146149
/* This is more to be used to check the correct DLL is being used
147150
* in the MS world. */

deimos/openssl/safestack.d

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ mixin DECLARE_SPECIAL_STACK_OF!(OPENSSL_STRING, char);
126126
* nul-terminated. These should also be distinguished from "normal"
127127
* stacks. */
128128

129+
struct stack_st_OPENSSL_STRING; // declare type to make it compile, needed until this module is uplifted to >= 1.1.0h and supports "DECLARE_SPECIAL_STACK_OF"
130+
129131
alias void* OPENSSL_BLOCK;
130132
mixin DECLARE_SPECIAL_STACK_OF!(OPENSSL_BLOCK, void);
131133
/* SKM_sk_... stack macros are internal to safestack.h:

deimos/openssl/x509.d

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,10 +831,11 @@ mixin(DECLARE_ASN1_FUNCTIONS!"X509_ATTRIBUTE");
831831
X509_ATTRIBUTE* X509_ATTRIBUTE_create(int nid, int atrtype, void* value);
832832

833833
mixin(DECLARE_ASN1_FUNCTIONS!"X509_EXTENSION");
834+
struct stack_st_X509_EXTENSION; // declare type to make it compile, needed until this module is uplifted to >= 1.1.0h and expands macro "DEFINE_STACK_OF(X509_EXTENSION)"
834835
mixin(DECLARE_ASN1_ENCODE_FUNCTIONS!("X509_EXTENSIONS", "X509_EXTENSIONS", "X509_EXTENSIONS"));
835836

836837
mixin(DECLARE_ASN1_FUNCTIONS!"X509_NAME_ENTRY");
837-
838+
struct stack_st_X509_NAME_ENTRY; // declare type to make it compile, needed until this module is uplifted to >= 1.1.0h and expands macro "DEFINE_STACK_OF(X509_NAME_ENTRY)"
838839
mixin(DECLARE_ASN1_FUNCTIONS!"X509_NAME");
839840

840841
int X509_NAME_set(X509_NAME** xn, X509_NAME* name);

deimos/openssl/x509v3.d

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@
77
* https://www.openssl.org/source/license.html
88
*/
99

10-
import core.stdc.config;
11-
import core.stdc.stdio;
12-
import core.sys.posix.sched;
10+
module deimos.openssl.x509v3;
11+
12+
import deimos.openssl._d_util;
13+
import deimos.openssl.crypto:OPENSSL_buf2hexstr, OPENSSL_hexstr2buf;
14+
import deimos.openssl.asn1:ASN1_OBJECT;
15+
16+
public import deimos.openssl.bio;
17+
public import deimos.openssl.x509;
18+
public import deimos.openssl.conf;
19+
1320

1421
extern (C):
22+
nothrow:
1523

1624
/* Forward reference */
1725

@@ -1126,8 +1134,8 @@ int X509V3_add1_i2d(
11261134
c_ulong flags);
11271135

11281136
/* The new declarations are in crypto.h, but the old ones were here. */
1129-
enum hex_to_string = OPENSSL_buf2hexstr;
1130-
enum string_to_hex = OPENSSL_hexstr2buf;
1137+
alias hex_to_string = OPENSSL_buf2hexstr;
1138+
alias string_to_hex = OPENSSL_hexstr2buf;
11311139

11321140
void X509V3_EXT_val_prn(
11331141
BIO* out_,
@@ -1136,7 +1144,9 @@ void X509V3_EXT_val_prn(
11361144
int ml);
11371145
int X509V3_EXT_print(BIO* out_, X509_EXTENSION* ext, c_ulong flag, int indent);
11381146

1147+
version(OPENSSL_NO_STDIO) {} else {
11391148
int X509V3_EXT_print_fp(FILE* out_, X509_EXTENSION* ext, int flag, int indent);
1149+
}
11401150

11411151
int X509V3_extensions_print(
11421152
BIO* out_,
@@ -1251,6 +1261,7 @@ stack_st_X509_POLICY_NODE* sk_X509_POLICY_NODE_dup(const(stack_st_X509_POLICY_NO
12511261
stack_st_X509_POLICY_NODE* sk_X509_POLICY_NODE_deep_copy(const(stack_st_X509_POLICY_NODE)* sk, sk_X509_POLICY_NODE_copyfunc copyfunc, sk_X509_POLICY_NODE_freefunc freefunc);
12521262
sk_X509_POLICY_NODE_compfunc sk_X509_POLICY_NODE_set_cmp_func(stack_st_X509_POLICY_NODE* sk, sk_X509_POLICY_NODE_compfunc compare);
12531263

1264+
version(OPENSSL_NO_RFC3779) {} else {
12541265
struct ASRange_st
12551266
{
12561267
ASN1_INTEGER* min;
@@ -1561,7 +1572,7 @@ int X509v3_addr_validate_resource_set(
15611572
IPAddrBlocks* ext,
15621573
int allow_inheritance);
15631574

1564-
/* OPENSSL_NO_RFC3779 */
1575+
} /* OPENSSL_NO_RFC3779 */
15651576

15661577
/* BEGIN ERROR CODES */
15671578
/*

0 commit comments

Comments
 (0)