00001 /* 00002 * This is work is derived from material Copyright RSA Data Security, Inc. 00003 * 00004 * The RSA copyright statement and Licence for that original material is 00005 * included below. This is followed by the Apache copyright statement and 00006 * licence for the modifications made to that material. 00007 */ 00008 00009 /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All 00010 rights reserved. 00011 00012 License to copy and use this software is granted provided that it 00013 is identified as the "RSA Data Security, Inc. MD5 Message-Digest 00014 Algorithm" in all material mentioning or referencing this software 00015 or this function. 00016 00017 License is also granted to make and use derivative works provided 00018 that such works are identified as "derived from the RSA Data 00019 Security, Inc. MD5 Message-Digest Algorithm" in all material 00020 mentioning or referencing the derived work. 00021 00022 RSA Data Security, Inc. makes no representations concerning either 00023 the merchantability of this software or the suitability of this 00024 software for any particular purpose. It is provided "as is" 00025 without express or implied warranty of any kind. 00026 00027 These notices must be retained in any copies of any part of this 00028 documentation and/or software. 00029 */ 00030 00031 /* ==================================================================== 00032 * The Apache Software License, Version 1.1 00033 * 00034 * Copyright (c) 2000-2003 The Apache Software Foundation. All rights 00035 * reserved. 00036 * 00037 * Redistribution and use in source and binary forms, with or without 00038 * modification, are permitted provided that the following conditions 00039 * are met: 00040 * 00041 * 1. Redistributions of source code must retain the above copyright 00042 * notice, this list of conditions and the following disclaimer. 00043 * 00044 * 2. Redistributions in binary form must reproduce the above copyright 00045 * notice, this list of conditions and the following disclaimer in 00046 * the documentation and/or other materials provided with the 00047 * distribution. 00048 * 00049 * 3. The end-user documentation included with the redistribution, 00050 * if any, must include the following acknowledgment: 00051 * "This product includes software developed by the 00052 * Apache Software Foundation (http://www.apache.org/)." 00053 * Alternately, this acknowledgment may appear in the software itself, 00054 * if and wherever such third-party acknowledgments normally appear. 00055 * 00056 * 4. The names "Apache" and "Apache Software Foundation" must 00057 * not be used to endorse or promote products derived from this 00058 * software without prior written permission. For written 00059 * permission, please contact apache@apache.org. 00060 * 00061 * 5. Products derived from this software may not be called "Apache", 00062 * nor may "Apache" appear in their name, without prior written 00063 * permission of the Apache Software Foundation. 00064 * 00065 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00066 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00067 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00068 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00069 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00070 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00071 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00072 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00073 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00074 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00075 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00076 * SUCH DAMAGE. 00077 * ==================================================================== 00078 * 00079 * This software consists of voluntary contributions made by many 00080 * individuals on behalf of the Apache Software Foundation. For more 00081 * information on the Apache Software Foundation, please see 00082 * <http://www.apache.org/>. 00083 */ 00084 00085 #ifndef APR_MD5_H 00086 #define APR_MD5_H 00087 00088 #include "apu.h" 00089 #include "apr_xlate.h" 00090 00091 #ifdef __cplusplus 00092 extern "C" { 00093 #endif 00094 00106 #define APR_MD5_DIGESTSIZE 16 00107 #define MD5_DIGESTSIZE APR_MD5_DIGESTSIZE 00110 typedef struct apr_md5_ctx_t apr_md5_ctx_t; 00111 00113 struct apr_md5_ctx_t { 00115 apr_uint32_t state[4]; 00117 apr_uint32_t count[2]; 00119 unsigned char buffer[64]; 00123 apr_xlate_t *xlate; 00124 }; 00125 00130 APU_DECLARE(apr_status_t) apr_md5_init(apr_md5_ctx_t *context); 00131 00138 APU_DECLARE(apr_status_t) apr_md5_set_xlate(apr_md5_ctx_t *context, 00139 apr_xlate_t *xlate); 00140 00148 APU_DECLARE(apr_status_t) apr_md5_update(apr_md5_ctx_t *context, 00149 const void *input, 00150 apr_size_t inputLen); 00151 00158 APU_DECLARE(apr_status_t) apr_md5_final(unsigned char digest[APR_MD5_DIGESTSIZE], 00159 apr_md5_ctx_t *context); 00160 00167 APU_DECLARE(apr_status_t) apr_md5(unsigned char digest[APR_MD5_DIGESTSIZE], 00168 const void *input, 00169 apr_size_t inputLen); 00170 00178 APU_DECLARE(apr_status_t) apr_md5_encode(const char *password, const char *salt, 00179 char *result, apr_size_t nbytes); 00180 00181 00187 APU_DECLARE(apr_status_t) apr_password_validate(const char *passwd, 00188 const char *hash); 00189 00190 00192 #ifdef __cplusplus 00193 } 00194 #endif 00195 00196 #endif /* !APR_MD5_H */