X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fsrc%2Fpdkim%2Fsha1.h;h=29a9070eb0faf8788961c04ca684a1ee41a9031d;hb=3a2ac12bcabf06f73ef372dfa23e6edead237aa7;hp=0349be5d2d6b2e84b8b163c7615c357c98affefc;hpb=80a47a2c9633437d4ceebd214cd44abfbd4f4543;p=exim.git diff --git a/src/src/pdkim/sha1.h b/src/src/pdkim/sha1.h index 0349be5d2..29a9070eb 100644 --- a/src/src/pdkim/sha1.h +++ b/src/src/pdkim/sha1.h @@ -1,9 +1,12 @@ /** * \file sha1.h * - * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine + * Copyright (C) 2006-2010, Brainspark B.V. * - * Copyright (C) 2009 Paul Bakker + * This file is part of PolarSSL (http://www.polarssl.org) + * Lead Maintainer: Paul Bakker + * + * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,8 +23,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/* $Cambridge: exim/src/src/pdkim/sha1.h,v 1.2 2009/06/10 07:34:05 tom Exp $ */ - #ifndef POLARSSL_SHA1_H #define POLARSSL_SHA1_H @@ -61,7 +62,7 @@ void sha1_starts( sha1_context *ctx ); * \param input buffer holding the data * \param ilen length of the input data */ -void sha1_update( sha1_context *ctx, unsigned char *input, int ilen ); +void sha1_update( sha1_context *ctx, const unsigned char *input, int ilen ); /** * \brief SHA-1 final digest @@ -78,7 +79,7 @@ void sha1_finish( sha1_context *ctx, unsigned char output[20] ); * \param ilen length of the input data * \param output SHA-1 checksum result */ -void sha1_oneshot( unsigned char *input, int ilen, unsigned char output[20] ); +void sha1( const unsigned char *input, int ilen, unsigned char output[20] ); /** * \brief Output = SHA-1( file contents ) @@ -89,7 +90,7 @@ void sha1_oneshot( unsigned char *input, int ilen, unsigned char output[20] ); * \return 0 if successful, 1 if fopen failed, * or 2 if fread failed */ -int sha1_file( char *path, unsigned char output[20] ); +int sha1_file( const char *path, unsigned char output[20] ); /** * \brief SHA-1 HMAC context setup @@ -98,7 +99,7 @@ int sha1_file( char *path, unsigned char output[20] ); * \param key HMAC secret key * \param keylen length of the HMAC key */ -void sha1_hmac_starts( sha1_context *ctx, unsigned char *key, int keylen ); +void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, int keylen ); /** * \brief SHA-1 HMAC process buffer @@ -107,7 +108,7 @@ void sha1_hmac_starts( sha1_context *ctx, unsigned char *key, int keylen ); * \param input buffer holding the data * \param ilen length of the input data */ -void sha1_hmac_update( sha1_context *ctx, unsigned char *input, int ilen ); +void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, int ilen ); /** * \brief SHA-1 HMAC final digest @@ -117,6 +118,13 @@ void sha1_hmac_update( sha1_context *ctx, unsigned char *input, int ilen ); */ void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] ); +/** + * \brief SHA-1 HMAC context reset + * + * \param ctx HMAC context to be reset + */ +void sha1_hmac_reset( sha1_context *ctx ); + /** * \brief Output = HMAC-SHA-1( hmac key, input buffer ) * @@ -126,8 +134,8 @@ void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] ); * \param ilen length of the input data * \param output HMAC-SHA-1 result */ -void sha1_hmac( unsigned char *key, int keylen, - unsigned char *input, int ilen, +void sha1_hmac( const unsigned char *key, int keylen, + const unsigned char *input, int ilen, unsigned char output[20] ); #ifdef __cplusplus