(trunk libT) fix a couple warnings from r8080

This commit is contained in:
Erick Turnquist 2009-03-24 21:49:19 +00:00
parent 0a6ab3014c
commit 4b92e07ce0
1 changed files with 6 additions and 6 deletions

View File

@ -364,16 +364,16 @@ tr_ssha1( const void * plaintext )
static const size_t salter_len = 64;
static const size_t saltval_len = 8;
int i;
size_t i;
char salt[saltval_len];
char sha[SHA_DIGEST_LENGTH];
uint8_t sha[SHA_DIGEST_LENGTH];
char buf[2*SHA_DIGEST_LENGTH + saltval_len + 2];
for( i=0; i<=saltval_len; ++i )
salt[i] = salter[ tr_cryptoRandInt( salter_len ) ];
tr_sha1( sha, plaintext, strlen( plaintext ), salt, saltval_len, NULL );
tr_sha1_to_hex( &buf[1], &sha );
tr_sha1_to_hex( &buf[1], sha );
memcpy( &buf[1+2*SHA_DIGEST_LENGTH], &salt, saltval_len );
buf[1+2*SHA_DIGEST_LENGTH + saltval_len] = '\0';
buf[0] = '{'; /* signal that this is a hash. this makes saving/restoring
@ -388,7 +388,7 @@ tr_ssha1_matches( const char * source, const char * pass )
char * salt;
size_t saltlen;
char * hashed;
char buf[SHA_DIGEST_LENGTH];
uint8_t buf[SHA_DIGEST_LENGTH];
tr_bool result;
/* extract the salt */
@ -398,8 +398,8 @@ tr_ssha1_matches( const char * source, const char * pass )
/* hash pass + salt */
hashed = tr_malloc( 2*SHA_DIGEST_LENGTH + saltlen + 2 );
tr_sha1( &buf, pass, strlen( pass ), salt, saltlen, NULL );
tr_sha1_to_hex( &hashed[1], &buf );
tr_sha1( buf, pass, strlen( pass ), salt, saltlen, NULL );
tr_sha1_to_hex( &hashed[1], buf );
memcpy( hashed + 1+2*SHA_DIGEST_LENGTH, salt, saltlen );
hashed[1+2*SHA_DIGEST_LENGTH + saltlen] = '\0';
hashed[0] = '{';