mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
Move SHA1 computation from render/glyph.c to os/
Signed-off-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Rémi Cardona <remi@gentoo.org>
This commit is contained in:
@@ -26,12 +26,7 @@
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#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 "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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user