diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2013-11-23 01:05:33 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2013-11-23 01:05:33 +0100 |
commit | 2f9ae0f8ac8610e13ced184847b57b87fe5db580 (patch) | |
tree | f9ad2223d518585a2cfe9ea1c73e1e37d07bf637 /sys/src/cmd/unix/drawterm/libsec/hmac.c | |
parent | ea5797c0731203c09ec5fb7172e77eab2750f1a9 (diff) |
removing (outdated) drawterm
drawterm is much better maintained by russ cox,
so removing this outdated copy.
for a more recent version, go to:
http://swtch.com/drawterm/
Diffstat (limited to 'sys/src/cmd/unix/drawterm/libsec/hmac.c')
-rw-r--r-- | sys/src/cmd/unix/drawterm/libsec/hmac.c | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/sys/src/cmd/unix/drawterm/libsec/hmac.c b/sys/src/cmd/unix/drawterm/libsec/hmac.c deleted file mode 100644 index c72397380..000000000 --- a/sys/src/cmd/unix/drawterm/libsec/hmac.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "os.h" -#include <libsec.h> - -/* 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){ - for(i=0; i<64; i++) - pad[i] = 0x36; - pad[64] = 0; - for(i=0; i<klen; i++) - pad[i] ^= key[i]; - s = (*x)(pad, 64, nil, nil); - if(s == nil) - return nil; - } - - s = (*x)(p, len, nil, s); - if(digest == nil) - return s; - - /* last time through */ - for(i=0; i<64; i++) - pad[i] = 0x5c; - pad[64] = 0; - for(i=0; i<klen; i++) - pad[i] ^= key[i]; - (*x)(nil, 0, innerdigest, s); - s = (*x)(pad, 64, nil, nil); - (*x)(innerdigest, xlen, digest, s); - return nil; -} - -DigestState* -hmac_sha1(uchar *p, ulong len, uchar *key, ulong klen, uchar *digest, DigestState *s) -{ - return hmac_x(p, len, key, klen, digest, s, sha1, SHA1dlen); -} - -DigestState* -hmac_md5(uchar *p, ulong len, uchar *key, ulong klen, uchar *digest, DigestState *s) -{ - return hmac_x(p, len, key, klen, digest, s, md5, MD5dlen); -} |