* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sha2.h,v 1.4 2006/01/31 00:35:21 marka Exp $ */
+/* $Id: sha2.h,v 1.5 2006/01/31 23:01:23 marka Exp $ */
/* $FreeBSD: src/sys/crypto/sha2/sha2.h,v 1.1.2.1 2001/07/03 11:01:36 ume Exp $ */
/* $KAME: sha2.h,v 1.3 2001/03/12 08:27:48 itojun Exp $ */
#define ISC_SHA224_DIGESTLENGTH 28U
#define ISC_SHA224_DIGESTSTRINGLENGTH (ISC_SHA224_DIGESTLENGTH * 2 + 1)
-#define ISC_SHA256_BLOCK_LENGTH 64
+#define ISC_SHA256_BLOCK_LENGTH 64U
#define ISC_SHA256_DIGESTLENGTH 32U
#define ISC_SHA256_DIGESTSTRINGLENGTH (ISC_SHA256_DIGESTLENGTH * 2 + 1)
#define ISC_SHA384_BLOCK_LENGTH 128
#define ISC_SHA384_DIGESTLENGTH 48U
#define ISC_SHA384_DIGESTSTRINGLENGTH (ISC_SHA384_DIGESTLENGTH * 2 + 1)
-#define ISC_SHA512_BLOCK_LENGTH 128
+#define ISC_SHA512_BLOCK_LENGTH 128U
#define ISC_SHA512_DIGESTLENGTH 64U
#define ISC_SHA512_DIGESTSTRINGLENGTH (ISC_SHA512_DIGESTLENGTH * 2 + 1)
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sha2.c,v 1.6 2006/01/31 01:58:12 marka Exp $ */
+/* $Id: sha2.c,v 1.7 2006/01/31 23:01:23 marka Exp $ */
/* $FreeBSD: src/sys/crypto/sha2/sha2.c,v 1.2.2.2 2002/03/05 08:36:47 ume Exp $ */
/* $KAME: sha2.c,v 1.8 2001/11/08 01:07:52 itojun Exp $ */
isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) {
unsigned int freespace, usedspace;
- if (len == 0) {
+ if (len == 0U) {
/* Calling with no data is valid - we do nothing */
return;
}
len -= ISC_SHA256_BLOCK_LENGTH;
data += ISC_SHA256_BLOCK_LENGTH;
}
- if (len > 0) {
+ if (len > 0U) {
/* There's left-overs, so save 'em */
memcpy(context->buffer, data, len);
context->bitcount += len << 3;
if (usedspace <= ISC_SHA256_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
- memset(&context->buffer[usedspace], 0, ISC_SHA256_SHORT_BLOCK_LENGTH - usedspace);
+ memset(&context->buffer[usedspace], 0,
+ ISC_SHA256_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace < ISC_SHA256_BLOCK_LENGTH) {
- memset(&context->buffer[usedspace], 0, ISC_SHA256_BLOCK_LENGTH - usedspace);
+ memset(&context->buffer[usedspace], 0,
+ ISC_SHA256_BLOCK_LENGTH -
+ usedspace);
}
/* Do second-to-last transform: */
isc_sha256_transform(context, (isc_uint32_t*)context->buffer);
/* And set-up for the last transform: */
- memset(context->buffer, 0, ISC_SHA256_SHORT_BLOCK_LENGTH);
+ memset(context->buffer, 0,
+ ISC_SHA256_SHORT_BLOCK_LENGTH);
}
} else {
/* Set-up for the last transform: */
void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t len) {
unsigned int freespace, usedspace;
- if (len == 0) {
+ if (len == 0U) {
/* Calling with no data is valid - we do nothing */
return;
}
len -= ISC_SHA512_BLOCK_LENGTH;
data += ISC_SHA512_BLOCK_LENGTH;
}
- if (len > 0) {
+ if (len > 0U) {
/* There's left-overs, so save 'em */
memcpy(context->buffer, data, len);
ADDINC128(context->bitcount, len << 3);
if (usedspace <= ISC_SHA512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
- memset(&context->buffer[usedspace], 0, ISC_SHA512_SHORT_BLOCK_LENGTH - usedspace);
+ memset(&context->buffer[usedspace], 0,
+ ISC_SHA512_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace < ISC_SHA512_BLOCK_LENGTH) {
- memset(&context->buffer[usedspace], 0, ISC_SHA512_BLOCK_LENGTH - usedspace);
+ memset(&context->buffer[usedspace], 0,
+ ISC_SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
isc_sha512_transform(context, (isc_uint64_t*)context->buffer);