(trunk libT) minor code tweak to crypto.c's tr_sha1() function

This commit is contained in:
Jordan Lee 2011-01-19 21:50:51 +00:00
parent 6ae426696f
commit 4f6d46cf99
1 changed files with 4 additions and 8 deletions

View File

@ -39,20 +39,16 @@ tr_sha1( uint8_t * setme, const void * content1, int content1_len, ... )
{
va_list vl;
SHA_CTX sha;
const void * content;
SHA1_Init( &sha );
SHA1_Update( &sha, content1, content1_len );
va_start( vl, content1_len );
for( ;; )
{
const void * content = va_arg( vl, const void* );
const int content_len = content ? va_arg( vl, int ) : -1;
if( content == NULL || content_len < 1 )
break;
SHA1_Update( &sha, content, content_len );
}
while(( content = va_arg( vl, const void* )))
SHA1_Update( &sha, content, va_arg( vl, int ) );
va_end( vl );
SHA1_Final( setme, &sha );
}