summaryrefslogtreecommitdiffstats
path: root/cipher/sha1.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1999-02-10 17:22:40 +0100
committerWerner Koch <wk@gnupg.org>1999-02-10 17:22:40 +0100
commit9a4f506a18ed04f5dbd69d74ec0c35ade79e357a (patch)
tree07178f77cb23862b045b0edf8a2bc5ce188432cd /cipher/sha1.c
parentSee ChangeLog: Sun Jan 24 18:16:26 CET 1999 Werner Koch (diff)
downloadgnupg2-9a4f506a18ed04f5dbd69d74ec0c35ade79e357a.tar.xz
gnupg2-9a4f506a18ed04f5dbd69d74ec0c35ade79e357a.zip
See ChangeLog: Wed Feb 10 17:15:39 CET 1999 Werner Koch
Diffstat (limited to 'cipher/sha1.c')
-rw-r--r--cipher/sha1.c65
1 files changed, 63 insertions, 2 deletions
diff --git a/cipher/sha1.c b/cipher/sha1.c
index b3da296f8..04bdbac98 100644
--- a/cipher/sha1.c
+++ b/cipher/sha1.c
@@ -38,7 +38,7 @@
#include <assert.h>
#include "util.h"
#include "memory.h"
-#include "sha1.h"
+#include "dynload.h"
typedef struct {
@@ -331,7 +331,7 @@ sha1_read( SHA1_CONTEXT *hd )
* Returns: A pointer to string describing the algorithm or NULL if
* the ALGO is invalid.
*/
-const char *
+static const char *
sha1_get_info( int algo, size_t *contextsize,
byte **r_asnoid, int *r_asnlen, int *r_mdlen,
void (**r_init)( void *c ),
@@ -358,3 +358,64 @@ sha1_get_info( int algo, size_t *contextsize,
return "SHA1";
}
+
+
+#ifndef IS_MODULE
+static
+#endif
+const char * const gnupgext_version = "SHA1 ($Revision$)";
+
+static struct {
+ int class;
+ int version;
+ int value;
+ void (*func)(void);
+} func_table[] = {
+ { 10, 1, 0, (void(*)(void))sha1_get_info },
+ { 11, 1, 2 },
+};
+
+
+#ifndef IS_MODULE
+static
+#endif
+void *
+gnupgext_enum_func( int what, int *sequence, int *class, int *vers )
+{
+ void *ret;
+ int i = *sequence;
+
+ do {
+ if( i >= DIM(func_table) || i < 0 ) {
+ return NULL;
+ }
+ *class = func_table[i].class;
+ *vers = func_table[i].version;
+ switch( *class ) {
+ case 11:
+ case 21:
+ case 31:
+ ret = &func_table[i].value;
+ break;
+ default:
+ ret = func_table[i].func;
+ break;
+ }
+ i++;
+ } while( what && what != *class );
+
+ *sequence = i;
+ return ret;
+}
+
+
+
+
+#ifndef IS_MODULE
+void
+sha1_constructor(void)
+{
+ register_internal_cipher_extension( gnupgext_version, gnupgext_enum_func );
+}
+#endif
+