summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-10-19 14:59:03 -0400
committerSimo Sorce <simo@redhat.com>2013-10-23 08:53:08 -0400
commit3d372dfa045cf6bed5d548d86bce57db8241b9ec (patch)
tree084e7d421347233130652bb4eaaeb82e6a01a8bf /src
parent18f1004c1083cc3988f869e84102568731fbb901 (diff)
downloadgss-ntlmssp-3d372dfa045cf6bed5d548d86bce57db8241b9ec.tar.gz
gss-ntlmssp-3d372dfa045cf6bed5d548d86bce57db8241b9ec.tar.xz
gss-ntlmssp-3d372dfa045cf6bed5d548d86bce57db8241b9ec.zip
Add CRC32 function using Zlib's crc32
Diffstat (limited to 'src')
-rw-r--r--src/crypto.c6
-rw-r--r--src/crypto.h10
2 files changed, 16 insertions, 0 deletions
diff --git a/src/crypto.c b/src/crypto.c
index aabd399..8074d4b 100644
--- a/src/crypto.c
+++ b/src/crypto.c
@@ -22,6 +22,7 @@
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/rand.h>
+#include <zlib.h>
#include "crypto.h"
@@ -299,3 +300,8 @@ int DESL(struct ntlm_buffer *key,
return 0;
}
+
+uint32_t CRC32(uint32_t crc, struct ntlm_buffer *payload)
+{
+ return crc32(crc, payload->data, payload->length);
+}
diff --git a/src/crypto.h b/src/crypto.h
index 9f2448a..87ff830 100644
--- a/src/crypto.h
+++ b/src/crypto.h
@@ -153,4 +153,14 @@ int DESL(struct ntlm_buffer *key,
struct ntlm_buffer *payload,
struct ntlm_buffer *result);
+/**
+ * @brief The CRC32 checksum
+ *
+ * @param crc Initial crc, usually 0
+ * @param payload The data to checksum
+ *
+ * @return The resulting CRC.
+ */
+uint32_t CRC32(uint32_t crc, struct ntlm_buffer *payload);
+
#endif /* _SRC_CRYPTO_H_ */