aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon
diff options
context:
space:
mode:
authorJan Hutter <jhutter@hsr.ch>2005-12-06 15:21:26 +0000
committerJan Hutter <jhutter@hsr.ch>2005-12-06 15:21:26 +0000
commit62abe4a37dade51bc122e97d566ec7b728648638 (patch)
treed64b4ea5f764461b8c1b61626cc6aa43d141864a /Source/charon
parent1e7d52a611b602f6a60a593e419173d70cd84f0f (diff)
downloadstrongswan-62abe4a37dade51bc122e97d566ec7b728648638.tar.bz2
strongswan-62abe4a37dade51bc122e97d566ec7b728648638.tar.xz
- code cleaned up
Diffstat (limited to 'Source/charon')
-rw-r--r--Source/charon/transforms/crypters/aes_cbc_crypter.c8
-rw-r--r--Source/charon/transforms/crypters/aes_cbc_crypter.h9
-rw-r--r--Source/charon/transforms/crypters/crypter.c2
-rw-r--r--Source/charon/transforms/crypters/crypter.h57
4 files changed, 49 insertions, 27 deletions
diff --git a/Source/charon/transforms/crypters/aes_cbc_crypter.c b/Source/charon/transforms/crypters/aes_cbc_crypter.c
index 97855e7c3..2768c06ee 100644
--- a/Source/charon/transforms/crypters/aes_cbc_crypter.c
+++ b/Source/charon/transforms/crypters/aes_cbc_crypter.c
@@ -75,12 +75,12 @@ struct private_aes_cbc_crypter_t {
u_int32_t aes_d_key[AES_KS_LENGTH];
/**
- * the number of columns in the cipher state
+ * The number of columns in the cipher state.
*/
u_int32_t aes_Ncol;
/**
- * Blocksize of this AES cypher object
+ * Blocksize of this AES cypher object.
*/
u_int32_t blocksize;
@@ -90,7 +90,7 @@ struct private_aes_cbc_crypter_t {
* No memory gets allocated.
*
* @param this calling object
- * @param[in] in_blk block to decrypt
+ * @param[in] in_blk block to decrypt
* @param[out] out_blk decrypted data are written to this location
*/
void (*decrypt_block) (const private_aes_cbc_crypter_t *this, const unsigned char in_blk[], unsigned char out_blk[]);
@@ -101,7 +101,7 @@ struct private_aes_cbc_crypter_t {
* No memory gets allocated.
*
* @param this calling object
- * @param[in] in_blk block to encrypt
+ * @param[in] in_blk block to encrypt
* @param[out] out_blk encrypted data are written to this location
*/
void (*encrypt_block) (const private_aes_cbc_crypter_t *this, const unsigned char in_blk[], unsigned char out_blk[]);
diff --git a/Source/charon/transforms/crypters/aes_cbc_crypter.h b/Source/charon/transforms/crypters/aes_cbc_crypter.h
index 1e5fd1717..360f2454d 100644
--- a/Source/charon/transforms/crypters/aes_cbc_crypter.h
+++ b/Source/charon/transforms/crypters/aes_cbc_crypter.h
@@ -32,12 +32,15 @@ typedef struct aes_cbc_crypter_t aes_cbc_crypter_t;
/**
* @brief Class implementing the AES symmetric encryption algorithm.
*
+ * @b Constructors:
+ * - aes_cbc_crypter_create()
+ *
* @ingroup crypters
*/
struct aes_cbc_crypter_t {
/**
- * crypter_t interface.
+ * The crypter_t interface.
*/
crypter_t crypter_interface;
};
@@ -45,10 +48,12 @@ struct aes_cbc_crypter_t {
/**
* @brief Constructor to create aes_cbc_crypter_t objects.
*
+ * If an unvalid blocksize is specified, 16 is selected.
+ *
* @param blocksize block size of AES crypter
* (16, 24 or 32 are supported)
* Default size is set to 16.
- * @return aes_cbc_crypter_t if successfully
+ * @return aes_cbc_crypter_t object
*/
aes_cbc_crypter_t *aes_cbc_crypter_create(size_t blocksize);
diff --git a/Source/charon/transforms/crypters/crypter.c b/Source/charon/transforms/crypters/crypter.c
index a72e5a554..aebb220cc 100644
--- a/Source/charon/transforms/crypters/crypter.c
+++ b/Source/charon/transforms/crypters/crypter.c
@@ -27,7 +27,7 @@
/**
- * string mappings for encryption_algorithm_t
+ * String mappings for encryption_algorithm_t.
*/
mapping_t encryption_algorithm_m[] = {
{ENCR_UNDEFINED, "ENCR_UNDEFINED"},
diff --git a/Source/charon/transforms/crypters/crypter.h b/Source/charon/transforms/crypters/crypter.h
index 1ff42299f..d4ba40e1d 100644
--- a/Source/charon/transforms/crypters/crypter.h
+++ b/Source/charon/transforms/crypters/crypter.h
@@ -28,7 +28,18 @@
typedef enum encryption_algorithm_t encryption_algorithm_t;
/**
- * @brief Encryption algorithm, as in IKEv2 draft 3.3.2
+ * @brief Encryption algorithm, as in IKEv2 draft 3.3.2.
+ *
+ * Currently only the following algorithms are implemented and therefore supported:
+ * - ENCR_AES_CBC
+ *
+ * @b Constructors:
+ * - crypter_create()
+ * - aes_cbc_crypter_create()
+ *
+ * @todo Implement more enryption algorithm, especially 3DES
+ *
+ * @ingroup crypters
*/
enum encryption_algorithm_t {
ENCR_UNDEFINED = 1024,
@@ -41,17 +52,20 @@ enum encryption_algorithm_t {
ENCR_BLOWFISH = 7,
ENCR_3IDEA = 8,
ENCR_DES_IV32 = 9,
- RESERVED = 10,
ENCR_NULL = 11,
+ /**
+ * Implemented in class aes_cbc_crypter_t.
+ */
ENCR_AES_CBC = 12,
ENCR_AES_CTR = 13
};
/**
- * string mappings for encryption_algorithm_t
+ * String mappings for encryption_algorithm_t.
*/
extern mapping_t encryption_algorithm_m[];
+
typedef struct crypter_t crypter_t;
/**
@@ -67,13 +81,13 @@ struct crypter_t {
* @brief Encrypt a chunk of data and allocate space for
* the encrypted value.
*
- * @param this calling crypter
+ * @param this calling object
* @param data data to encrypt
- * @param iv iv
+ * @param iv initializing vector
* @param [out]encrypted pointer where the encrypted bytes will be written
* @return
- * - SUCCESS, or
- * - INVALID_ARG if data size not a multiple of block size
+ * - SUCCESS
+ * - INVALID_ARG if data size not a multiple of block size
*/
status_t (*encrypt) (crypter_t *this, chunk_t data, chunk_t iv, chunk_t *encrypted);
@@ -81,31 +95,31 @@ struct crypter_t {
* @brief Decrypt a chunk of data and allocate space for
* the decrypted value.
*
- * @param this calling crypter
+ * @param this calling object
* @param data data to decrypt
- * @param iv iv
+ * @param iv initializing vector
* @param [out]encrypted pointer where the decrypted bytes will be written
* @return
- * - SUCCESS, or
- * - INVALID_ARG if data size not a multiple of block size
+ * - SUCCESS
+ * - INVALID_ARG if data size not a multiple of block size
*/
status_t (*decrypt) (crypter_t *this, chunk_t data, chunk_t iv, chunk_t *decrypted);
/**
- * @brief get the block size of this crypter
+ * @brief Get the block size of this crypter_t object.
*
- * @param this calling crypter
+ * @param this calling object
* @return block size in bytes
*/
size_t (*get_block_size) (crypter_t *this);
/**
- * @brief Set the key for this crypter
+ * @brief Set the key for this crypter_t object.
*
- * @param this calling crypter
+ * @param this calling object
* @param key key to set
* @return
- * - SUCCESS, or
+ * - SUCCESS
* - INVALID_ARG if key size != block size
*/
status_t (*set_key) (crypter_t *this, chunk_t key);
@@ -113,7 +127,7 @@ struct crypter_t {
/**
* @brief Destroys a crypter_t object.
*
- * @param this crypter_t object to destroy
+ * @param this calling object
*/
void (*destroy) (crypter_t *this);
};
@@ -121,11 +135,14 @@ struct crypter_t {
/**
* @brief Generic constructor for crypter_t objects.
*
+ * Currently only the following algorithms are implemented and therefore supported:
+ * - ENCR_AES_CBC
+ *
* @param encryption_algorithm Algorithm to use for crypter
- * @param blocksize block size in bytes
+ * @param blocksize block size in bytes
* @return
- * - crypter_t if successfully
- * - NULL if crypter not supported
+ * - crypter_t object
+ * - NULL if encryption algorithm or blocksize is not supported
*/
crypter_t *crypter_create(encryption_algorithm_t encryption_algorithm, size_t blocksize);