summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins/cmac/cmac.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/plugins/cmac/cmac.h')
-rw-r--r--src/libstrongswan/plugins/cmac/cmac.h60
1 files changed, 15 insertions, 45 deletions
diff --git a/src/libstrongswan/plugins/cmac/cmac.h b/src/libstrongswan/plugins/cmac/cmac.h
index 061609127..dc85e3bc3 100644
--- a/src/libstrongswan/plugins/cmac/cmac.h
+++ b/src/libstrongswan/plugins/cmac/cmac.h
@@ -14,6 +14,11 @@
*/
/**
+ * Cipher-based Message Authentication Code (CMAC).
+ *
+ * This class implements the message authentication algorithm
+ * described in RFC 4493.
+ *
* @defgroup cmac cmac
* @{ @ingroup cmac_p
*/
@@ -21,58 +26,23 @@
#ifndef CMAC_H_
#define CMAC_H_
-#include <crypto/crypters/crypter.h>
-
-typedef struct cmac_t cmac_t;
+#include <crypto/prfs/prf.h>
+#include <crypto/signers/signer.h>
/**
- * Cipher-based Message Authentication Code (CMAC).
+ * Creates a new prf_t object based on a CMAC.
*
- * This class implements the message authentication algorithm
- * described in RFC 4493.
+ * @param algo algorithm to implement
+ * @return prf_t object, NULL if not supported
*/
-struct cmac_t {
-
- /**
- * Generate message authentication code.
- *
- * If buffer is NULL, no result is given back. A next call will
- * append the data to already supplied data. If buffer is not NULL,
- * the mac of all apended data is calculated, returned and the internal
- * state is reset.
- *
- * @param data chunk of data to authenticate
- * @param buffer pointer where the generated bytes will be written
- */
- void (*get_mac) (cmac_t *this, chunk_t data, u_int8_t *buffer);
-
- /**
- * Get the block size of this cmac_t object.
- *
- * @return block size in bytes
- */
- size_t (*get_block_size) (cmac_t *this);
-
- /**
- * Set the key for this cmac_t object.
- *
- * @param key key to set
- */
- void (*set_key) (cmac_t *this, chunk_t key);
-
- /**
- * Destroys a cmac_t object.
- */
- void (*destroy) (cmac_t *this);
-};
+prf_t *cmac_prf_create(pseudo_random_function_t algo);
/**
- * Creates a new cmac_t object.
+ * Creates a new signer_t object based on a CMAC.
*
- * @param algo underlying crypto algorithm
- * @param key_size key size to use, if required for algorithm
- * @return cmac_t object, NULL if not supported
+ * @param algo algorithm to implement
+ * @return signer_t, NULL if not supported
*/
-cmac_t *cmac_create(encryption_algorithm_t algo, size_t key_size);
+signer_t *cmac_signer_create(integrity_algorithm_t algo);
#endif /** CMAC_H_ @}*/