Annotation of parser3/src/lib/md5/pa_md5.h, revision 1.2

1.1       paf         1: /** @file
                      2:        Parser: copied from apache 1.3.20  sources.
                      3:        Replaced ap_ to pa_ prefixes. linked into all targets but Apache-module target,
                      4:        where linked targets/apache/pa_md5c.c stub instead.
                      5: 
                      6:        Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
                      7: 
1.2     ! paf         8:        $Id: pa_md5.h,v 1.1 2002/06/21 12:46:40 paf Exp $
1.1       paf         9: */
                     10: 
                     11: /*
                     12:  * This is work is derived from material Copyright RSA Data Security, Inc.
                     13:  *
                     14:  * The RSA copyright statement and Licence for that original material is
                     15:  * included below. This is followed by the Apache copyright statement and
                     16:  * licence for the modifications made to that material.
                     17:  */
                     18: 
                     19: /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
                     20:    rights reserved.
                     21: 
                     22:    License to copy and use this software is granted provided that it
                     23:    is identified as the "RSA Data Security, Inc. MD5 Message-Digest
                     24:    Algorithm" in all material mentioning or referencing this software
                     25:    or this function.
                     26: 
                     27:    License is also granted to make and use derivative works provided
                     28:    that such works are identified as "derived from the RSA Data
                     29:    Security, Inc. MD5 Message-Digest Algorithm" in all material
                     30:    mentioning or referencing the derived work.
                     31: 
                     32:    RSA Data Security, Inc. makes no representations concerning either
                     33:    the merchantability of this software or the suitability of this
                     34:    software for any particular purpose. It is provided "as is"
                     35:    without express or implied warranty of any kind.
                     36: 
                     37:    These notices must be retained in any copies of any part of this
                     38:    documentation and/or software.
                     39:  */
                     40: 
                     41: /* ====================================================================
                     42:  * Copyright (c) 1996-1999 The Apache Group.  All rights reserved.
                     43:  *
                     44:  * Redistribution and use in source and binary forms, with or without
                     45:  * modification, are permitted provided that the following conditions
                     46:  * are met:
                     47:  *
                     48:  * 1. Redistributions of source code must retain the above copyright
                     49:  *    notice, this list of conditions and the following disclaimer. 
                     50:  *
                     51:  * 2. Redistributions in binary form must reproduce the above copyright
                     52:  *    notice, this list of conditions and the following disclaimer in
                     53:  *    the documentation and/or other materials provided with the
                     54:  *    distribution.
                     55:  *
                     56:  * 3. All advertising materials mentioning features or use of this
                     57:  *    software must display the following acknowledgment:
                     58:  *    "This product includes software developed by the Apache Group
                     59:  *    for use in the Apache HTTP server project (http://www.apache.org/)."
                     60:  *
                     61:  * 4. The names "Apache Server" and "Apache Group" must not be used to
                     62:  *    endorse or promote products derived from this software without
                     63:  *    prior written permission. For written permission, please contact
                     64:  *    apache@apache.org.
                     65:  *
                     66:  * 5. Products derived from this software may not be called "Apache"
                     67:  *    nor may "Apache" appear in their names without prior written
                     68:  *    permission of the Apache Group.
                     69:  *
                     70:  * 6. Redistributions of any form whatsoever must retain the following
                     71:  *    acknowledgment:
                     72:  *    "This product includes software developed by the Apache Group
                     73:  *    for use in the Apache HTTP server project (http://www.apache.org/)."
                     74:  *
                     75:  * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
                     76:  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     77:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     78:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
                     79:  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
                     80:  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     81:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
                     82:  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     83:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
                     84:  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     85:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
                     86:  * OF THE POSSIBILITY OF SUCH DAMAGE.
                     87:  * ====================================================================
                     88:  *
                     89:  * This software consists of voluntary contributions made by many
                     90:  * individuals on behalf of the Apache Group and was originally based
                     91:  * on public domain software written at the National Center for
                     92:  * Supercomputing Applications, University of Illinois, Urbana-Champaign.
                     93:  * For more information on the Apache Group and the Apache HTTP server
                     94:  * project, please see <http://www.apache.org/>.
                     95:  *
                     96:  */
                     97: 
1.2     ! paf        98: #ifndef PA_MD5_H
        !            99: #define PA_MD5_H
1.1       paf       100: 
                    101: #define PA_API_EXPORT(rtype) rtype
                    102: 
                    103: #ifdef __cplusplus
                    104: extern "C" {
                    105: #endif
                    106: 
1.2     ! paf       107: #ifndef APACHE_MD5_H
        !           108: 
1.1       paf       109: /* MD5.H - header file for MD5C.C */
                    110: 
                    111: #define MD5_DIGESTSIZE 16
                    112: 
                    113: /* UINT4 defines a four byte word */
                    114: typedef unsigned int UINT4;
                    115: 
1.2     ! paf       116: #endif
        !           117: 
1.1       paf       118: /* MD5 context. */
                    119: typedef struct {
                    120:     UINT4 state[4];            /* state (ABCD) */
                    121:     UINT4 count[2];            /* number of bits, modulo 2^64 (lsb first) */
                    122:     unsigned char buffer[64];  /* input buffer */
                    123: } PA_MD5_CTX;
                    124: 
                    125: /*
                    126:  * Define the Magic String prefix that identifies a password as being
                    127:  * hashed using our algorithm.
                    128:  */
                    129: #define PA_MD5PW_ID "$apr1$"
                    130: #define PA_MD5PW_IDLEN 6
                    131: 
                    132: PA_API_EXPORT(void) pa_MD5Init(PA_MD5_CTX *context);
                    133: PA_API_EXPORT(void) pa_MD5Update(PA_MD5_CTX *context, const unsigned char *input,
                    134:                              unsigned int inputLen);
                    135: PA_API_EXPORT(void) pa_MD5Final(unsigned char digest[MD5_DIGESTSIZE],
                    136:                             PA_MD5_CTX *context);
                    137: PA_API_EXPORT(void) pa_MD5Encode(const unsigned char *password,
                    138:                              const unsigned char *salt,
                    139:                              char *result, size_t nbytes);
                    140: PA_API_EXPORT(void) pa_to64(char *s, unsigned long v, int n);
                    141: 
                    142: #ifdef __cplusplus
                    143: }
                    144: #endif
                    145: 
1.2     ! paf       146: #endif /* !PA_MD5_H */

E-mail: