X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Flib%2Fhmac.c;h=1da98c2bf3fdd06251ed207f19012b47a53d4c6b;hb=897707854a8240d026e933215009f931bb9c5762;hp=bb8e46508f0a538e71145334484f589659b31494;hpb=1ef84681d13d0c355d6ae78579d2afe1c8d8d0e2;p=bacula%2Fbacula diff --git a/bacula/src/lib/hmac.c b/bacula/src/lib/hmac.c index bb8e46508f..1da98c2bf3 100644 --- a/bacula/src/lib/hmac.c +++ b/bacula/src/lib/hmac.c @@ -2,41 +2,51 @@ * Hashed Message Authentication Code using MD5 (HMAC-MD5) * * hmac_md5 was based on sample code in RFC2104 (thanks guys). - * + * * Adapted to Bacula by Kern E. Sibbald, February MMI. + * + * Version $Id$ */ /* - Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + Bacula® - The Network Backup Solution + + Copyright (C) 2001-2006 Free Software Foundation Europe e.V. - 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 the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version two of the GNU Lesser General + Public License as published by the Free Software Foundation plus + additions in the file LICENSE. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. - */ + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ #include "bacula.h" -#define PAD_LEN 64 /* PAD length */ -#define SIG_LEN 16 /* MD5 signature length */ +#define PAD_LEN 64 /* PAD length */ +#define SIG_LEN MD5HashSize /* MD5 digest length */ void hmac_md5( - uint8_t* text, /* pointer to data stream */ - int text_len, /* length of data stream */ - uint8_t* key, /* pointer to authentication key */ - int key_len, /* length of authentication key */ - uint8_t *hmac) /* returned hmac-md5 */ + uint8_t* text, /* pointer to data stream */ + int text_len, /* length of data stream */ + uint8_t* key, /* pointer to authentication key */ + int key_len, /* length of authentication key */ + uint8_t *hmac) /* returned hmac-md5 */ { MD5Context md5c; uint8_t k_ipad[PAD_LEN]; /* inner padding - key XORd with ipad */ @@ -71,7 +81,7 @@ hmac_md5( /* Zero pads and store key */ memset(k_ipad, 0, PAD_LEN); memcpy(k_ipad, key, key_len); - memcpy(k_opad, k_ipad, PAD_LEN); + memcpy(k_opad, k_ipad, PAD_LEN); /* XOR key with ipad and opad values */ for (i=0; i