diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2017-09-11 16:10:52 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2017-09-20 17:14:13 +0200 |
commit | deaaabb5ec90b668c6f051fb7247d170eace5fda (patch) | |
tree | a1f84c208cf6bf962989d4a19d42fd96663f0c13 | |
parent | 467b5258705360e36406cb8eb2fe98eec1d59909 (diff) | |
download | m2crypto-deaaabb5ec90b668c6f051fb7247d170eace5fda.tar.gz |
Fix use of 'const BIGNUM' in calls to getters and setters.
-rw-r--r-- | SWIG/_dh.i | 8 | ||||
-rw-r--r-- | SWIG/_dsa.i | 20 | ||||
-rw-r--r-- | SWIG/_ec.i | 4 | ||||
-rw-r--r-- | SWIG/_evp.i | 2 | ||||
-rw-r--r-- | SWIG/_lib.i | 6 | ||||
-rw-r--r-- | SWIG/_rsa.i | 6 | ||||
-rw-r--r-- | SWIG/_x509.i | 4 |
7 files changed, 25 insertions, 25 deletions
@@ -125,7 +125,7 @@ PyObject *dh_compute_key(DH *dh, PyObject *pubkey) { } PyObject *dh_get_p(DH *dh) { - BIGNUM* p = NULL; + const BIGNUM* p = NULL; DH_get0_pqg(dh, &p, NULL, NULL); if (!p) { PyErr_SetString(_dh_err, "'p' is unset"); @@ -135,7 +135,7 @@ PyObject *dh_get_p(DH *dh) { } PyObject *dh_get_g(DH *dh) { - BIGNUM* g = NULL; + const BIGNUM* g = NULL; DH_get0_pqg(dh, NULL, NULL, &g); if (!g) { PyErr_SetString(_dh_err, "'g' is unset"); @@ -145,7 +145,7 @@ PyObject *dh_get_g(DH *dh) { } PyObject *dh_get_pub(DH *dh) { - BIGNUM* pub_key = NULL; + const BIGNUM* pub_key = NULL; DH_get0_key(dh, &pub_key, NULL); if (!pub_key) { PyErr_SetString(_dh_err, "'pub' is unset"); @@ -155,7 +155,7 @@ PyObject *dh_get_pub(DH *dh) { } PyObject *dh_get_priv(DH *dh) { - BIGNUM* priv_key = NULL; + const BIGNUM* priv_key = NULL; DH_get0_key(dh, NULL, &priv_key); if (!priv_key) { PyErr_SetString(_dh_err, "'priv' is unset"); diff --git a/SWIG/_dsa.i b/SWIG/_dsa.i index ad712c4..d6ed51d 100644 --- a/SWIG/_dsa.i +++ b/SWIG/_dsa.i @@ -8,13 +8,13 @@ #include <openssl/dsa.h> PyObject *dsa_sig_get_r(DSA_SIG *dsa_sig) { - BIGNUM* pr; + const BIGNUM* pr; DSA_SIG_get0(dsa_sig, &pr, NULL); return bn_to_mpi(pr); } PyObject *dsa_sig_get_s(DSA_SIG *dsa_sig) { - BIGNUM* qs; + const BIGNUM* qs; DSA_SIG_get0(dsa_sig, NULL, &qs); return bn_to_mpi(qs); } @@ -67,7 +67,7 @@ DSA *dsa_generate_parameters(int bits, PyObject *pyfunc) { } PyObject *dsa_get_p(DSA *dsa) { - BIGNUM* p = NULL; + const BIGNUM* p = NULL; DSA_get0_pqg(dsa, &p, NULL, NULL); if (!p) { PyErr_SetString(_dsa_err, "'p' is unset"); @@ -77,7 +77,7 @@ PyObject *dsa_get_p(DSA *dsa) { } PyObject *dsa_get_q(DSA *dsa) { - BIGNUM* q = NULL; + const BIGNUM* q = NULL; DSA_get0_pqg(dsa, NULL, &q, NULL); if (!q) { PyErr_SetString(_dsa_err, "'q' is unset"); @@ -87,7 +87,7 @@ PyObject *dsa_get_q(DSA *dsa) { } PyObject *dsa_get_g(DSA *dsa) { - BIGNUM* g = NULL; + const BIGNUM* g = NULL; DSA_get0_pqg(dsa, NULL, NULL, &g); if (!g) { PyErr_SetString(_dsa_err, "'g' is unset"); @@ -97,7 +97,7 @@ PyObject *dsa_get_g(DSA *dsa) { } PyObject *dsa_get_pub(DSA *dsa) { - BIGNUM* pub_key = NULL; + const BIGNUM* pub_key = NULL; DSA_get0_key(dsa, &pub_key, NULL); if (!pub_key) { PyErr_SetString(_dsa_err, "'pub' is unset"); @@ -107,7 +107,7 @@ PyObject *dsa_get_pub(DSA *dsa) { } PyObject *dsa_get_priv(DSA *dsa) { - BIGNUM* priv_key = NULL; + const BIGNUM* priv_key = NULL; DSA_get0_key(dsa, NULL, &priv_key); if (!priv_key) { PyErr_SetString(_dsa_err, "'priv' is unset"); @@ -347,19 +347,19 @@ int dsa_verify_asn1(DSA *dsa, PyObject *value, PyObject *sig) { } int dsa_check_key(DSA *dsa) { - BIGNUM* pub_key, *priv_key; + const BIGNUM* pub_key, *priv_key; DSA_get0_key(dsa, &pub_key, &priv_key); return pub_key != NULL && priv_key != NULL; } int dsa_check_pub_key(DSA *dsa) { - BIGNUM* pub_key; + const BIGNUM* pub_key; DSA_get0_key(dsa, &pub_key, NULL); return pub_key ? 1 : 0; } int dsa_keylen(DSA *dsa) { - BIGNUM* p; + const BIGNUM* p; DSA_get0_pqg(dsa, &p, NULL, NULL); return BN_num_bits(p); } @@ -348,13 +348,13 @@ int ec_key_write_bio_no_cipher(EC_KEY *key, BIO *f, PyObject *pyfunc) { PyObject *ecdsa_sig_get_r(ECDSA_SIG *ecdsa_sig) { - BIGNUM* pr; + const BIGNUM* pr; ECDSA_SIG_get0(ecdsa_sig, &pr, NULL); return bn_to_mpi(pr); } PyObject *ecdsa_sig_get_s(ECDSA_SIG *ecdsa_sig) { - BIGNUM* ps; + const BIGNUM* ps; ECDSA_SIG_get0(ecdsa_sig, NULL, &ps); return bn_to_mpi(ps); } diff --git a/SWIG/_evp.i b/SWIG/_evp.i index 3d8f4b0..100783c 100644 --- a/SWIG/_evp.i +++ b/SWIG/_evp.i @@ -641,7 +641,7 @@ PyObject *pkey_get_modulus(EVP_PKEY *pkey) BIO *bio; BUF_MEM *bptr; PyObject *ret; - BIGNUM* bn; + const BIGNUM* bn; switch (EVP_PKEY_base_id(pkey)) { case EVP_PKEY_RSA: diff --git a/SWIG/_lib.i b/SWIG/_lib.i index 135bfac..85771f6 100644 --- a/SWIG/_lib.i +++ b/SWIG/_lib.i @@ -494,7 +494,7 @@ void lib_init() { /* Bignum routines that aren't not numerous enough to warrant a separate file. */ -PyObject *bn_to_mpi(BIGNUM *bn) { +PyObject *bn_to_mpi(const BIGNUM *bn) { int len; unsigned char *mpi; PyObject *pyo; @@ -583,7 +583,7 @@ PyObject *bn_to_hex(BIGNUM *bn) { return pyo; } -const BIGNUM *hex_to_bn(PyObject *value) { +BIGNUM *hex_to_bn(PyObject *value) { const void *vbuf; Py_ssize_t vlen; BIGNUM *bn; @@ -604,7 +604,7 @@ const BIGNUM *hex_to_bn(PyObject *value) { return bn; } -const BIGNUM *dec_to_bn(PyObject *value) { +BIGNUM *dec_to_bn(PyObject *value) { const void *vbuf; Py_ssize_t vlen; BIGNUM *bn; diff --git a/SWIG/_rsa.i b/SWIG/_rsa.i index 1a3b182..cfea61c 100644 --- a/SWIG/_rsa.i +++ b/SWIG/_rsa.i @@ -104,7 +104,7 @@ int rsa_write_pub_key(RSA *rsa, BIO *f) { } PyObject *rsa_get_e(RSA *rsa) { - BIGNUM* e = NULL; + const BIGNUM* e = NULL; RSA_get0_key(rsa, NULL, &e, NULL); if (!e) { PyErr_SetString(_rsa_err, "'e' is unset"); @@ -114,7 +114,7 @@ PyObject *rsa_get_e(RSA *rsa) { } PyObject *rsa_get_n(RSA *rsa) { - BIGNUM* n = NULL; + const BIGNUM* n = NULL; RSA_get0_key(rsa, &n, NULL, NULL); if (!n) { PyErr_SetString(_rsa_err, "'n' is unset"); @@ -461,7 +461,7 @@ int rsa_type_check(RSA *rsa) { } int rsa_check_pub_key(RSA *rsa) { - BIGNUM* n, *e; + const BIGNUM* n, *e; RSA_get0_key(rsa, &n, &e, NULL); return n && e; } diff --git a/SWIG/_x509.i b/SWIG/_x509.i index 9bcef20..c0c6a20 100644 --- a/SWIG/_x509.i +++ b/SWIG/_x509.i @@ -493,10 +493,10 @@ int x509_name_add_entry_by_txt(X509_NAME *name, char *field, int type, char *byt PyObject *x509_name_get_der(X509_NAME *name) { - const char* pder; + const char* pder=""; size_t pderlen; i2d_X509_NAME(name, 0); - if (!X509_NAME_get0_der(&pder, &pderlen, name)) { + if (!X509_NAME_get0_der(name, (const unsigned char **)pder, &pderlen)) { PyErr_SetString(_x509_err, ERR_reason_error_string(ERR_get_error())); return NULL; } |