Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/md5.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-10-01 18:38:17 +0400
committerFelix Fietkau <nbd@openwrt.org>2014-10-01 18:39:15 +0400
commitbae6bd19f32e6b8b5578a71bdcd53f735d35f0d0 (patch)
tree43b6bde26c870b1c31c284ac62fe32b5d76b0da2 /md5.h
parent6f2c688d68f57dedede87e08e74d82ac18244fa0 (diff)
md5: add a new implementation under permissive license
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'md5.h')
-rw-r--r--md5.h66
1 files changed, 44 insertions, 22 deletions
diff --git a/md5.h b/md5.h
index 6305989..b2f1b80 100644
--- a/md5.h
+++ b/md5.h
@@ -1,36 +1,58 @@
/*
- * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org>
- * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
+ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
+ * MD5 Message-Digest Algorithm (RFC 1321).
+ *
+ * Homepage:
+ * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
+ *
+ * Author:
+ * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
+ *
+ * This software was written by Alexander Peslyak in 2001. No copyright is
+ * claimed, and the software is hereby placed in the public domain.
+ * In case this attempt to disclaim copyright and place the software in the
+ * public domain is deemed null and void, then the software is
+ * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
+ * general public under the following terms:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted.
+ *
+ * There's ABSOLUTELY NO WARRANTY, express or implied.
+ *
+ * See md5.c for more information.
*/
-#ifndef __PROCD_MD5_H
-#define __PROCD_MD5_H
+#ifndef _LIBUBOX_MD5_H
+#define _LIBUBOX_MD5_H
#include <stdint.h>
#include <stddef.h>
typedef struct md5_ctx {
- uint32_t A;
- uint32_t B;
- uint32_t C;
- uint32_t D;
- uint64_t total;
- uint32_t buflen;
- char buffer[128];
+ uint32_t lo, hi;
+ uint32_t a, b, c, d;
+ unsigned char buffer[64];
} md5_ctx_t;
-void md5_begin(md5_ctx_t *ctx);
-void md5_hash(const void *data, size_t length, md5_ctx_t *ctx);
-void md5_end(void *resbuf, md5_ctx_t *ctx);
-int md5sum(char *file, uint32_t *md5);
+extern void md5_begin(md5_ctx_t *ctx);
+extern void md5_hash(const void *data, size_t length, md5_ctx_t *ctx);
+extern void md5_end(void *resbuf, md5_ctx_t *ctx);
+int md5sum(char *file, void *md5_buf);
#endif