Skip to content

Commit 7876ed2

Browse files
committed
Merge pull request #10 from QAston/constfix
Make bn.d more const correct.
2 parents 7ff646a + ebea26f commit 7876ed2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

deimos/openssl/bn.d

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ version(OPENSSL_NO_DEPRECATED) {} else {
295295
enum BN_FLG_FREE = 0x8000; /* used for debuging */
296296
}
297297
void BN_set_flags()(BIGNUM* b, int n) { b.flags |= n; }
298-
int BN_get_flags()(BIGNUM* b, int n) { return b.flags & n; }
298+
int BN_get_flags()(const(BIGNUM)* b, int n) { return b.flags & n; }
299299

300300
/* get a clone of a BIGNUM with changed flags, for* temporary* use only
301301
* (the two BIGNUMs cannot not be used in parallel!) */
@@ -410,15 +410,15 @@ auto BN_prime_checks_for_size(T)(T b) {
410410
/* b >= 100 */ 27);
411411
}
412412

413-
auto BN_num_bytes()(BIGNUM* a) { return (BN_num_bits(a)+7)/8; }
413+
auto BN_num_bytes()(const(BIGNUM)* a) { return (BN_num_bits(a)+7)/8; }
414414

415415
/* Note that BN_abs_is_word didn't work reliably for w == 0 until 0.9.8 */
416-
auto BN_abs_is_word()(BIGNUM* a, BN_ULONG w) { return (((a.top == 1) && (a.d[0] == (w))) ||
416+
auto BN_abs_is_word()(const(BIGNUM)* a, BN_ULONG w) { return (((a.top == 1) && (a.d[0] == (w))) ||
417417
(((w) == 0) && (a.top == 0))); }
418-
auto BN_is_zero()(BIGNUM* a) { return (a.top == 0); }
419-
auto BN_is_one()(BIGNUM* a) { return (BN_abs_is_word((a),1) && !a.neg); }
420-
auto BN_is_word()(BIGNUM* a, BN_ULONG w) { return (BN_abs_is_word((a),(w)) && (!(w) || !a.neg)); }
421-
auto BN_is_odd()(BIGNUM* a) { return ((a.top > 0) && (a.d[0] & 1)); }
418+
auto BN_is_zero()(const(BIGNUM)* a) { return (a.top == 0); }
419+
auto BN_is_one()(const(BIGNUM)* a) { return (BN_abs_is_word((a),1) && !a.neg); }
420+
auto BN_is_word()(const(BIGNUM)* a, BN_ULONG w) { return (BN_abs_is_word((a),(w)) && (!(w) || !a.neg)); }
421+
auto BN_is_odd()(const(BIGNUM)* a) { return ((a.top > 0) && (a.d[0] & 1)); }
422422

423423
auto BN_one()(BIGNUM* a) { return BN_set_word((a),1); }
424424
auto BN_zero_ex()(BIGNUM* a) {
@@ -471,11 +471,11 @@ void BN_set_negative(BIGNUM* b, int n);
471471
* \param a pointer to the BIGNUM object
472472
* \return 1 if a < 0 and 0 otherwise
473473
*/
474-
auto BN_is_negative()(BIGNUM* a) { return a.neg != 0; }
474+
auto BN_is_negative()(const(BIGNUM)* a) { return a.neg != 0; }
475475

476476
int BN_div(BIGNUM* dv, BIGNUM* rem, const(BIGNUM)* m, const(BIGNUM)* d,
477477
BN_CTX* ctx);
478-
auto BN_mod()(BIGNUM* rem,BIGNUM* m,BIGNUM* d,BN_CTX* ctx) { return BN_div(NULL,(rem),(m),(d),(ctx)); }
478+
auto BN_mod()(BIGNUM* rem,const(BIGNUM)* m,const(BIGNUM)* d,BN_CTX* ctx) { return BN_div(null,(rem),(m),(d),(ctx)); }
479479
int BN_nnmod(BIGNUM* r, const(BIGNUM)* m, const(BIGNUM)* d, BN_CTX* ctx);
480480
int BN_mod_add(BIGNUM* r, const(BIGNUM)* a, const(BIGNUM)* b, const(BIGNUM)* m, BN_CTX* ctx);
481481
int BN_mod_add_quick(BIGNUM* r, const(BIGNUM)* a, const(BIGNUM)* b, const(BIGNUM)* m);

0 commit comments

Comments
 (0)