Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2006/0223/1

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


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;
	  	}


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].