From 7015eff3bd1a95074a17d4a6c47d89d78a74d83a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Tue, 26 Aug 1997 10:19:16 +0200
Subject: [PATCH] Added identifier() method, that should return a DER-encoded
 ANS.1 object identifier for the algorithm.

Rev: src/modules/_Crypto/crypto.doc:1.5
Rev: src/modules/_Crypto/md5.c:1.5
---
 src/modules/_Crypto/crypto.doc |  3 +++
 src/modules/_Crypto/md5.c      | 12 ++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/modules/_Crypto/crypto.doc b/src/modules/_Crypto/crypto.doc
index 457a408ad8..8c8ea4770a 100644
--- a/src/modules/_Crypto/crypto.doc
+++ b/src/modules/_Crypto/crypto.doc
@@ -14,5 +14,8 @@ string pad(void);		/* Perform the needed padding */
 string unpad(string);		/* Unpad the string */
 string name(void);		/* Name of the algorithm */
 
+string asn1_identifier(void);   /* ASN.1 object identifier, if
+				 * one is assigned. */
+
 The padding method follows SSL, appending n random bytes,
 followed by n itself, where 0 <= n < block_size .
diff --git a/src/modules/_Crypto/md5.c b/src/modules/_Crypto/md5.c
index f21b5c02e5..f28c88bfa9 100644
--- a/src/modules/_Crypto/md5.c
+++ b/src/modules/_Crypto/md5.c
@@ -1,5 +1,5 @@
 /*
- * $Id: md5.c,v 1.4 1997/04/18 20:05:58 nisse Exp $
+ * $Id: md5.c,v 1.5 1997/08/26 08:19:16 nisse Exp $
  *
  * A pike module for getting access to some common cryptos.
  *
@@ -7,7 +7,7 @@
  *
  * Henrik Grubbstr�m 1996-10-24
  *
- * SSL dependencies purged, 1997-0227. /Niels M�ller
+ * SSL dependencies purged, 1997-02-27. /Niels M�ller
  */
 
 
@@ -61,6 +61,13 @@ static void f_update(INT32 args)
   push_object(this_object());
 }
 
+static void f_identifier(INT32 args)
+{
+  pop_n_elems(args);
+  push_string(make_shared_binary_string(
+    "\x2a\x86\x48\x86\xf7\x0d\x02\x05", 8));
+}
+
 static void f_digest(INT32 args)
 {
   struct pike_string *s;
@@ -87,5 +94,6 @@ void MOD_INIT(md5)(void)
   add_function("create", f_create, "function(void|object:void)", 0);
   add_function("update", f_update, "function(string:object)", 0);
   add_function("digest", f_digest, "function(void:string)", 0);
+  add_function("identifier", f_identifier, "function(void:string)", 0);
   end_class(MODULE_PREFIX "md5", 0);
 }
-- 
GitLab