/*
Authors:
Jan Cholasta <jcholast@redhat.com>
Copyright (C) 2012 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
NSS does not provide public API for HMAC, so we implement it ourselves.
See RFC 2104 for details on the algorithm.
*/
#include "util/crypto/sss_crypto.h"
#include "util/crypto/nss/nss_util.h"
#include <sechash.h>
const unsigned char *in,
unsigned char *out)
{
int ret;
size_t i;
unsigned int res_len;
ret = nspr_nss_init();
return ret;
}
if (!sha1) {
return ENOMEM;
}
if (key_len > HMAC_SHA1_BLOCKSIZE) {
/* keys longer than blocksize are shortened */
} else {
/* keys shorter than blocksize are zero-padded */
if (key_len != HMAC_SHA1_BLOCKSIZE) {
}
}
/* HMAC(key, msg) = HASH(key XOR opad, HASH(key XOR ipad, msg)) */
for (i = 0; i < HMAC_SHA1_BLOCKSIZE; i++) {
ikey[i] ^= 0x36;
}
return EOK;
}