aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/Makefile.am6
-rw-r--r--src/libstrongswan/crypto/mac.h (renamed from src/libstrongswan/crypto/hmacs/hmac.h)29
-rw-r--r--src/libstrongswan/crypto/prfs/mac_prf.c (renamed from src/libstrongswan/crypto/hmacs/hmac_prf.c)30
-rw-r--r--src/libstrongswan/crypto/prfs/mac_prf.h (renamed from src/libstrongswan/crypto/hmacs/hmac_prf.h)18
-rw-r--r--src/libstrongswan/crypto/signers/mac_signer.c (renamed from src/libstrongswan/crypto/hmacs/hmac_signer.c)38
-rw-r--r--src/libstrongswan/crypto/signers/mac_signer.h (renamed from src/libstrongswan/crypto/hmacs/hmac_signer.h)24
-rw-r--r--src/libstrongswan/plugins/hmac/Makefile.am2
-rw-r--r--src/libstrongswan/plugins/hmac/hmac.c (renamed from src/libstrongswan/plugins/hmac/hmac_hmac.c)52
-rw-r--r--src/libstrongswan/plugins/hmac/hmac.h (renamed from src/libstrongswan/plugins/hmac/hmac_hmac.h)12
-rw-r--r--src/libstrongswan/plugins/hmac/hmac_plugin.c6
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_hmac.c46
11 files changed, 131 insertions, 132 deletions
diff --git a/src/libstrongswan/Makefile.am b/src/libstrongswan/Makefile.am
index 80b55f207..9952603af 100644
--- a/src/libstrongswan/Makefile.am
+++ b/src/libstrongswan/Makefile.am
@@ -13,17 +13,17 @@ asn1/oid.c asn1/oid.h \
bio/bio_reader.h bio/bio_reader.c bio/bio_writer.h bio/bio_writer.c \
crypto/crypters/crypter.c crypto/crypters/crypter.h \
crypto/hashers/hasher.h crypto/hashers/hasher.c \
-crypto/hmacs/hmac.h \
-crypto/hmacs/hmac_prf.h crypto/hmacs/hmac_prf.c \
-crypto/hmacs/hmac_signer.h crypto/hmacs/hmac_signer.c \
+crypto/mac.h \
crypto/pkcs7.c crypto/pkcs7.h \
crypto/pkcs9.c crypto/pkcs9.h \
crypto/proposal/proposal_keywords.c crypto/proposal/proposal_keywords.h \
crypto/prfs/prf.c crypto/prfs/prf.h \
+crypto/prfs/mac_prf.h crypto/prfs/mac_prf.c \
crypto/rngs/rng.c crypto/rngs/rng.h \
crypto/nonce_gen.h \
crypto/prf_plus.h crypto/prf_plus.c \
crypto/signers/signer.c crypto/signers/signer.h \
+crypto/signers/mac_signer.h crypto/signers/mac_signer.c \
crypto/crypto_factory.c crypto/crypto_factory.h \
crypto/crypto_tester.c crypto/crypto_tester.h \
crypto/diffie_hellman.c crypto/diffie_hellman.h \
diff --git a/src/libstrongswan/crypto/hmacs/hmac.h b/src/libstrongswan/crypto/mac.h
index dd71713cc..10f09a831 100644
--- a/src/libstrongswan/crypto/hmacs/hmac.h
+++ b/src/libstrongswan/crypto/mac.h
@@ -16,23 +16,23 @@
*/
/**
- * @defgroup hmac hmac
+ * @defgroup mac mac
* @{ @ingroup crypto
*/
-#ifndef HMAC_H_
-#define HMAC_H_
+#ifndef MAC_H_
+#define MAC_H_
-typedef struct hmac_t hmac_t;
+typedef struct mac_t mac_t;
#include <library.h>
/**
- * Generic interface for message authentication using hash functions.
+ * Generic interface for message authentication codes.
*
* Classes implementing this interface can use the PRF and signer wrappers.
*/
-struct hmac_t {
+struct mac_t {
/**
* Generate message authentication code.
@@ -45,29 +45,28 @@ struct hmac_t {
* @param data chunk of data to authenticate
* @param out pointer where the generated bytes will be written
*/
- void (*get_mac)(hmac_t *this, chunk_t data, u_int8_t *out);
+ void (*get_mac)(mac_t *this, chunk_t data, u_int8_t *out);
/**
- * Get the size of the resulting MAC (i.e. the output size of the
- * underlying hash function).
+ * Get the size of the resulting MAC.
*
* @return block size in bytes
*/
- size_t (*get_mac_size)(hmac_t *this);
+ size_t (*get_mac_size)(mac_t *this);
/**
- * Set the key to be used for the HMAC.
+ * Set the key to be used for the MAC.
*
* Any key length must be accepted.
*
* @param key key to set
*/
- void (*set_key) (hmac_t *this, chunk_t key);
+ void (*set_key) (mac_t *this, chunk_t key);
/**
- * Destroys a hmac_t object.
+ * Destroys a mac_t object.
*/
- void (*destroy) (hmac_t *this);
+ void (*destroy) (mac_t *this);
};
-#endif /** HMAC_H_ @}*/
+#endif /** MAC_H_ @}*/
diff --git a/src/libstrongswan/crypto/hmacs/hmac_prf.c b/src/libstrongswan/crypto/prfs/mac_prf.c
index 315f45e54..6215a4bec 100644
--- a/src/libstrongswan/crypto/hmacs/hmac_prf.c
+++ b/src/libstrongswan/crypto/prfs/mac_prf.c
@@ -15,12 +15,12 @@
* for more details.
*/
-#include "hmac_prf.h"
+#include "mac_prf.h"
typedef struct private_prf_t private_prf_t;
/**
- * Private data of a hmac_prf_t object.
+ * Private data of a mac_prf_t object.
*/
struct private_prf_t {
@@ -30,15 +30,15 @@ struct private_prf_t {
prf_t public;
/**
- * HMAC to use
+ * MAC to use
*/
- hmac_t *hmac;
+ mac_t *mac;
};
METHOD(prf_t, get_bytes, void,
private_prf_t *this, chunk_t seed, u_int8_t *buffer)
{
- this->hmac->get_mac(this->hmac, seed, buffer);
+ this->mac->get_mac(this->mac, seed, buffer);
}
METHOD(prf_t, allocate_bytes, void,
@@ -46,45 +46,45 @@ METHOD(prf_t, allocate_bytes, void,
{
if (!chunk)
{
- this->hmac->get_mac(this->hmac, seed, NULL);
+ this->mac->get_mac(this->mac, seed, NULL);
}
else
{
- *chunk = chunk_alloc(this->hmac->get_mac_size(this->hmac));
- this->hmac->get_mac(this->hmac, seed, chunk->ptr);
+ *chunk = chunk_alloc(this->mac->get_mac_size(this->mac));
+ this->mac->get_mac(this->mac, seed, chunk->ptr);
}
}
METHOD(prf_t, get_block_size, size_t,
private_prf_t *this)
{
- return this->hmac->get_mac_size(this->hmac);
+ return this->mac->get_mac_size(this->mac);
}
METHOD(prf_t, get_key_size, size_t,
private_prf_t *this)
{
- /* for HMAC PRFs, IKEv2 uses MAC size as key size */
- return this->hmac->get_mac_size(this->hmac);
+ /* IKEv2 uses MAC size as key size */
+ return this->mac->get_mac_size(this->mac);
}
METHOD(prf_t, set_key, void,
private_prf_t *this, chunk_t key)
{
- this->hmac->set_key(this->hmac, key);
+ this->mac->set_key(this->mac, key);
}
METHOD(prf_t, destroy, void,
private_prf_t *this)
{
- this->hmac->destroy(this->hmac);
+ this->mac->destroy(this->mac);
free(this);
}
/*
* Described in header.
*/
-prf_t *hmac_prf_create(hmac_t *hmac)
+prf_t *mac_prf_create(mac_t *mac)
{
private_prf_t *this;
@@ -97,7 +97,7 @@ prf_t *hmac_prf_create(hmac_t *hmac)
.set_key = _set_key,
.destroy = _destroy,
},
- .hmac = hmac,
+ .mac = mac,
);
return &this->public;
diff --git a/src/libstrongswan/crypto/hmacs/hmac_prf.h b/src/libstrongswan/crypto/prfs/mac_prf.h
index 742cf70ba..b2c0c6e17 100644
--- a/src/libstrongswan/crypto/hmacs/hmac_prf.h
+++ b/src/libstrongswan/crypto/prfs/mac_prf.h
@@ -14,23 +14,23 @@
*/
/**
- * @defgroup hmac_prf hmac_prf
- * @{ @ingroup hmac
+ * @defgroup mac_prf mac_prf
+ * @{ @ingroup crypto
*/
-#ifndef HMAC_PRF_H_
-#define HMAC_PRF_H_
+#ifndef MAC_PRF_H_
+#define MAC_PRF_H_
+#include <crypto/mac.h>
#include <crypto/prfs/prf.h>
-#include <crypto/hmacs/hmac.h>
/**
- * Creates an implementation of the prf_t interface using the provided hmac_t
+ * Creates an implementation of the prf_t interface using the provided mac_t
* implementation. Basically a simple wrapper to map the interface.
*
- * @param hmac hmac_t implementation
+ * @param mac mac_t implementation
* @return prf_t object
*/
-prf_t *hmac_prf_create(hmac_t *hmac);
+prf_t *mac_prf_create(mac_t *mac);
-#endif /** HMAC_PRF_H_ @}*/
+#endif /** MAC_PRF_H_ @}*/
diff --git a/src/libstrongswan/crypto/hmacs/hmac_signer.c b/src/libstrongswan/crypto/signers/mac_signer.c
index 4fc0bc18e..44a8e894e 100644
--- a/src/libstrongswan/crypto/hmacs/hmac_signer.c
+++ b/src/libstrongswan/crypto/signers/mac_signer.c
@@ -15,12 +15,12 @@
* for more details.
*/
-#include "hmac_signer.h"
+#include "mac_signer.h"
typedef struct private_signer_t private_signer_t;
/**
- * Private data of a hmac_signer_t object.
+ * Private data of a mac_signer_t object.
*/
struct private_signer_t {
@@ -30,12 +30,12 @@ struct private_signer_t {
signer_t public;
/**
- * HMAC to use
+ * MAC to use
*/
- hmac_t *hmac;
+ mac_t *mac;
/**
- * Truncation of HMAC output
+ * Truncation of MAC output
*/
size_t truncation;
};
@@ -45,13 +45,13 @@ METHOD(signer_t, get_signature, void,
{
if (buffer == NULL)
{
- this->hmac->get_mac(this->hmac, data, NULL);
+ this->mac->get_mac(this->mac, data, NULL);
}
else
{
- u_int8_t mac[this->hmac->get_mac_size(this->hmac)];
+ u_int8_t mac[this->mac->get_mac_size(this->mac)];
- this->hmac->get_mac(this->hmac, data, mac);
+ this->mac->get_mac(this->mac, data, mac);
memcpy(buffer, mac, this->truncation);
}
}
@@ -61,13 +61,13 @@ METHOD(signer_t, allocate_signature, void,
{
if (chunk == NULL)
{
- this->hmac->get_mac(this->hmac, data, NULL);
+ this->mac->get_mac(this->mac, data, NULL);
}
else
{
- u_int8_t mac[this->hmac->get_mac_size(this->hmac)];
+ u_int8_t mac[this->mac->get_mac_size(this->mac)];
- this->hmac->get_mac(this->hmac, data, mac);
+ this->mac->get_mac(this->mac, data, mac);
*chunk = chunk_alloc(this->truncation);
memcpy(chunk->ptr, mac, this->truncation);
@@ -77,20 +77,20 @@ METHOD(signer_t, allocate_signature, void,
METHOD(signer_t, verify_signature, bool,
private_signer_t *this, chunk_t data, chunk_t signature)
{
- u_int8_t mac[this->hmac->get_mac_size(this->hmac)];
+ u_int8_t mac[this->mac->get_mac_size(this->mac)];
if (signature.len != this->truncation)
{
return FALSE;
}
- this->hmac->get_mac(this->hmac, data, mac);
+ this->mac->get_mac(this->mac, data, mac);
return memeq(signature.ptr, mac, this->truncation);
}
METHOD(signer_t, get_key_size, size_t,
private_signer_t *this)
{
- return this->hmac->get_mac_size(this->hmac);
+ return this->mac->get_mac_size(this->mac);
}
METHOD(signer_t, get_block_size, size_t,
@@ -102,20 +102,20 @@ METHOD(signer_t, get_block_size, size_t,
METHOD(signer_t, set_key, void,
private_signer_t *this, chunk_t key)
{
- this->hmac->set_key(this->hmac, key);
+ this->mac->set_key(this->mac, key);
}
METHOD(signer_t, destroy, void,
private_signer_t *this)
{
- this->hmac->destroy(this->hmac);
+ this->mac->destroy(this->mac);
free(this);
}
/*
* Described in header
*/
-signer_t *hmac_signer_create(hmac_t *hmac, size_t len)
+signer_t *mac_signer_create(mac_t *mac, size_t len)
{
private_signer_t *this;
@@ -129,8 +129,8 @@ signer_t *hmac_signer_create(hmac_t *hmac, size_t len)
.set_key = _set_key,
.destroy = _destroy,
},
- .truncation = min(len, hmac->get_mac_size(hmac)),
- .hmac = hmac,
+ .truncation = min(len, mac->get_mac_size(mac)),
+ .mac = mac,
);
return &this->public;
diff --git a/src/libstrongswan/crypto/hmacs/hmac_signer.h b/src/libstrongswan/crypto/signers/mac_signer.h
index 6db7f6079..a50c8cadf 100644
--- a/src/libstrongswan/crypto/hmacs/hmac_signer.h
+++ b/src/libstrongswan/crypto/signers/mac_signer.h
@@ -14,28 +14,28 @@
*/
/**
- * @defgroup hmac_signer hmac_signer
- * @{ @ingroup hmac
+ * @defgroup mac_signer mac_signer
+ * @{ @ingroup crypto
*/
-#ifndef HMAC_SIGNER_H_
-#define HMAC_SIGNER_H_
+#ifndef MAC_SIGNER_H_
+#define MAC_SIGNER_H_
-typedef struct hmac_signer_t hmac_signer_t;
+typedef struct mac_signer_t mac_signer_t;
-#include <crypto/hmacs/hmac.h>
+#include <crypto/mac.h>
#include <crypto/signers/signer.h>
/**
- * Creates an implementation of the signer_t interface using the provided hmac_t
+ * Creates an implementation of the signer_t interface using the provided mac_t
* implementation and truncation length.
*
- * @note len will be set to hmac_t.get_mac_size() if it is greater than that.
+ * @note len will be set to mac_t.get_mac_size() if it is greater than that.
*
- * @param hmac hmac_t implementation
+ * @param mac mac_t implementation
* @param len length of resulting signature
- * @return hmac_signer_t
+ * @return mac_signer_t
*/
-signer_t *hmac_signer_create(hmac_t *hmac, size_t len);
+signer_t *mac_signer_create(mac_t *mac, size_t len);
-#endif /** HMAC_SIGNER_H_ @}*/
+#endif /** MAC_SIGNER_H_ @}*/
diff --git a/src/libstrongswan/plugins/hmac/Makefile.am b/src/libstrongswan/plugins/hmac/Makefile.am
index f563d78be..4faf321ef 100644
--- a/src/libstrongswan/plugins/hmac/Makefile.am
+++ b/src/libstrongswan/plugins/hmac/Makefile.am
@@ -10,6 +10,6 @@ plugin_LTLIBRARIES = libstrongswan-hmac.la
endif
libstrongswan_hmac_la_SOURCES = \
- hmac_plugin.h hmac_plugin.c hmac_hmac.h hmac_hmac.c
+ hmac_plugin.h hmac_plugin.c hmac.h hmac.c
libstrongswan_hmac_la_LDFLAGS = -module -avoid-version
diff --git a/src/libstrongswan/plugins/hmac/hmac_hmac.c b/src/libstrongswan/plugins/hmac/hmac.c
index 975dc3a8f..ecfb01913 100644
--- a/src/libstrongswan/plugins/hmac/hmac_hmac.c
+++ b/src/libstrongswan/plugins/hmac/hmac.c
@@ -15,25 +15,25 @@
* for more details.
*/
-#include "hmac_hmac.h"
+#include "hmac.h"
-#include <crypto/hmacs/hmac.h>
-#include <crypto/hmacs/hmac_prf.h>
-#include <crypto/hmacs/hmac_signer.h>
+#include <crypto/mac.h>
+#include <crypto/prfs/mac_prf.h>
+#include <crypto/signers/mac_signer.h>
-typedef struct private_hmac_t private_hmac_t;
+typedef struct private_mac_t private_mac_t;
/**
- * Private data of a hmac_hmac_t object.
+ * Private data of a mac_t object.
*
* The variable names are the same as in the RFC.
*/
-struct private_hmac_t {
+struct private_mac_t {
/**
- * Implements hmac_t interface
+ * Implements mac_t interface
*/
- hmac_t public;
+ mac_t public;
/**
* Block size, as in RFC.
@@ -56,8 +56,8 @@ struct private_hmac_t {
chunk_t ipaded_key;
};
-METHOD(hmac_t, get_mac, void,
- private_hmac_t *this, chunk_t data, u_int8_t *out)
+METHOD(mac_t, get_mac, void,
+ private_mac_t *this, chunk_t data, u_int8_t *out)
{
/* H(K XOR opad, H(K XOR ipad, text))
*
@@ -92,14 +92,14 @@ METHOD(hmac_t, get_mac, void,
}
}
-METHOD(hmac_t, get_mac_size, size_t,
- private_hmac_t *this)
+METHOD(mac_t, get_mac_size, size_t,
+ private_mac_t *this)
{
return this->h->get_hash_size(this->h);
}
-METHOD(hmac_t, set_key, void,
- private_hmac_t *this, chunk_t key)
+METHOD(mac_t, set_key, void,
+ private_mac_t *this, chunk_t key)
{
int i;
u_int8_t buffer[this->b];
@@ -129,8 +129,8 @@ METHOD(hmac_t, set_key, void,
this->h->get_hash(this->h, this->ipaded_key, NULL);
}
-METHOD(hmac_t, destroy, void,
- private_hmac_t *this)
+METHOD(mac_t, destroy, void,
+ private_mac_t *this)
{
this->h->destroy(this->h);
chunk_clear(&this->opaded_key);
@@ -139,11 +139,11 @@ METHOD(hmac_t, destroy, void,
}
/*
- * Creates an hmac_t object
+ * Creates an mac_t object
*/
-static hmac_t *hmac_create(hash_algorithm_t hash_algorithm)
+static mac_t *hmac_create(hash_algorithm_t hash_algorithm)
{
- private_hmac_t *this;
+ private_mac_t *this;
INIT(this,
.public = {
@@ -191,14 +191,14 @@ static hmac_t *hmac_create(hash_algorithm_t hash_algorithm)
/*
* Described in header
*/
-prf_t *hmac_hmac_prf_create(pseudo_random_function_t algo)
+prf_t *hmac_prf_create(pseudo_random_function_t algo)
{
- hmac_t *hmac;
+ mac_t *hmac;
hmac = hmac_create(hasher_algorithm_from_prf(algo));
if (hmac)
{
- return hmac_prf_create(hmac);
+ return mac_prf_create(hmac);
}
return NULL;
}
@@ -206,15 +206,15 @@ prf_t *hmac_hmac_prf_create(pseudo_random_function_t algo)
/*
* Described in header
*/
-signer_t *hmac_hmac_signer_create(integrity_algorithm_t algo)
+signer_t *hmac_signer_create(integrity_algorithm_t algo)
{
- hmac_t *hmac;
+ mac_t *hmac;
size_t trunc;
hmac = hmac_create(hasher_algorithm_from_integrity(algo, &trunc));
if (hmac)
{
- return hmac_signer_create(hmac, trunc);
+ return mac_signer_create(hmac, trunc);
}
return NULL;
}
diff --git a/src/libstrongswan/plugins/hmac/hmac_hmac.h b/src/libstrongswan/plugins/hmac/hmac.h
index fdafabe1e..bf66dd4aa 100644
--- a/src/libstrongswan/plugins/hmac/hmac_hmac.h
+++ b/src/libstrongswan/plugins/hmac/hmac.h
@@ -18,12 +18,12 @@
*
* It uses a hash function, which must be implemented as a hasher_t class.
*
- * @defgroup hmac_hmac hmac
+ * @defgroup hmac_mac mac
* @{ @ingroup hmac_p
*/
-#ifndef HMAC_HMAC_H_
-#define HMAC_HMAC_H_
+#ifndef HMAC_H_
+#define HMAC_H_
#include <crypto/prfs/prf.h>
#include <crypto/signers/signer.h>
@@ -34,7 +34,7 @@
* @param algo algorithm to implement
* @return prf_t object, NULL if not supported
*/
-prf_t *hmac_hmac_prf_create(pseudo_random_function_t algo);
+prf_t *hmac_prf_create(pseudo_random_function_t algo);
/**
* Creates a new signer_t object based on an HMAC.
@@ -42,6 +42,6 @@ prf_t *hmac_hmac_prf_create(pseudo_random_function_t algo);
* @param algo algorithm to implement
* @return signer_t, NULL if not supported
*/
-signer_t *hmac_hmac_signer_create(integrity_algorithm_t algo);
+signer_t *hmac_signer_create(integrity_algorithm_t algo);
-#endif /** HMAC_HMAC_H_ @}*/
+#endif /** HMAC_H_ @}*/
diff --git a/src/libstrongswan/plugins/hmac/hmac_plugin.c b/src/libstrongswan/plugins/hmac/hmac_plugin.c
index fe30a4cbf..f9c0c484b 100644
--- a/src/libstrongswan/plugins/hmac/hmac_plugin.c
+++ b/src/libstrongswan/plugins/hmac/hmac_plugin.c
@@ -16,7 +16,7 @@
#include "hmac_plugin.h"
#include <library.h>
-#include "hmac_hmac.h"
+#include "hmac.h"
typedef struct private_hmac_plugin_t private_hmac_plugin_t;
@@ -41,7 +41,7 @@ METHOD(plugin_t, get_features, int,
private_hmac_plugin_t *this, plugin_feature_t *features[])
{
static plugin_feature_t f[] = {
- PLUGIN_REGISTER(PRF, hmac_hmac_prf_create),
+ PLUGIN_REGISTER(PRF, hmac_prf_create),
PLUGIN_PROVIDE(PRF, PRF_HMAC_SHA1),
PLUGIN_DEPENDS(HASHER, HASH_SHA1),
PLUGIN_PROVIDE(PRF, PRF_HMAC_MD5),
@@ -52,7 +52,7 @@ METHOD(plugin_t, get_features, int,
PLUGIN_DEPENDS(HASHER, HASH_SHA384),
PLUGIN_PROVIDE(PRF, PRF_HMAC_SHA2_512),
PLUGIN_DEPENDS(HASHER, HASH_SHA512),
- PLUGIN_REGISTER(SIGNER, hmac_hmac_signer_create),
+ PLUGIN_REGISTER(SIGNER, hmac_signer_create),
PLUGIN_PROVIDE(SIGNER, AUTH_HMAC_SHA1_96),
PLUGIN_DEPENDS(HASHER, HASH_SHA1),
PLUGIN_PROVIDE(SIGNER, AUTH_HMAC_SHA1_128),
diff --git a/src/libstrongswan/plugins/openssl/openssl_hmac.c b/src/libstrongswan/plugins/openssl/openssl_hmac.c
index 932d0e434..caf0d3aa2 100644
--- a/src/libstrongswan/plugins/openssl/openssl_hmac.c
+++ b/src/libstrongswan/plugins/openssl/openssl_hmac.c
@@ -40,21 +40,21 @@
#include "openssl_hmac.h"
-#include <crypto/hmacs/hmac.h>
-#include <crypto/hmacs/hmac_prf.h>
-#include <crypto/hmacs/hmac_signer.h>
+#include <crypto/mac.h>
+#include <crypto/prfs/mac_prf.h>
+#include <crypto/signers/mac_signer.h>
-typedef struct private_hmac_t private_hmac_t;
+typedef struct private_mac_t private_mac_t;
/**
- * Private data of a hmac_t object.
+ * Private data of a mac_t object.
*/
-struct private_hmac_t {
+struct private_mac_t {
/**
* Public interface
*/
- hmac_t public;
+ mac_t public;
/**
* Hasher to use
@@ -75,13 +75,13 @@ struct private_hmac_t {
/**
* Resets HMAC context
*/
-static void reset(private_hmac_t *this)
+static void reset(private_mac_t *this)
{
HMAC_Init_ex(&this->hmac, this->key.ptr, this->key.len, this->hasher, NULL);
}
-METHOD(hmac_t, get_mac, void,
- private_hmac_t *this, chunk_t data, u_int8_t *out)
+METHOD(mac_t, get_mac, void,
+ private_mac_t *this, chunk_t data, u_int8_t *out)
{
if (out == NULL)
{
@@ -95,22 +95,22 @@ METHOD(hmac_t, get_mac, void,
}
}
-METHOD(hmac_t, get_mac_size, size_t,
- private_hmac_t *this)
+METHOD(mac_t, get_mac_size, size_t,
+ private_mac_t *this)
{
return EVP_MD_size(this->hasher);
}
-METHOD(hmac_t, set_key, void,
- private_hmac_t *this, chunk_t key)
+METHOD(mac_t, set_key, void,
+ private_mac_t *this, chunk_t key)
{
chunk_clear(&this->key);
this->key = chunk_clone(key);
reset(this);
}
-METHOD(hmac_t, destroy, void,
- private_hmac_t *this)
+METHOD(mac_t, destroy, void,
+ private_mac_t *this)
{
HMAC_CTX_cleanup(&this->hmac);
chunk_clear(&this->key);
@@ -118,11 +118,11 @@ METHOD(hmac_t, destroy, void,
}
/*
- * Create an OpenSSL-backed implementation of the hmac_t interface
+ * Create an OpenSSL-backed implementation of the mac_t interface
*/
-static hmac_t *hmac_create(hash_algorithm_t algo)
+static mac_t *hmac_create(hash_algorithm_t algo)
{
- private_hmac_t *this;
+ private_mac_t *this;
INIT(this,
.public = {
@@ -170,12 +170,12 @@ static hmac_t *hmac_create(hash_algorithm_t algo)
*/
prf_t *openssl_hmac_prf_create(pseudo_random_function_t algo)
{
- hmac_t *hmac;
+ mac_t *hmac;
hmac = hmac_create(hasher_algorithm_from_prf(algo));
if (hmac)
{
- return hmac_prf_create(hmac);
+ return mac_prf_create(hmac);
}
return NULL;
}
@@ -185,13 +185,13 @@ prf_t *openssl_hmac_prf_create(pseudo_random_function_t algo)
*/
signer_t *openssl_hmac_signer_create(integrity_algorithm_t algo)
{
- hmac_t *hmac;
+ mac_t *hmac;
size_t trunc;
hmac = hmac_create(hasher_algorithm_from_integrity(algo, &trunc));
if (hmac)
{
- return hmac_signer_create(hmac, trunc);
+ return mac_signer_create(hmac, trunc);
}
return NULL;
}