aboutsummaryrefslogtreecommitdiffstats
path: root/Source/lib/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'Source/lib/crypto')
-rw-r--r--Source/lib/crypto/hashers/hasher.h6
-rw-r--r--Source/lib/crypto/hashers/md5_hasher.c6
-rw-r--r--Source/lib/crypto/hashers/sha1_hasher.c6
-rw-r--r--Source/lib/crypto/hmac.c8
-rw-r--r--Source/lib/crypto/rsa/rsa_public_key.c2
5 files changed, 14 insertions, 14 deletions
diff --git a/Source/lib/crypto/hashers/hasher.h b/Source/lib/crypto/hashers/hasher.h
index a4d6f14d7..24683c01b 100644
--- a/Source/lib/crypto/hashers/hasher.h
+++ b/Source/lib/crypto/hashers/hasher.h
@@ -109,12 +109,12 @@ struct hasher_t {
void (*allocate_hash) (hasher_t *this, chunk_t data, chunk_t *hash);
/**
- * @brief Get the block size of this hashing function.
+ * @brief Get the size of the resulting hash.
*
* @param this calling object
- * @return block size in bytes
+ * @return hash size in bytes
*/
- size_t (*get_block_size) (hasher_t *this);
+ size_t (*get_hash_size) (hasher_t *this);
/**
* @brief Resets the hashers state, which allows
diff --git a/Source/lib/crypto/hashers/md5_hasher.c b/Source/lib/crypto/hashers/md5_hasher.c
index 8d6361139..bd3ab0c62 100644
--- a/Source/lib/crypto/hashers/md5_hasher.c
+++ b/Source/lib/crypto/hashers/md5_hasher.c
@@ -346,9 +346,9 @@ static void allocate_hash(private_md5_hasher_t *this, chunk_t chunk, chunk_t *ha
}
/**
- * Implementation of hasher_t.get_block_size.
+ * Implementation of hasher_t.get_hash_size.
*/
-static size_t get_block_size(private_md5_hasher_t *this)
+static size_t get_hash_size(private_md5_hasher_t *this)
{
return BLOCK_SIZE_MD5;
}
@@ -383,7 +383,7 @@ md5_hasher_t *md5_hasher_create()
this->public.hasher_interface.get_hash = (void (*) (hasher_t*, chunk_t, u_int8_t*))get_hash;
this->public.hasher_interface.allocate_hash = (void (*) (hasher_t*, chunk_t, chunk_t*))allocate_hash;
- this->public.hasher_interface.get_block_size = (size_t (*) (hasher_t*))get_block_size;
+ this->public.hasher_interface.get_hash_size = (size_t (*) (hasher_t*))get_hash_size;
this->public.hasher_interface.reset = (void (*) (hasher_t*))reset;
this->public.hasher_interface.destroy = (void (*) (hasher_t*))destroy;
diff --git a/Source/lib/crypto/hashers/sha1_hasher.c b/Source/lib/crypto/hashers/sha1_hasher.c
index b66e75ada..2b82ef4ba 100644
--- a/Source/lib/crypto/hashers/sha1_hasher.c
+++ b/Source/lib/crypto/hashers/sha1_hasher.c
@@ -220,9 +220,9 @@ static void allocate_hash(private_sha1_hasher_t *this, chunk_t chunk, chunk_t *h
}
/**
- * Implementation of hasher_t.get_block_size.
+ * Implementation of hasher_t.get_hash_size.
*/
-static size_t get_block_size(private_sha1_hasher_t *this)
+static size_t get_hash_size(private_sha1_hasher_t *this)
{
return BLOCK_SIZE_SHA1;
}
@@ -258,7 +258,7 @@ sha1_hasher_t *sha1_hasher_create()
this->public.hasher_interface.get_hash = (void (*) (hasher_t*, chunk_t, u_int8_t*))get_hash;
this->public.hasher_interface.allocate_hash = (void (*) (hasher_t*, chunk_t, chunk_t*))allocate_hash;
- this->public.hasher_interface.get_block_size = (size_t (*) (hasher_t*))get_block_size;
+ this->public.hasher_interface.get_hash_size = (size_t (*) (hasher_t*))get_hash_size;
this->public.hasher_interface.reset = (void (*) (hasher_t*))reset;
this->public.hasher_interface.destroy = (void (*) (hasher_t*))destroy;
diff --git a/Source/lib/crypto/hmac.c b/Source/lib/crypto/hmac.c
index 84d6044fd..bb8880770 100644
--- a/Source/lib/crypto/hmac.c
+++ b/Source/lib/crypto/hmac.c
@@ -70,7 +70,7 @@ static void get_mac(private_hmac_t *this, chunk_t data, u_int8_t *out)
*
*/
- u_int8_t buffer[this->h->get_block_size(this->h)];
+ u_int8_t buffer[this->h->get_hash_size(this->h)];
chunk_t inner;
if (out == NULL)
@@ -82,7 +82,7 @@ static void get_mac(private_hmac_t *this, chunk_t data, u_int8_t *out)
{
/* append and do outer hash */
inner.ptr = buffer;
- inner.len = this->h->get_block_size(this->h);
+ inner.len = this->h->get_hash_size(this->h);
/* complete inner */
this->h->get_hash(this->h, data, buffer);
@@ -109,7 +109,7 @@ static void allocate_mac(private_hmac_t *this, chunk_t data, chunk_t *out)
}
else
{
- out->len = this->h->get_block_size(this->h);
+ out->len = this->h->get_hash_size(this->h);
out->ptr = malloc(out->len);
this->hmac.get_mac(&(this->hmac), data, out->ptr);
}
@@ -120,7 +120,7 @@ static void allocate_mac(private_hmac_t *this, chunk_t data, chunk_t *out)
*/
static size_t get_block_size(private_hmac_t *this)
{
- return this->h->get_block_size(this->h);
+ return this->h->get_hash_size(this->h);
}
/**
diff --git a/Source/lib/crypto/rsa/rsa_public_key.c b/Source/lib/crypto/rsa/rsa_public_key.c
index 6b6988b62..6601b6cda 100644
--- a/Source/lib/crypto/rsa/rsa_public_key.c
+++ b/Source/lib/crypto/rsa/rsa_public_key.c
@@ -272,7 +272,7 @@ static status_t verify_emsa_pkcs1_signature(private_rsa_public_key_t *this, chun
return NOT_SUPPORTED;
}
- if (pos + hasher->get_block_size(hasher) != em.ptr + em.len)
+ if (pos + hasher->get_hash_size(hasher) != em.ptr + em.len)
{
/* bad length */
free(em.ptr);