Sync the SHA256 code with NetBSD HEAD.

This fixes a buffer overflow and avoids unnecessary casts and
other cleanup thorough the code.

--HG--
extra : convert_revision : 4b389251cfb76b28028967cd60c409fe94f6c85e
This commit is contained in:
Juan RP 2009-07-29 16:30:37 +02:00
parent 9fa47ba790
commit 816baf0d8a
3 changed files with 193 additions and 117 deletions

View file

@ -46,7 +46,7 @@ xbps_get_file_hash(const char *file)
{
SHA256_CTX ctx;
char *hash;
uint8_t buf[BUFSIZ * 20], digest[SHA256_DIGEST_LENGTH * 2 + 1];
uint8_t buf[BUFSIZ * 20], digest[SHA256_DIGEST_STRING_LENGTH];
ssize_t bytes;
int fd;