From: jsing Date: Sat, 8 Jul 2023 07:49:45 +0000 (+0000) Subject: Inline HASH_MAKE_STRING macro. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f7bb1d805c4329042f293cff20b2eaaccba603ff;p=openbsd Inline HASH_MAKE_STRING macro. No change to generated assembly. --- diff --git a/lib/libcrypto/sha/sha1.c b/lib/libcrypto/sha/sha1.c index a8c250dc6ef..a0ec259f7e8 100644 --- a/lib/libcrypto/sha/sha1.c +++ b/lib/libcrypto/sha/sha1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sha1.c,v 1.7 2023/07/08 07:43:44 jsing Exp $ */ +/* $OpenBSD: sha1.c,v 1.8 2023/07/08 07:49:45 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -72,15 +72,6 @@ #define HASH_CTX SHA_CTX #define HASH_CBLOCK SHA_CBLOCK -#define HASH_MAKE_STRING(c, s) do { \ - unsigned long ll; \ - ll=(c)->h0; HOST_l2c(ll,(s)); \ - ll=(c)->h1; HOST_l2c(ll,(s)); \ - ll=(c)->h2; HOST_l2c(ll,(s)); \ - ll=(c)->h3; HOST_l2c(ll,(s)); \ - ll=(c)->h4; HOST_l2c(ll,(s)); \ - } while (0) - #define HASH_BLOCK_DATA_ORDER sha1_block_data_order #define Xupdate(a, ix, ia, ib, ic, id) ( (a)=(ia^ib^ic^id), \ ix=(a)=ROTATE((a),1) \ @@ -528,11 +519,19 @@ SHA1_Final(unsigned char *md, SHA_CTX *c) c->num = 0; memset(p, 0, SHA_CBLOCK); -#ifndef HASH_MAKE_STRING -#error "HASH_MAKE_STRING must be defined!" -#else - HASH_MAKE_STRING(c, md); -#endif + do { + unsigned long ll; + ll = c->h0; + HOST_l2c(ll, md); + ll = c->h1; + HOST_l2c(ll, md); + ll = c->h2; + HOST_l2c(ll, md); + ll = c->h3; + HOST_l2c(ll, md); + ll = c->h4; + HOST_l2c(ll, md); + } while (0); return 1; }