From 55516094947dd78ad2734bb784a2fb109b64c990 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Wed, 14 Oct 2009 23:20:44 +0200 Subject: Move SHA1 computation from render/glyph.c to os/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julien Cristau Reviewed-by: RĂ©mi Cardona --- render/glyph.c | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) (limited to 'render') diff --git a/render/glyph.c b/render/glyph.c index 7fcdfd9d1..0b864ad4d 100644 --- a/render/glyph.c +++ b/render/glyph.c @@ -26,12 +26,7 @@ #include #endif -#ifdef HAVE_SHA1_IN_LIBMD /* Use libmd for SHA1 */ -# include -#else /* Use OpenSSL's libcrypto */ -# include /* buggy openssl/sha.h wants size_t */ -# include -#endif +#include "xsha1.h" #include "misc.h" #include "scrnintstr.h" @@ -198,34 +193,21 @@ HashGlyph (xGlyphInfo *gi, unsigned long size, unsigned char sha1[20]) { -#ifdef HAVE_SHA1_IN_LIBMD /* Use libmd for SHA1 */ - SHA1_CTX ctx; - - SHA1Init (&ctx); - SHA1Update (&ctx, gi, sizeof (xGlyphInfo)); - SHA1Update (&ctx, bits, size); - SHA1Final (sha1, &ctx); -#else /* Use OpenSSL's libcrypto */ - SHA_CTX ctx; + void *ctx = x_sha1_init(); int success; - success = SHA1_Init (&ctx); - if (! success) + if (!ctx) return BadAlloc; - success = SHA1_Update (&ctx, gi, sizeof (xGlyphInfo)); - if (! success) + success = x_sha1_update(ctx, gi, sizeof(xGlyphInfo)); + if (!success) return BadAlloc; - - success = SHA1_Update (&ctx, bits, size); - if (! success) + success = x_sha1_update(ctx, bits, size); + if (!success) return BadAlloc; - - success = SHA1_Final (sha1, &ctx); - if (! success) + success = x_sha1_final(ctx, sha1); + if (!success) return BadAlloc; -#endif - return Success; } -- cgit v1.2.3