summaryrefslogtreecommitdiff
path: root/src/libstrongswan/crypto/crypters/crypter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/crypto/crypters/crypter.h')
-rw-r--r--src/libstrongswan/crypto/crypters/crypter.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/libstrongswan/crypto/crypters/crypter.h b/src/libstrongswan/crypto/crypters/crypter.h
index 2879e24c0..f052a181d 100644
--- a/src/libstrongswan/crypto/crypters/crypter.h
+++ b/src/libstrongswan/crypto/crypters/crypter.h
@@ -13,7 +13,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
-
+
/**
* @defgroup crypter crypter
* @{ @ingroup crypto
@@ -56,14 +56,15 @@ enum encryption_algorithm_t {
ENCR_CAMELLIA_CCM_ICV12 = 26,
ENCR_CAMELLIA_CCM_ICV16 = 27,
ENCR_UNDEFINED = 1024,
- ENCR_DES_ECB = 1025,
+ ENCR_DES_ECB = 1025,
ENCR_SERPENT_CBC = 1026,
- ENCR_TWOFISH_CBC = 1027
+ ENCR_TWOFISH_CBC = 1027
};
#define DES_BLOCK_SIZE 8
#define BLOWFISH_BLOCK_SIZE 8
#define AES_BLOCK_SIZE 16
+#define CAMELLIA_BLOCK_SIZE 16
#define SERPENT_BLOCK_SIZE 16
#define TWOFISH_BLOCK_SIZE 16
@@ -76,7 +77,7 @@ extern enum_name_t *encryption_algorithm_names;
* Generic interface for symmetric encryption algorithms.
*/
struct crypter_t {
-
+
/**
* Encrypt a chunk of data and allocate space for the encrypted value.
*
@@ -90,14 +91,14 @@ struct crypter_t {
*/
void (*encrypt) (crypter_t *this, chunk_t data, chunk_t iv,
chunk_t *encrypted);
-
+
/**
* Decrypt a chunk of data and allocate space for the decrypted value.
*
* The length of the iv must equal to get_block_size(), while the length
* of data must be a multiple it.
* If decrpyted is NULL, the encryption is done in-place (overwriting data).
- *
+ *
* @param data data to decrypt
* @param iv initializing vector
* @param encrypted chunk to allocate decrypted data, or NULL
@@ -107,18 +108,18 @@ struct crypter_t {
/**
* Get the block size of the crypto algorithm.
- *
+ *
* @return block size in bytes
*/
size_t (*get_block_size) (crypter_t *this);
/**
* Get the key size of the crypto algorithm.
- *
+ *
* @return key size in bytes
*/
size_t (*get_key_size) (crypter_t *this);
-
+
/**
* Set the key.
*
@@ -127,7 +128,7 @@ struct crypter_t {
* @param key key to set
*/
void (*set_key) (crypter_t *this, chunk_t key);
-
+
/**
* Destroys a crypter_t object.
*/
@@ -136,7 +137,7 @@ struct crypter_t {
/**
* Conversion of ASN.1 OID to encryption algorithm.
- *
+ *
* @param oid ASN.1 OID
* @param key_size returns size of encryption key in bits
* @return encryption algorithm, ENCR_UNDEFINED if OID unsupported
@@ -145,7 +146,7 @@ encryption_algorithm_t encryption_algorithm_from_oid(int oid, size_t *key_size);
/**
* Conversion of encryption algorithm to ASN.1 OID.
- *
+ *
* @param alg encryption algorithm
* @param key_size size of encryption key in bits
* @return ASN.1 OID, OID_UNKNOWN if OID is unknown