From 37da2899f40661e3e9631e497da8dc59b971cbd0 Mon Sep 17 00:00:00 2001 From: "Charles.Forsyth" Date: Fri, 22 Dec 2006 17:07:39 +0000 Subject: 20060303a --- libsec/port/hmac.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 libsec/port/hmac.c (limited to 'libsec/port/hmac.c') diff --git a/libsec/port/hmac.c b/libsec/port/hmac.c new file mode 100644 index 00000000..b6f003ad --- /dev/null +++ b/libsec/port/hmac.c @@ -0,0 +1,56 @@ +#include "os.h" +#include + +/* rfc2104 */ +static DigestState* +hmac_x(uchar *p, ulong len, uchar *key, ulong klen, uchar *digest, DigestState *s, + DigestState*(*x)(uchar*, ulong, uchar*, DigestState*), int xlen) +{ + int i; + uchar pad[65], innerdigest[256]; + + if(xlen > sizeof(innerdigest)) + return nil; + + if(klen>64) + return nil; + + /* first time through */ + if(s == nil || s->seeded == 0){ + for(i=0; i<64; i++) + pad[i] = 0x36; + pad[64] = 0; + for(i=0; i