X-Git-Url: http://www.average.org/gitweb/?p=pam_pcsc_cr.git;a=blobdiff_plain;f=gnu_crypto.c;h=5c8621d7f2f55b7aa22b0dc366b3d01f5280e207;hp=190e9e1489494dbb3eb707eafe631b467e407f31;hb=c498f013eeb5a5decd93e5830fa61929e4c650cc;hpb=9cfb078547dfafdb01cfd87c05acffdbc07255ee diff --git a/gnu_crypto.c b/gnu_crypto.c index 190e9e1..5c8621d 100644 --- a/gnu_crypto.c +++ b/gnu_crypto.c @@ -1,3 +1,26 @@ +/* +Copyright (c) 2013 Eugene Crosser + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation + would be appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source + distribution. +*/ + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -13,8 +36,8 @@ static const char *gnu_init(void) return "gcrypt"; } -static unsigned long gnu_encrypt(void *key, int keylen, void *iv, - void *pt, void *ct, int tlen) +static unsigned long gnu_encrypt(const void *key, const int keylen, void *iv, + const void *pt, void *ct, const int tlen) { gcry_error_t err; gcry_cipher_hd_t hd; @@ -33,8 +56,8 @@ static unsigned long gnu_encrypt(void *key, int keylen, void *iv, return 0UL; } -static unsigned long gnu_decrypt(void *key, int keylen, void *iv, - void *ct, void *pt, int tlen) +static unsigned long gnu_decrypt(const void *key, const int keylen, void *iv, + const void *ct, void *pt, const int tlen) { gcry_error_t err; gcry_cipher_hd_t hd; @@ -53,7 +76,8 @@ static unsigned long gnu_decrypt(void *key, int keylen, void *iv, return 0UL; } -static unsigned long gnu_hash(void *pt, int tlen, void *tag, int *taglen) +static unsigned long gnu_hash(const void *pt, const int tlen, + void *tag, int *taglen) { gcry_error_t err; gcry_md_hd_t hd; @@ -71,7 +95,8 @@ static unsigned long gnu_hash(void *pt, int tlen, void *tag, int *taglen) return 0UL; } -static unsigned long gnu_hmac(void *key, int keylen, void *pt, int tlen, +static unsigned long gnu_hmac(const void *key, const int keylen, + const void *pt, const int tlen, void *tag, int *taglen) { gcry_error_t err; @@ -93,7 +118,7 @@ static unsigned long gnu_hmac(void *key, int keylen, void *pt, int tlen, return 0UL; } -static const char *gnu_errstr(unsigned long err) +static const char *gnu_errstr(const unsigned long err) { return gcry_strerror((gcry_error_t)err); }