1251876Speter/* Licensed to the Apache Software Foundation (ASF) under one or more 2251876Speter * contributor license agreements. See the NOTICE file distributed with 3251876Speter * this work for additional information regarding copyright ownership. 4251876Speter * The ASF licenses this file to You under the Apache License, Version 2.0 5251876Speter * (the "License"); you may not use this file except in compliance with 6251876Speter * the License. You may obtain a copy of the License at 7251876Speter * 8251876Speter * http://www.apache.org/licenses/LICENSE-2.0 9251876Speter * 10251876Speter * Unless required by applicable law or agreed to in writing, software 11251876Speter * distributed under the License is distributed on an "AS IS" BASIS, 12251876Speter * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13251876Speter * See the License for the specific language governing permissions and 14251876Speter * limitations under the License. 15251876Speter */ 16251876Speter/* This is derived from material copyright RSA Data Security, Inc. 17251876Speter * Their notice is reproduced below in its entirety. 18251876Speter * 19251876Speter * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All 20251876Speter * rights reserved. 21251876Speter * 22251876Speter * License to copy and use this software is granted provided that it 23251876Speter * is identified as the "RSA Data Security, Inc. MD4 Message-Digest 24251876Speter * Algorithm" in all material mentioning or referencing this software 25251876Speter * or this function. 26251876Speter * 27251876Speter * License is also granted to make and use derivative works provided 28251876Speter * that such works are identified as "derived from the RSA Data 29251876Speter * Security, Inc. MD4 Message-Digest Algorithm" in all material 30251876Speter * mentioning or referencing the derived work. 31251876Speter * 32251876Speter * RSA Data Security, Inc. makes no representations concerning either 33251876Speter * the merchantability of this software or the suitability of this 34251876Speter * software for any particular purpose. It is provided "as is" 35251876Speter * without express or implied warranty of any kind. 36251876Speter * 37251876Speter * These notices must be retained in any copies of any part of this 38251876Speter * documentation and/or software. 39251876Speter */ 40251876Speter 41251876Speter#ifndef APR_MD4_H 42251876Speter#define APR_MD4_H 43251876Speter 44251876Speter#include "apu.h" 45251876Speter#include "apr_xlate.h" 46251876Speter/** 47251876Speter * @file apr_md4.h 48251876Speter * @brief APR-UTIL MD4 Library 49251876Speter */ 50251876Speter#ifdef __cplusplus 51251876Speterextern "C" { 52251876Speter#endif 53251876Speter 54251876Speter/** 55251876Speter * @defgroup APR_Util_MD4 MD4 Library 56251876Speter * @ingroup APR_Util 57251876Speter * @{ 58251876Speter */ 59251876Speter 60251876Speter/** The digestsize for MD4 */ 61251876Speter#define APR_MD4_DIGESTSIZE 16 62251876Speter 63251876Speter/** @see apr_md4_ctx_t */ 64251876Spetertypedef struct apr_md4_ctx_t apr_md4_ctx_t; 65251876Speter 66251876Speter/** MD4 context. */ 67251876Speterstruct apr_md4_ctx_t { 68251876Speter /** state (ABCD) */ 69251876Speter apr_uint32_t state[4]; 70251876Speter /** number of bits, modulo 2^64 (lsb first) */ 71251876Speter apr_uint32_t count[2]; 72251876Speter /** input buffer */ 73251876Speter unsigned char buffer[64]; 74251876Speter#if APR_HAS_XLATE 75251876Speter /** translation handle */ 76251876Speter apr_xlate_t *xlate; 77251876Speter#endif 78251876Speter}; 79251876Speter 80251876Speter/** 81251876Speter * MD4 Initialize. Begins an MD4 operation, writing a new context. 82251876Speter * @param context The MD4 context to initialize. 83251876Speter */ 84251876SpeterAPU_DECLARE(apr_status_t) apr_md4_init(apr_md4_ctx_t *context); 85251876Speter 86251876Speter#if APR_HAS_XLATE 87251876Speter/** 88251876Speter * MDr4 translation setup. Provides the APR translation handle to be used 89251876Speter * for translating the content before calculating the digest. 90251876Speter * @param context The MD4 content to set the translation for. 91251876Speter * @param xlate The translation handle to use for this MD4 context 92251876Speter */ 93251876SpeterAPU_DECLARE(apr_status_t) apr_md4_set_xlate(apr_md4_ctx_t *context, 94251876Speter apr_xlate_t *xlate); 95251876Speter#else 96251876Speter#define apr_md4_set_xlate(context, xlate) APR_ENOTIMPL 97251876Speter#endif 98251876Speter 99251876Speter/** 100251876Speter * MD4 block update operation. Continue an MD4 message-digest operation, 101251876Speter * processing another message block, and updating the context. 102251876Speter * @param context The MD4 content to update. 103251876Speter * @param input next message block to update 104251876Speter * @param inputLen The length of the next message block 105251876Speter */ 106251876SpeterAPU_DECLARE(apr_status_t) apr_md4_update(apr_md4_ctx_t *context, 107251876Speter const unsigned char *input, 108251876Speter apr_size_t inputLen); 109251876Speter 110251876Speter/** 111251876Speter * MD4 finalization. Ends an MD4 message-digest operation, writing the 112251876Speter * message digest and zeroing the context 113251876Speter * @param digest The final MD4 digest 114251876Speter * @param context The MD4 content we are finalizing. 115251876Speter */ 116251876SpeterAPU_DECLARE(apr_status_t) apr_md4_final( 117251876Speter unsigned char digest[APR_MD4_DIGESTSIZE], 118251876Speter apr_md4_ctx_t *context); 119251876Speter 120251876Speter/** 121251876Speter * MD4 digest computation 122251876Speter * @param digest The MD4 digest 123251876Speter * @param input message block to use 124251876Speter * @param inputLen The length of the message block 125251876Speter */ 126251876SpeterAPU_DECLARE(apr_status_t) apr_md4(unsigned char digest[APR_MD4_DIGESTSIZE], 127251876Speter const unsigned char *input, 128251876Speter apr_size_t inputLen); 129251876Speter 130251876Speter/** @} */ 131251876Speter#ifdef __cplusplus 132251876Speter} 133251876Speter#endif 134251876Speter 135251876Speter#endif /* !APR_MD4_H */ 136