summaryrefslogtreecommitdiff
path: root/digest-libc.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2021-12-22 19:33:10 +1100
committerDarren Tucker <dtucker@dtucker.net>2021-12-23 11:36:08 +1100
commit1c9853a68b2319f2e5f929179735e8fbb9988a67 (patch)
treee7863f56620e2c4847a32da34a06cbf4b3494225 /digest-libc.c
parent715c892f0a5295b391ae92c26ef4d6a86ea96e8e (diff)
downloadopenssh-git-1c9853a68b2319f2e5f929179735e8fbb9988a67.tar.gz
Use SHA.*_HMAC_BLOCK_SIZE if needed.
If the platform has a native SHA2, does not define SHA.*_BLOCK_LENGTH but does define SHA.*_HMAC_BLOCK_SIZE (eg Solaris) then use the latter. Should fix --without-openssl build on Solaris.
Diffstat (limited to 'digest-libc.c')
-rw-r--r--digest-libc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/digest-libc.c b/digest-libc.c
index 86a1dbf2..6e77a449 100644
--- a/digest-libc.c
+++ b/digest-libc.c
@@ -36,6 +36,16 @@
#include <sha2.h>
#endif
+#if !defined(SHA256_BLOCK_LENGTH) && defined(SHA256_HMAC_BLOCK_SIZE)
+#define SHA256_BLOCK_LENGTH SHA256_HMAC_BLOCK_SIZE
+#endif
+#if !defined(SHA384_BLOCK_LENGTH) && defined(SHA512_HMAC_BLOCK_SIZE)
+#define SHA384_BLOCK_LENGTH SHA512_HMAC_BLOCK_SIZE
+#endif
+#if !defined(SHA512_BLOCK_LENGTH) && defined(SHA512_HMAC_BLOCK_SIZE)
+#define SHA512_BLOCK_LENGTH SHA512_HMAC_BLOCK_SIZE
+#endif
+
#include "ssherr.h"
#include "sshbuf.h"
#include "digest.h"