summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/md4/md4_dgst.c
diff options
context:
space:
mode:
authorjsing <>2023-07-08 06:39:19 +0000
committerjsing <>2023-07-08 06:39:19 +0000
commitf7eed39f47d6159302020860d39a54a3bfcf5d2e (patch)
treeb36e64cc84964abfe63cbb353b8ab367504bcf62 /src/lib/libcrypto/md4/md4_dgst.c
parent8c4ca6bf7bf488ca8360a75710452552ae1bb148 (diff)
downloadopenbsd-f7eed39f47d6159302020860d39a54a3bfcf5d2e.tar.gz
openbsd-f7eed39f47d6159302020860d39a54a3bfcf5d2e.tar.bz2
openbsd-f7eed39f47d6159302020860d39a54a3bfcf5d2e.zip
Inline md4_local.h in md4_dgst.c.
md4_local.h is not really a local header, just another layer of indirection that cannot be included by anything other than md4_dgst.c. As such, include it directly instead. No change in generated assembly.
Diffstat (limited to 'src/lib/libcrypto/md4/md4_dgst.c')
-rw-r--r--src/lib/libcrypto/md4/md4_dgst.c58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/lib/libcrypto/md4/md4_dgst.c b/src/lib/libcrypto/md4/md4_dgst.c
index aa7b7f7931..7ff258d8bd 100644
--- a/src/lib/libcrypto/md4/md4_dgst.c
+++ b/src/lib/libcrypto/md4/md4_dgst.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: md4_dgst.c,v 1.17 2022/11/26 16:08:53 tb Exp $ */ 1/* $OpenBSD: md4_dgst.c,v 1.18 2023/07/08 06:39:19 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -59,7 +59,61 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <openssl/opensslv.h> 60#include <openssl/opensslv.h>
61#include <openssl/crypto.h> 61#include <openssl/crypto.h>
62#include "md4_local.h" 62
63#include <stdlib.h>
64#include <string.h>
65#include <openssl/opensslconf.h>
66#include <openssl/md4.h>
67
68__BEGIN_HIDDEN_DECLS
69
70void md4_block_data_order (MD4_CTX *c, const void *p,size_t num);
71
72__END_HIDDEN_DECLS
73
74#define DATA_ORDER_IS_LITTLE_ENDIAN
75
76#define HASH_LONG MD4_LONG
77#define HASH_CTX MD4_CTX
78#define HASH_CBLOCK MD4_CBLOCK
79#define HASH_UPDATE MD4_Update
80#define HASH_TRANSFORM MD4_Transform
81#define HASH_FINAL MD4_Final
82#define HASH_MAKE_STRING(c,s) do { \
83 unsigned long ll; \
84 ll=(c)->A; HOST_l2c(ll,(s)); \
85 ll=(c)->B; HOST_l2c(ll,(s)); \
86 ll=(c)->C; HOST_l2c(ll,(s)); \
87 ll=(c)->D; HOST_l2c(ll,(s)); \
88 } while (0)
89#define HASH_BLOCK_DATA_ORDER md4_block_data_order
90
91#include "md32_common.h"
92
93/*
94#define F(x,y,z) (((x) & (y)) | ((~(x)) & (z)))
95#define G(x,y,z) (((x) & (y)) | ((x) & ((z))) | ((y) & ((z))))
96*/
97
98/* As pointed out by Wei Dai <weidai@eskimo.com>, the above can be
99 * simplified to the code below. Wei attributes these optimizations
100 * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel.
101 */
102#define F(b,c,d) ((((c) ^ (d)) & (b)) ^ (d))
103#define G(b,c,d) (((b) & (c)) | ((b) & (d)) | ((c) & (d)))
104#define H(b,c,d) ((b) ^ (c) ^ (d))
105
106#define R0(a,b,c,d,k,s,t) { \
107 a+=((k)+(t)+F((b),(c),(d))); \
108 a=ROTATE(a,s); };
109
110#define R1(a,b,c,d,k,s,t) { \
111 a+=((k)+(t)+G((b),(c),(d))); \
112 a=ROTATE(a,s); };\
113
114#define R2(a,b,c,d,k,s,t) { \
115 a+=((k)+(t)+H((b),(c),(d))); \
116 a=ROTATE(a,s); };
63 117
64/* Implemented from RFC1186 The MD4 Message-Digest Algorithm 118/* Implemented from RFC1186 The MD4 Message-Digest Algorithm
65 */ 119 */