Skip to content

Commit 90a7409

Browse files
committed
Change array declarations from C style to D style to allow compile with latest dmd2 compiler.
1 parent 8a17a78 commit 90a7409

File tree

12 files changed

+73
-75
lines changed

12 files changed

+73
-75
lines changed

deimos/openssl/bn.d

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ struct bn_mont_ctx_st
339339
BIGNUM N; /* The modulus */
340340
BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1
341341
* (Ni is only stored for bignum algorithm) */
342-
BN_ULONG n0[2];/* least significant word(s) of Ni;
342+
BN_ULONG[2] n0;/* least significant word(s) of Ni;
343343
(type changed with 0.9.9, was "BN_ULONG n0;" before) */
344344
int flags;
345345
};
@@ -670,26 +670,24 @@ alias BN_ucmp BN_GF2m_cmp;
670670
* t^p[0] + t^p[1] + ... + t^p[k]
671671
* where m = p[0] > p[1] > ... > p[k] = 0.
672672
*/
673-
int BN_GF2m_mod_arr(BIGNUM* r, const(BIGNUM)* a, const int p[]);
673+
int BN_GF2m_mod_arr(BIGNUM* r, const(BIGNUM)* a, const int[] p);
674674
/* r = a mod p */
675675
int BN_GF2m_mod_mul_arr(BIGNUM* r, const(BIGNUM)* a, const(BIGNUM)* b,
676-
const int p[], BN_CTX* ctx); /* r = (a* b) mod p */
677-
int BN_GF2m_mod_sqr_arr(BIGNUM* r, const(BIGNUM)* a, const int p[],
676+
const int[] p, BN_CTX* ctx); /* r = (a* b) mod p */
677+
int BN_GF2m_mod_sqr_arr(BIGNUM* r, const(BIGNUM)* a, const int[] p,
678678
BN_CTX* ctx); /* r = (a* a) mod p */
679-
int BN_GF2m_mod_inv_arr(BIGNUM* r, const(BIGNUM)* b, const int p[],
679+
int BN_GF2m_mod_inv_arr(BIGNUM* r, const(BIGNUM)* b, const int[] p,
680680
BN_CTX* ctx); /* r = (1 / b) mod p */
681681
int BN_GF2m_mod_div_arr(BIGNUM* r, const(BIGNUM)* a, const(BIGNUM)* b,
682-
const int p[], BN_CTX* ctx); /* r = (a / b) mod p */
682+
const int[] p, BN_CTX* ctx); /* r = (a / b) mod p */
683683
int BN_GF2m_mod_exp_arr(BIGNUM* r, const(BIGNUM)* a, const(BIGNUM)* b,
684-
const int p[], BN_CTX* ctx); /* r = (a ^ b) mod p */
684+
const int[] p, BN_CTX* ctx); /* r = (a ^ b) mod p */
685685
int BN_GF2m_mod_sqrt_arr(BIGNUM* r, const(BIGNUM)* a,
686-
const int p[], BN_CTX* ctx); /* r = sqrt(a) mod p */
686+
const int[] p, BN_CTX* ctx); /* r = sqrt(a) mod p */
687687
int BN_GF2m_mod_solve_quad_arr(BIGNUM* r, const(BIGNUM)* a,
688-
const int p[], BN_CTX* ctx); /* r^2 + r = a mod p */
689-
int BN_GF2m_poly2arr(const(BIGNUM)* a, int p[], int max);
690-
int BN_GF2m_arr2poly(const int p[], BIGNUM* a);
691-
692-
}
688+
const int[] p, BN_CTX* ctx); /* r^2 + r = a mod p */
689+
int BN_GF2m_poly2arr(const(BIGNUM)* a, int[] p, int max);
690+
int BN_GF2m_arr2poly(const int[] p, BIGNUM* a);
693691

694692
/* faster mod functions for the 'NIST primes'
695693
* 0 <= a < p^2 */

deimos/openssl/dtls1.d

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ version(OPENSSL_NO_SCTP) {} else {
124124
struct dtls1_bitmap_st {
125125
c_ulong map; /* track 32 packets on 32-bit systems
126126
and 64 - on 64-bit systems */
127-
ubyte max_seq_num[8]; /* max record number seen so far,
127+
ubyte[8] max_seq_num; /* max record number seen so far,
128128
64-bit value in big-endian
129129
encoding */
130130
}
@@ -187,8 +187,8 @@ alias hm_fragment_st hm_fragment;
187187

188188
struct dtls1_state_st {
189189
uint send_cookie;
190-
ubyte cookie[DTLS1_COOKIE_LENGTH];
191-
ubyte rcvd_cookie[DTLS1_COOKIE_LENGTH];
190+
ubyte[DTLS1_COOKIE_LENGTH] cookie;
191+
ubyte[DTLS1_COOKIE_LENGTH] rcvd_cookie;
192192
uint cookie_len;
193193

194194
/*
@@ -212,7 +212,7 @@ struct dtls1_state_st {
212212
ushort handshake_read_seq;
213213

214214
/* save last sequence number for retransmissions */
215-
ubyte last_write_sequence[8];
215+
ubyte[8] last_write_sequence;
216216

217217
/* Received handshake records (processed and unprocessed) */
218218
record_pqueue unprocessed_rcds;
@@ -249,9 +249,9 @@ struct dtls1_state_st {
249249

250250
/* storage for Alert/Handshake protocol data received but not
251251
* yet processed by ssl3_read_bytes: */
252-
ubyte alert_fragment[DTLS1_AL_HEADER_LENGTH];
252+
ubyte[DTLS1_AL_HEADER_LENGTH] alert_fragment;
253253
uint alert_fragment_len;
254-
ubyte handshake_fragment[DTLS1_HM_HEADER_LENGTH];
254+
ubyte[DTLS1_HM_HEADER_LENGTH] handshake_fragment;
255255
uint handshake_fragment_len;
256256

257257
uint retransmitting;

deimos/openssl/err.d

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ enum ERR_FLAG_MARK = 0x01;
156156
enum ERR_NUM_ERRORS = 16;
157157
struct err_state_st {
158158
CRYPTO_THREADID tid;
159-
int err_flags[ERR_NUM_ERRORS];
160-
c_ulong err_buffer[ERR_NUM_ERRORS];
161-
char* err_data[ERR_NUM_ERRORS];
162-
int err_data_flags[ERR_NUM_ERRORS];
163-
const(char)* err_file[ERR_NUM_ERRORS];
164-
int err_line[ERR_NUM_ERRORS];
159+
int[ERR_NUM_ERRORS] err_flags;
160+
c_ulong[ERR_NUM_ERRORS] err_buffer;
161+
char*[ERR_NUM_ERRORS] err_data;
162+
int[ERR_NUM_ERRORS] err_data_flags;
163+
const(char)*[ERR_NUM_ERRORS] err_file;
164+
int[ERR_NUM_ERRORS] err_line;
165165
int top,bottom;
166166
}
167167
alias err_state_st ERR_STATE;
@@ -358,8 +358,8 @@ void ERR_print_errors(BIO* bp);
358358
}
359359
void ERR_add_error_data(int num, ...);
360360
void ERR_add_error_vdata(int num, va_list args);
361-
void ERR_load_strings(int lib,ERR_STRING_DATA str[]);
362-
void ERR_unload_strings(int lib,ERR_STRING_DATA str[]);
361+
void ERR_load_strings(int lib,ERR_STRING_DATA[] str);
362+
void ERR_unload_strings(int lib,ERR_STRING_DATA[] str);
363363
void ERR_load_ERR_strings();
364364
void ERR_load_crypto_strings();
365365
void ERR_free_strings();

deimos/openssl/evp.d

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ struct env_md_st
178178
ExternC!(int function(int type, const(ubyte)* m, uint m_length,
179179
const(ubyte)* sigbuf, uint siglen,
180180
void* key)) verify;
181-
int required_pkey_type[5]; /*EVP_PKEY_xxx */
181+
int[5] required_pkey_type; /*EVP_PKEY_xxx */
182182
int block_size;
183183
int ctx_size; /* how big does the ctx->md_data need to be */
184184
/* control function */
@@ -404,7 +404,7 @@ enum EVP_GCM_TLS_TAG_LEN = 16;
404404

405405
struct evp_cipher_info_st {
406406
const(EVP_CIPHER)* cipher;
407-
ubyte iv[EVP_MAX_IV_LENGTH];
407+
ubyte[EVP_MAX_IV_LENGTH] iv;
408408
}
409409
alias evp_cipher_info_st EVP_CIPHER_INFO;
410410

@@ -415,10 +415,10 @@ struct evp_cipher_ctx_st
415415
int encrypt; /* encrypt or decrypt */
416416
int buf_len; /* number we have left */
417417

418-
ubyte oiv[EVP_MAX_IV_LENGTH]; /* original iv */
419-
ubyte iv[EVP_MAX_IV_LENGTH]; /* working iv */
420-
ubyte buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */
421-
int num; /* used by cfb/ofb/ctr mode */
418+
ubyte[EVP_MAX_IV_LENGTH] oiv; /* original iv */
419+
ubyte[EVP_MAX_IV_LENGTH] iv; /* working iv */
420+
ubyte[EVP_MAX_BLOCK_LENGTH] buf;/* saved partial block */
421+
int num; /* used by cfb/ofb mode */
422422

423423
void* app_data; /* application stuff */
424424
int key_len; /* May change for variable length cipher */
@@ -436,7 +436,7 @@ struct evp_Encode_Ctx_st {
436436
* length that is ok. Once decoding begins,
437437
* the length is adjusted up each time a longer
438438
* line is decoded */
439-
ubyte enc_data[80]; /* data to encode */
439+
ubyte[80] enc_data; /* data to encode */
440440
int line_num; /* number read on current line */
441441
int expect_nl;
442442
}

deimos/openssl/hmac.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct hmac_ctx_st {
7878
EVP_MD_CTX i_ctx;
7979
EVP_MD_CTX o_ctx;
8080
uint key_length;
81-
ubyte key[HMAC_MAX_MD_CBLOCK];
81+
ubyte[HMAC_MAX_MD_CBLOCK] key;
8282
}
8383
alias hmac_ctx_st HMAC_CTX;
8484

deimos/openssl/kssl.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ enum KSSL_CLOCKSKEW = 300;;
126126
enum KSSL_ERR_MAX = 255;
127127
struct kssl_err_st {
128128
int reason;
129-
char text[KSSL_ERR_MAX+1];
129+
char[KSSL_ERR_MAX+1] text;
130130
}
131131
alias kssl_err_st KSSL_ERR;
132132

deimos/openssl/pqueue.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct _pqueue;
6969
alias _pqueue* pqueue;
7070

7171
struct _pitem {
72-
ubyte priority[8]; /* 64-bit value in big-endian encoding */
72+
ubyte[8] priority; /* 64-bit value in big-endian encoding */
7373
void* data;
7474
_pitem* next;
7575
}

deimos/openssl/sha.d

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct SHAstate_st
108108
{
109109
SHA_LONG h0,h1,h2,h3,h4;
110110
SHA_LONG Nl,Nh;
111-
SHA_LONG data[SHA_LBLOCK];
111+
SHA_LONG[SHA_LBLOCK] data;
112112
uint num;
113113
}
114114
alias SHAstate_st SHA_CTX;
@@ -141,9 +141,9 @@ enum SHA224_DIGEST_LENGTH = 28;
141141
enum SHA256_DIGEST_LENGTH = 32;
142142

143143
struct SHA256state_st {
144-
SHA_LONG h[8];
144+
SHA_LONG[8] h;
145145
SHA_LONG Nl,Nh;
146-
SHA_LONG data[SHA_LBLOCK];
146+
SHA_LONG[SHA_LBLOCK] data;
147147
uint num,md_len;
148148
}
149149
alias SHA256state_st SHA256_CTX;
@@ -190,11 +190,11 @@ alias ulong SHA_LONG64;
190190

191191
struct SHA512state_st
192192
{
193-
SHA_LONG64 h[8];
193+
SHA_LONG64[8] h;
194194
SHA_LONG64 Nl,Nh;
195195
union u_ {
196-
SHA_LONG64 d[SHA_LBLOCK];
197-
ubyte p[SHA512_CBLOCK];
196+
SHA_LONG64[SHA_LBLOCK] d;
197+
ubyte[SHA512_CBLOCK] p;
198198
}
199199
u_ u;
200200
uint num,md_len;

deimos/openssl/ssl.d

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -479,21 +479,21 @@ struct ssl_session_st
479479

480480
/* only really used in SSLv2 */
481481
uint key_arg_length;
482-
ubyte key_arg[SSL_MAX_KEY_ARG_LENGTH];
482+
ubyte[SSL_MAX_KEY_ARG_LENGTH] key_arg;
483483
int master_key_length;
484-
ubyte master_key[SSL_MAX_MASTER_KEY_LENGTH];
484+
ubyte[SSL_MAX_MASTER_KEY_LENGTH] master_key;
485485
/* session_id - valid? */
486486
uint session_id_length;
487-
ubyte session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
487+
ubyte[SSL_MAX_SSL_SESSION_ID_LENGTH] session_id;
488488
/* this is used to determine whether the session is being reused in
489489
* the appropriate context. It is up to the application to set this,
490490
* via SSL_new */
491491
uint sid_ctx_length;
492-
ubyte sid_ctx[SSL_MAX_SID_CTX_LENGTH];
492+
ubyte[SSL_MAX_SID_CTX_LENGTH] sid_ctx;
493493

494494
version(OPENSSL_NO_KRB5) {} else {
495495
uint krb5_client_princ_len;
496-
ubyte krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH];
496+
ubyte[SSL_MAX_KRB5_PRINCIPAL_LENGTH] krb5_client_princ;
497497
} /* OPENSSL_NO_KRB5 */
498498
version(OPENSSL_NO_PSK) {} else {
499499
char* psk_identity_hint;
@@ -922,7 +922,7 @@ struct ssl_ctx_st
922922

923923
int verify_mode;
924924
uint sid_ctx_length;
925-
ubyte sid_ctx[SSL_MAX_SID_CTX_LENGTH];
925+
ubyte[SSL_MAX_SID_CTX_LENGTH] sid_ctx;
926926
ExternC!(int function(int ok,X509_STORE_CTX* ctx)) default_verify_callback; /* called 'verify_callback' in the SSL */
927927

928928
/* Default generate session ID callback. */
@@ -954,9 +954,9 @@ version(OPENSSL_NO_TLSEXT) {} else {
954954
ExternC!(int function(SSL*, int*, void*)) tlsext_servername_callback;
955955
void* tlsext_servername_arg;
956956
/* RFC 4507 session ticket keys */
957-
ubyte tlsext_tick_key_name[16];
958-
ubyte tlsext_tick_hmac_key[16];
959-
ubyte tlsext_tick_aes_key[16];
957+
ubyte[16] tlsext_tick_key_name;
958+
ubyte[16] tlsext_tick_hmac_key;
959+
ubyte[16] tlsext_tick_aes_key;
960960
/* Callback to support customisation of ticket key setting */
961961
ExternC!(int function(SSL* ssl,
962962
ubyte* name, ubyte* iv,
@@ -1267,7 +1267,7 @@ version(OPENSSL_NO_COMP) {
12671267
/* the session_id_context is used to ensure sessions are only reused
12681268
* in the appropriate context */
12691269
uint sid_ctx_length;
1270-
ubyte sid_ctx[SSL_MAX_SID_CTX_LENGTH];
1270+
ubyte[SSL_MAX_SID_CTX_LENGTH] sid_ctx;
12711271

12721272
/* This can also be in the session once a session is established */
12731273
SSL_SESSION* session;

deimos/openssl/ssl2.d

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ struct ssl2_state_st
199199

200200
/* Stuff specifically to do with this SSL session */
201201
uint challenge_length;
202-
ubyte challenge[SSL2_MAX_CHALLENGE_LENGTH];
202+
ubyte[SSL2_MAX_CHALLENGE_LENGTH] challenge;
203203
uint conn_id_length;
204-
ubyte conn_id[SSL2_MAX_CONNECTION_ID_LENGTH];
204+
ubyte[SSL2_MAX_CONNECTION_ID_LENGTH] conn_id;
205205
uint key_material_length;
206-
ubyte key_material[SSL2_MAX_KEY_MATERIAL_LENGTH*2];
206+
ubyte[SSL2_MAX_KEY_MATERIAL_LENGTH*2] key_material;
207207

208208
c_ulong read_sequence;
209209
c_ulong write_sequence;
@@ -215,7 +215,7 @@ struct ssl2_state_st
215215
uint csl;
216216
uint clear;
217217
uint enc;
218-
ubyte ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH];
218+
ubyte[SSL2_MAX_CERT_CHALLENGE_LENGTH] ccl;
219219
uint cipher_spec_length;
220220
uint session_id_length;
221221
uint clen;

0 commit comments

Comments
 (0)