X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/67c75893d1c2802da465c8973276096a4d862436..e5c26109231763a2464a8f8076e7b633996b5d5c:/pubkey.c diff --git a/pubkey.c b/pubkey.c index 2455275..9ec115a 100644 --- a/pubkey.c +++ b/pubkey.c @@ -119,7 +119,7 @@ static PyObject *dsameth_endhash(PyObject *me, PyObject *arg) gdsa_endhash(DSA_D(me), h); h = GH_COPY(h); rc = bytestring_pywrap(0, GH_CLASS(h)->hashsz); - GH_DONE(h, PyString_AS_STRING(rc)); + GH_DONE(h, BIN_PTR(rc)); GH_DESTROY(h); return (rc); } @@ -369,7 +369,7 @@ static PyObject *kcdsameth_endhash(PyObject *me, PyObject *arg) gkcdsa_endhash(DSA_D(me), h); h = GH_COPY(h); rc = bytestring_pywrap(0, GH_CLASS(h)->hashsz); - GH_DONE(h, PyString_AS_STRING(rc)); + GH_DONE(h, BIN_PTR(rc)); GH_DESTROY(h); return (rc); } @@ -388,7 +388,7 @@ static PyObject *kcdsameth_sign(PyObject *me, PyObject *arg, PyObject *kw) if (h.sz != DSA_D(me)->h->hashsz) VALERR("bad message length (doesn't match hash size)"); r = bytestring_pywrap(0, DSA_D(me)->h->hashsz); - s.r = (octet *)PyString_AS_STRING(r); + s.r = (octet *)BIN_PTR(r); gkcdsa_sign(DSA_D(me), &s, h.p, k); rc = Py_BuildValue("(ON)", r, mp_pywrap(s.s)); end: @@ -1156,7 +1156,7 @@ end: if (k.sz != X##_KEYSZ) VALERR("bad key length"); \ if (p.sz != X##_PUBSZ) VALERR("bad public length"); \ rc = bytestring_pywrap(0, X##_OUTSZ); \ - x((octet *)PyString_AS_STRING(rc), k.p, p.p); \ + x((octet *)BIN_PTR(rc), k.p, p.p); \ return (rc); \ end: \ return (0); \ @@ -1179,7 +1179,7 @@ XDHS(DEFXDH) if (!PyArg_ParseTuple(arg, "O&:" #ed "_pubkey", convbin, &k)) \ goto end; \ rc = bytestring_pywrap(0, ED##_PUBSZ); \ - ed##_pubkey((octet *)PyString_AS_STRING(rc), k.p, k.sz); \ + ed##_pubkey((octet *)BIN_PTR(rc), k.p, k.sz); \ return (rc); \ end: \ return (0); \ @@ -1207,7 +1207,7 @@ XDHS(DEFXDH) if (c.p && ph == -1) ph = 0; \ if (!p.p) { p.p = pp; ed##_pubkey(pp, k.p, k.sz); } \ rc = bytestring_pywrap(0, ED##_SIGSZ); \ - ed##sigver##_sign((octet *)PyString_AS_STRING(rc), k.p, k.sz, \ + ed##sigver##_sign((octet *)BIN_PTR(rc), k.p, k.sz, \ p.p, ph, c.p, c.sz, m.p, m.sz); \ return (rc); \ end: \