Inline HASH_MAKE_STRING macro.
authorjsing <jsing@openbsd.org>
Sat, 8 Jul 2023 07:49:45 +0000 (07:49 +0000)
committerjsing <jsing@openbsd.org>
Sat, 8 Jul 2023 07:49:45 +0000 (07:49 +0000)
No change to generated assembly.

lib/libcrypto/sha/sha1.c

index a8c250d..a0ec259 100644 (file)
@@ -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.
  *
 #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;
 }