summaryrefslogtreecommitdiff
path: root/src/hash_template.c
diff options
context:
space:
mode:
authorLegrandin <gooksankoo@hoiptorrow.mailexpire.com>2011-02-03 01:21:12 +0100
committerLegrandin <gooksankoo@hoiptorrow.mailexpire.com>2011-02-03 01:35:46 +0100
commit0d14809acd61782e1e024ca7119b6e4b10dcf7fc (patch)
tree524a623d95111970732537e1c25f6e1ae0bb8421 /src/hash_template.c
parent1a51197542f0e22f145a3ba9cbd090a602e05132 (diff)
downloadpycrypto-0d14809acd61782e1e024ca7119b6e4b10dcf7fc.tar.gz
Add OID to each hash algorithm.
Diffstat (limited to 'src/hash_template.c')
-rw-r--r--src/hash_template.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/hash_template.c b/src/hash_template.c
index 78e37be..1ddaab2 100644
--- a/src/hash_template.c
+++ b/src/hash_template.c
@@ -166,12 +166,18 @@ static PyMethodDef ALG_methods[] = {
{NULL, NULL} /* sentinel */
};
+#ifndef DER_OID
+#define DER_OID ""
+#define DER_OID_SIZE 0
+#endif
+
static PyObject *
ALG_getattr(PyObject *self, char *name)
{
if (strcmp(name, "digest_size")==0)
return PyInt_FromLong(DIGEST_SIZE);
-
+ if (strcmp(name, "oid")==0)
+ return PyString_FromStringAndSize(DER_OID, DER_OID_SIZE);
return Py_FindMethod(ALG_methods, self, name);
}