1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-05 08:11:47 +02:00

* Optional switch "--with-openssl=<PATH>" to use OpenSSL's

implementations of MD5, SHA-1 and SHA-256.  The main benefit is that
  we get assembler-optimised implementations of MD5 and SHA-1 (though
  not SHA-256 (at least on x86), unfortunately).  OpenSSL's SHA-1
  implementation on Intel is twice as fast as ours.
This commit is contained in:
Eelco Dolstra 2006-02-13 19:52:43 +00:00
parent e8475bbd5b
commit d6f586d0ea
7 changed files with 59 additions and 40 deletions

View file

@ -56,8 +56,8 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
void
md5_init_ctx (ctx)
struct md5_ctx *ctx;
MD5_Init (ctx)
struct MD5_CTX *ctx;
{
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
@ -75,7 +75,7 @@ md5_init_ctx (ctx)
aligned for a 32 bits value. */
void *
md5_read_ctx (ctx, resbuf)
const struct md5_ctx *ctx;
const struct MD5_CTX *ctx;
void *resbuf;
{
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
@ -92,9 +92,9 @@ md5_read_ctx (ctx, resbuf)
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
void *
md5_finish_ctx (ctx, resbuf)
struct md5_ctx *ctx;
MD5_Final (resbuf, ctx)
void *resbuf;
struct MD5_CTX *ctx;
{
/* Take yet unprocessed bytes into account. */
md5_uint32 bytes = ctx->buflen;
@ -120,10 +120,10 @@ md5_finish_ctx (ctx, resbuf)
}
void
md5_process_bytes (buffer, len, ctx)
MD5_Update (ctx, buffer, len)
struct MD5_CTX *ctx;
const void *buffer;
size_t len;
struct md5_ctx *ctx;
{
/* When we already have some bits in our internal buffer concatenate
both inputs first. */
@ -210,7 +210,7 @@ void
md5_process_block (buffer, len, ctx)
const void *buffer;
size_t len;
struct md5_ctx *ctx;
struct MD5_CTX *ctx;
{
md5_uint32 correct_words[16];
const md5_uint32 *words = buffer;