X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/62f9f6c4f3408ba29d555a7ed27658bbeae270c0..ef783f91d10008e1859fc52de1fb66a5cd292320:/ec.c?ds=sidebyside diff --git a/ec.c b/ec.c index 184dc9e..9c94bee 100644 --- a/ec.c +++ b/ec.c @@ -48,13 +48,13 @@ ec_curve *eccurve_copy(ec_curve *c) return (0); a = F_OUT(f, MP_NEW, c->a); b = F_OUT(f, MP_NEW, c->b); - if (strcmp(EC_NAME(c), "prime") == 0) + if (STRCMP(EC_NAME(c), ==, "prime")) c = ec_prime(f, a, b); - else if (strcmp(EC_NAME(c), "primeproj") == 0) + else if (STRCMP(EC_NAME(c), ==, "primeproj")) c = ec_primeproj(f, a, b); - else if (strcmp(EC_NAME(c), "bin") == 0) + else if (STRCMP(EC_NAME(c), ==, "bin")) c = ec_bin(f, a, b); - else if (strcmp(EC_NAME(c), "binproj") == 0) + else if (STRCMP(EC_NAME(c), ==, "binproj")) c = ec_binproj(f, a, b); else c = 0; @@ -640,9 +640,9 @@ static PyTypeObject ecpt_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"ECPt([X, [Y]]): elliptic curve points, not associated with any curve.\n\ - X alone may be None, an existing point, a string 'X, Y', an\n\ - x-coordinate, or a pair (X, Y); X and Y should be a coordinate pair.", + "ECPt([X, [Y]]): elliptic curve points, not associated with any curve.\n" + " X alone may be None, an existing point, a string 'X, Y', an\n" + " x-coordinate, or a pair (X, Y); X and Y should be a coordinate pair.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -757,7 +757,7 @@ static PyTypeObject ecptcurve_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"Elliptic curve points; abstract base class for points on given curves.", + "Elliptic curve points; abstract base class for points on given curves.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -983,13 +983,13 @@ PyObject *eccurve_pywrap(PyObject *fobj, ec_curve *c) else Py_INCREF(fobj); assert(FIELD_F(fobj) == c->f); - if (strcmp(EC_NAME(c), "prime") == 0) + if (STRCMP(EC_NAME(c), ==, "prime")) ty = ecprimecurve_pytype; - else if (strcmp(EC_NAME(c), "primeproj") == 0) + else if (STRCMP(EC_NAME(c), ==, "primeproj")) ty = ecprimeprojcurve_pytype; - else if (strcmp(EC_NAME(c), "bin") == 0) + else if (STRCMP(EC_NAME(c), ==, "bin")) ty = ecbincurve_pytype; - else if (strcmp(EC_NAME(c), "binproj") == 0) + else if (STRCMP(EC_NAME(c), ==, "binproj")) ty = ecbinprojcurve_pytype; else abort(); @@ -1063,8 +1063,7 @@ static PyGetSetDef eccurve_pygetset[] = { static PyMethodDef eccurve_pymethods[] = { #define METHNAME(name) ecmeth_##name - METH (mmul, "\ -E.mmul([(P0, N0), (P1, N1), ...]) = N0 P0 + N1 P1 + ...") + METH (mmul, "E.mmul([(P0, N0), (P1, N1), ...]) = N0 P0 + N1 P1 + ...") METH (find, "E.find(X) -> P") KWMETH(rand, "E.rand([rng = rand]) -> P") #undef METHNAME @@ -1096,7 +1095,7 @@ static PyTypeObject eccurve_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"An elliptic curve. Abstract class.", + "An elliptic curve. Abstract class.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -1150,8 +1149,8 @@ static PyTypeObject ecprimecurve_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"ECPrimeCurve(FIELD, A, B): an elliptic curve over a prime field.\n\ - Use ECPrimeProjCurve instead.", + "ECPrimeCurve(FIELD, A, B): an elliptic curve over a prime field.\n" + " Use ECPrimeProjCurve instead.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -1205,8 +1204,8 @@ static PyTypeObject ecprimeprojcurve_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"ECPrimeProjCurve(FIELD, A, B): an elliptic curve over a prime field\n\ - using projective coordinates.", + "ECPrimeProjCurve(FIELD, A, B): an elliptic curve over a prime field\n" + " using projective coordinates.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -1260,8 +1259,8 @@ static PyTypeObject ecbincurve_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"ECBinCurve(FIELD, A, B): an elliptic curve over a binary field.\n\ - Use ECBinProjCurve instead.", + "ECBinCurve(FIELD, A, B): an elliptic curve over a binary field.\n" + " Use ECBinProjCurve instead.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -1315,8 +1314,8 @@ static PyTypeObject ecbinprojcurve_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"ECBinProjCurve(FIELD, A, B): an elliptic curve over a binary field,\n\ - using projective coordinates.", + "ECBinProjCurve(FIELD, A, B): an elliptic curve over a binary field,\n" + " using projective coordinates.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -1521,7 +1520,7 @@ static PyTypeObject ecinfo_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"ECInfo(CURVE, G, R, H): elliptic curve domain parameters.", + "ECInfo(CURVE, G, R, H): elliptic curve domain parameters.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -1548,13 +1547,13 @@ static PyTypeObject ecinfo_pytype_skel = { static PyMethodDef methods[] = { #define METHNAME(func) meth_##func - METH (_ECPt_frombuf, "frombuf(E, STR) -> (P, REST)") - METH (_ECPtCurve_fromraw, "fromraw(E, STR) -> (P, REST)") - KWMETH(_ECPtCurve_os2ecp, "os2ecp(E, STR, [flags = ...]) -> (P, REST)") - METH (_ECPt_parse, "parse(E, STR) -> (P, REST)") - METH (_ECCurve_parse, "parse(STR) -> (E, REST)") - METH (_ECInfo_parse, "parse(STR) -> (I, REST)") - METH (_ECInfo__curven, "_curven(N) -> I") + METH (_ECPt_frombuf, "frombuf(E, STR) -> (P, REST)") + METH (_ECPtCurve_fromraw, "fromraw(E, STR) -> (P, REST)") + KWMETH(_ECPtCurve_os2ecp, "os2ecp(E, STR, [flags = ...]) -> (P, REST)") + METH (_ECPt_parse, "parse(E, STR) -> (P, REST)") + METH (_ECCurve_parse, "parse(STR) -> (E, REST)") + METH (_ECInfo_parse, "parse(STR) -> (I, REST)") + METH (_ECInfo__curven, "_curven(N) -> I") #undef METHNAME { 0 } };