len = Ustrlen(s);
DEBUG(D_acl) pdkim_quoteprint(s, len);
- exim_sha_update(&hhash_ctx, s, Ustrlen(s));
+ exim_sha_update_string(&hhash_ctx, s);
r->used = TRUE;
break;
}
goto EXPAND_FAILED;
}
- exim_sha_update(&h, sub, Ustrlen(sub));
+ exim_sha_update_string(&h, sub);
exim_sha_finish(&h, &b);
while (b.len-- > 0)
yield = string_fmt_append(yield, "%02X", *b.data++);
goto EXPAND_FAILED;
}
- exim_sha_update(&h, sub, Ustrlen(sub));
+ exim_sha_update_string(&h, sub);
exim_sha_finish(&h, &b);
while (b.len-- > 0)
yield = string_fmt_append(yield, "%02X", *b.data++);
/******************************************************************************/
#ifdef SHA_OPENSSL
+# define HAVE_PARTIAL_SHA
BOOL
exim_sha_init(hctx * h, hashmethod m)
#elif defined(SHA_GNUTLS)
+# define HAVE_PARTIAL_SHA
/******************************************************************************/
BOOL
#elif defined(SHA_GCRYPT)
+# define HAVE_PARTIAL_SHA
/******************************************************************************/
BOOL
#elif defined(SHA_POLARSSL)
+# define HAVE_PARTIAL_SHA
/******************************************************************************/
BOOL
memset(work, 0, 56);
}
else
- {
memset(work+length+1, 0, 55-length);
- }
/* The final 8 bytes of the final chunk are a 64-bit representation of the
length of the input string *bits*, before padding, high order word first, and
+#ifdef HAVE_PARTIAL_SHA
+# undef HAVE_PARTIAL_SHA
+void
+exim_sha_update_string(hctx * h, const uschar * s)
+{
+if (s) exim_sha_update(h, s, Ustrlen(s));
+}
+#endif
**************************************************
*************************************************/
-# ifdef STAND_ALONE
+#ifdef STAND_ALONE
/* Test values. The first 128 may contain binary zeros and have increasing
length. */
if (strcmp(s, atest) != 0) printf("*** No match ***\n");
}
-# endif /*STAND_ALONE*/
+#endif /*STAND_ALONE*/
/* End of File */
extern BOOL exim_sha_init(hctx *, hashmethod);
extern void exim_sha_update(hctx *, const uschar *a, int);
+extern void exim_sha_update_string(hctx *, const uschar *a);
extern void exim_sha_finish(hctx *, blob *);
#endif
rh = pdkim_relax_header(rh, TRUE); /* cook header for relaxed canon */
/* Feed header to the hash algorithm */
- exim_sha_update(&hhash_ctx, CUS rh, Ustrlen(rh));
+ exim_sha_update_string(&hhash_ctx, CUS rh);
/* Remember headers block for signing (when the library cannot do incremental) */
/*XXX we could avoid doing this for all but the GnuTLS/RSA case */
: string_copy(CUS hdrs->value);
/* Feed header to the hash algorithm */
- exim_sha_update(&hhash_ctx, CUS rh, Ustrlen(rh));
+ exim_sha_update_string(&hhash_ctx, CUS rh);
DEBUG(D_acl) pdkim_quoteprint(rh, Ustrlen(rh));
hdrs->tag = 1;
}
/* Finalize header hash */
- exim_sha_update(&hhash_ctx, CUS sig_hdr, Ustrlen(sig_hdr));
+ exim_sha_update_string(&hhash_ctx, CUS sig_hdr);
exim_sha_finish(&hhash_ctx, &hhash);
DEBUG(D_acl)
// TODO: word from server EHLO resp /* how, fer gossakes? Add item to conn_args or tls_support? */
if (conn_args->dane)
- exim_sha_update(h, CUS &conn_args->tlsa_dnsa, sizeof(dns_answer));
-exim_sha_update(h, conn_args->host->address, Ustrlen(conn_args->host->address));
+ exim_sha_update(h, CUS &conn_args->tlsa_dnsa, sizeof(dns_answer));
+exim_sha_update_string(h, conn_args->host->address);
exim_sha_update(h, CUS &conn_args->host->port, sizeof(conn_args->host->port));
-exim_sha_update(h, conn_args->sending_ip_address, Ustrlen(conn_args->sending_ip_address));
-if (openssl_options)
- exim_sha_update(h, openssl_options, Ustrlen(openssl_options));
-if (ob->tls_require_ciphers)
- exim_sha_update(h, ob->tls_require_ciphers, Ustrlen(ob->tls_require_ciphers));
-if (tlsp->sni)
- exim_sha_update(h, tlsp->sni, Ustrlen(tlsp->sni));
+exim_sha_update_string(h, conn_args->sending_ip_address);
+exim_sha_update_string(h, openssl_options);
+exim_sha_update_string(h, ob->tls_require_ciphers);
+exim_sha_update_string(h, tlsp->sni);
#ifdef EXIM_HAVE_ALPN
-if (ob->tls_alpn)
- exim_sha_update(h, ob->tls_alpn, Ustrlen(ob->tls_alpn));
+exim_sha_update_string(h, ob->tls_alpn);
#endif
exim_sha_finish(h, &b);
for (g = string_get(b.len*2+1); b.len-- > 0; )