X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fsrc%2Fpdkim%2Fsha1.h;h=29a9070eb0faf8788961c04ca684a1ee41a9031d;hb=3a2ac12bcabf06f73ef372dfa23e6edead237aa7;hp=677e5418f37f3afbcce48732c283687c5cc0ec0b;hpb=67932e542eb65f681779f5d49974afe8369a9b9a;p=exim.git diff --git a/src/src/pdkim/sha1.h b/src/src/pdkim/sha1.h index 677e5418f..29a9070eb 100644 --- a/src/src/pdkim/sha1.h +++ b/src/src/pdkim/sha1.h @@ -1,10 +1,12 @@ /** * \file sha1.h * - * Copyright (C) 2006-2009, Paul Bakker - * All rights reserved. + * Copyright (C) 2006-2010, Brainspark B.V. + * + * This file is part of PolarSSL (http://www.polarssl.org) + * Lead Maintainer: Paul Bakker * - * Joined copyright on original XySSL code with: Christophe Devine + * 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 @@ -21,15 +23,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/* $Cambridge: exim/src/src/pdkim/sha1.h,v 1.3 2009/12/07 13:05:07 tom Exp $ */ - #ifndef POLARSSL_SHA1_H #define POLARSSL_SHA1_H /** * \brief SHA-1 context structure */ - #ifndef HAVE_SHA1_CONTEXT #define HAVE_SHA1_CONTEXT typedef struct sha1_context sha1_context; @@ -45,7 +44,6 @@ struct sha1_context unsigned char opad[64]; /*!< HMAC: outer padding */ }; - #ifdef __cplusplus extern "C" { #endif @@ -64,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 @@ -81,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( 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 ) @@ -92,7 +90,7 @@ void sha1( 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 @@ -101,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 @@ -110,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 @@ -120,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 ) * @@ -129,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