summaryrefslogtreecommitdiff
path: root/ext/digest/sha1/sha1ossl.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/digest/sha1/sha1ossl.c')
-rw-r--r--ext/digest/sha1/sha1ossl.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/ext/digest/sha1/sha1ossl.c b/ext/digest/sha1/sha1ossl.c
index 82a4f6f..96365c7 100644
--- a/ext/digest/sha1/sha1ossl.c
+++ b/ext/digest/sha1/sha1ossl.c
@@ -2,37 +2,17 @@
#include "defs.h"
#include "sha1ossl.h"
-#include <assert.h>
#include <stdlib.h>
-#ifndef _DIAGASSERT
-#define _DIAGASSERT(cond) assert(cond)
-#endif
-
-char *
-SHA1_End(SHA1_CTX *ctx, char *buf)
+void
+SHA1_Finish(SHA1_CTX *ctx, char *buf)
{
- int i;
- char *p = buf;
- uint8_t digest[20];
- static const char hex[]="0123456789abcdef";
-
- _DIAGASSERT(ctx != NULL);
- /* buf may be NULL */
-
- if (p == NULL && (p = malloc(41)) == NULL)
- return 0;
-
- SHA1_Final(digest,ctx);
- for (i = 0; i < 20; i++) {
- p[i + i] = hex[((uint32_t)digest[i]) >> 4];
- p[i + i + 1] = hex[digest[i] & 0x0f];
- }
- p[i + i] = '\0';
- return(p);
+ SHA1_Final(buf, ctx);
}
-int SHA1_Equal(SHA1_CTX* pctx1, SHA1_CTX* pctx2) {
+int
+SHA1_Equal(SHA1_CTX* pctx1, SHA1_CTX* pctx2)
+{
return pctx1->num == pctx2->num
&& pctx1->h0 == pctx2->h0
&& pctx1->h1 == pctx2->h1