X-Git-Url: https://git.exim.org/users/heiko/exim.git/blobdiff_plain/db3f7b6972f3b003c0413b78afcfbe295ffe0b97..bf13aee1aa701b1d838a09abd25ded986069e2ef:/src/src/hash.c diff --git a/src/src/hash.c b/src/src/hash.c index eea2cb8a3..f1a6c4096 100644 --- a/src/src/hash.c +++ b/src/src/hash.c @@ -33,7 +33,6 @@ sha1; BOOL exim_sha_init(hctx * h, hashmethod m) { -/*XXX extend for sha512 */ switch (h->method = m) { case HASH_SHA1: h->hashlen = 20; SHA1_Init (&h->u.sha1); break; @@ -85,7 +84,8 @@ switch (h->method) void exim_sha_finish(hctx * h, blob * b) { -b->data = store_get(b->len = h->hashlen); +/* Hashing is sufficient to purify any tainted input */ +b->data = store_get(b->len = h->hashlen, FALSE); switch (h->method) { case HASH_SHA1: SHA1_Final (b->data, &h->u.sha1); break; @@ -110,7 +110,6 @@ switch (h->method) BOOL exim_sha_init(hctx * h, hashmethod m) { -/*XXX extend for sha512 */ switch (h->method = m) { case HASH_SHA1: h->hashlen = 20; gnutls_hash_init(&h->sha, GNUTLS_DIG_SHA1); break; @@ -139,7 +138,7 @@ gnutls_hash(h->sha, data, len); void exim_sha_finish(hctx * h, blob * b) { -b->data = store_get(b->len = h->hashlen); +b->data = store_get(b->len = h->hashlen, FALSE); gnutls_hash_output(h->sha, b->data); } @@ -151,7 +150,6 @@ gnutls_hash_output(h->sha, b->data); BOOL exim_sha_init(hctx * h, hashmethod m) { -/*XXX extend for sha512 */ switch (h->method = m) { case HASH_SHA1: h->hashlen = 20; gcry_md_open(&h->sha, GCRY_MD_SHA1, 0); break; @@ -177,7 +175,7 @@ gcry_md_write(h->sha, data, len); void exim_sha_finish(hctx * h, blob * b) { -b->data = store_get(b->len = h->hashlen); +b->data = store_get(b->len = h->hashlen, FALSE); memcpy(b->data, gcry_md_read(h->sha, 0), h->hashlen); } @@ -215,7 +213,7 @@ switch (h->method) void exim_sha_finish(hctx * h, blob * b) { -b->data = store_get(b->len = h->hashlen); +b->data = store_get(b->len = h->hashlen, FALSE); switch (h->method) { case HASH_SHA1: sha1_finish(h->u.sha1, b->data); break; @@ -453,7 +451,7 @@ native_sha1_mid(&h->sha1, US data); /* implicit size always 64 */ void exim_sha_finish(hctx * h, blob * b) { -b->data = store_get(b->len = h->hashlen); +b->data = store_get(b->len = h->hashlen, FALSE); native_sha1_end(&h->sha1, NULL, 0, b->data); }