libsec: allow user-passed DigestState in hmac functions
[rsc] --rw-rw-r-- M 1635703 glenda sys 1183 Feb 23 06:31 sys/src/libsec/port/hmac.c
/n/sourcesdump/2006/0223/plan9/sys/src/libsec/port/hmac.c:16,28 -
/n/sourcesdump/2006/0224/plan9/sys/src/libsec/port/hmac.c:16,28
return nil;
/* first time through */
- if(s == nil){
+ if(s == nil || s->seeded == 0){
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);
+ s = (*x)(pad, 64, nil, s);
if(s == nil)
return nil;
}
|