summaryrefslogtreecommitdiff
path: root/render/glyph.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2008-05-06 17:06:34 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2008-05-06 17:06:34 -0700
commitb6a0c6d4864f73a18beb841b16e9be56f2fcd77e (patch)
tree5b383a39a49d56884e43bb5b144e00af1046b3cb /render/glyph.c
parent718652eaf9221e0eeec2c971dd7baa97f827451b (diff)
Allow using libmd instead of libcrypto for SHA1 hashing in render/glyph.c
Builders can force one or the other by passing SHA1_LIB & SHA1_CFLAGS to configure
Diffstat (limited to 'render/glyph.c')
-rw-r--r--render/glyph.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/render/glyph.c b/render/glyph.c
index 286e39d63..de0197083 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -26,8 +26,12 @@
#include <dix-config.h>
#endif
-#include <stddef.h> /* buggy openssl/sha.h wants size_t */
-#include <openssl/sha.h>
+#ifdef HAVE_SHA1_IN_LIBMD /* Use libmd for SHA1 */
+# include <sha1.h>
+#else /* Use OpenSSL's libcrypto */
+# include <stddef.h> /* buggy openssl/sha.h wants size_t */
+# include <openssl/sha.h>
+#endif
#include "misc.h"
#include "scrnintstr.h"
@@ -202,6 +206,14 @@ 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;
int success;
@@ -220,6 +232,7 @@ HashGlyph (xGlyphInfo *gi,
success = SHA1_Final (sha1, &ctx);
if (! success)
return BadAlloc;
+#endif
return Success;
}