} while(++j < 8);
}
+METHOD(hasher_t, reset224, void,
+ private_sha256_hasher_t *this)
+{
+ memcpy(&this->sha_H[0], &sha224_hashInit[0], sizeof(this->sha_H));
+ this->sha_blocks = 0;
+ this->sha_bufCnt = 0;
+}
+
+METHOD(hasher_t, reset256, void,
+ private_sha256_hasher_t *this)
+{
+ memcpy(&this->sha_H[0], &sha256_hashInit[0], sizeof(this->sha_H));
+ this->sha_blocks = 0;
+ this->sha_bufCnt = 0;
+}
+
+METHOD(hasher_t, reset384, void,
+ private_sha512_hasher_t *this)
+{
+ memcpy(&this->sha_H[0], &sha384_hashInit[0], sizeof(this->sha_H));
+ this->sha_blocks = 0;
+ this->sha_blocksMSB = 0;
+ this->sha_bufCnt = 0;
+}
+
+METHOD(hasher_t, reset512, void,
+ private_sha512_hasher_t *this)
+{
+ memcpy(&this->sha_H[0], &sha512_hashInit[0], sizeof(this->sha_H));
+ this->sha_blocks = 0;
+ this->sha_blocksMSB = 0;
+ this->sha_bufCnt = 0;
+}
+
METHOD(hasher_t, get_hash224, void,
private_sha256_hasher_t *this, chunk_t chunk, u_int8_t *buffer)
{
{
sha256_final(this);
memcpy(buffer, this->sha_out, HASH_SIZE_SHA224);
- this->public.hasher_interface.reset(&(this->public.hasher_interface));
+ reset224(this);
}
}
{
sha256_final(this);
memcpy(buffer, this->sha_out, HASH_SIZE_SHA256);
- this->public.hasher_interface.reset(&(this->public.hasher_interface));
+ reset256(this);
}
}
{
sha512_final(this);
memcpy(buffer, this->sha_out, HASH_SIZE_SHA384);
- this->public.hasher_interface.reset(&(this->public.hasher_interface));
+ reset384(this);
}
}
{
sha512_final(this);
memcpy(buffer, this->sha_out, HASH_SIZE_SHA512);
- this->public.hasher_interface.reset(&(this->public.hasher_interface));
+ reset512(this);
}
}
sha256_final(this);
allocated_hash = chunk_alloc(HASH_SIZE_SHA224);
memcpy(allocated_hash.ptr, this->sha_out, HASH_SIZE_SHA224);
- this->public.hasher_interface.reset(&(this->public.hasher_interface));
+ reset224(this);
*hash = allocated_hash;
}
}
sha256_final(this);
allocated_hash = chunk_alloc(HASH_SIZE_SHA256);
memcpy(allocated_hash.ptr, this->sha_out, HASH_SIZE_SHA256);
- this->public.hasher_interface.reset(&(this->public.hasher_interface));
+ reset256(this);
*hash = allocated_hash;
}
}
sha512_final(this);
allocated_hash = chunk_alloc(HASH_SIZE_SHA384);
memcpy(allocated_hash.ptr, this->sha_out, HASH_SIZE_SHA384);
- this->public.hasher_interface.reset(&(this->public.hasher_interface));
+ reset384(this);
*hash = allocated_hash;
}
}
sha512_final(this);
allocated_hash = chunk_alloc(HASH_SIZE_SHA512);
memcpy(allocated_hash.ptr, this->sha_out, HASH_SIZE_SHA512);
- this->public.hasher_interface.reset(&(this->public.hasher_interface));
+ reset512(this);
*hash = allocated_hash;
}
}
return HASH_SIZE_SHA512;
}
-METHOD(hasher_t, reset224, void,
- private_sha256_hasher_t *this)
-{
- memcpy(&this->sha_H[0], &sha224_hashInit[0], sizeof(this->sha_H));
- this->sha_blocks = 0;
- this->sha_bufCnt = 0;
-}
-
-METHOD(hasher_t, reset256, void,
- private_sha256_hasher_t *this)
-{
- memcpy(&this->sha_H[0], &sha256_hashInit[0], sizeof(this->sha_H));
- this->sha_blocks = 0;
- this->sha_bufCnt = 0;
-}
-
-METHOD(hasher_t, reset384, void,
- private_sha512_hasher_t *this)
-{
- memcpy(&this->sha_H[0], &sha384_hashInit[0], sizeof(this->sha_H));
- this->sha_blocks = 0;
- this->sha_blocksMSB = 0;
- this->sha_bufCnt = 0;
-}
-
-METHOD(hasher_t, reset512, void,
- private_sha512_hasher_t *this)
-{
- memcpy(&this->sha_H[0], &sha512_hashInit[0], sizeof(this->sha_H));
- this->sha_blocks = 0;
- this->sha_blocksMSB = 0;
- this->sha_bufCnt = 0;
-}
-
METHOD(hasher_t, destroy, void,
sha2_hasher_t *this)
{