Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2007 Pekka Riikonen
+ Copyright (C) 2007 - 2008 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
-/****h* silcskr/SILC Accelerator Interface
+/****h* silcacc/Crypto Accelerator Interface
*
* DESCRIPTION
*
+ * SILC Crypto Accelerator Interface provides a generic interface for
+ * cryptographic accelerators. The interface can access different kind of
+ * accelerators, such as hardware accelerators. Using an accelerator can
+ * significantly improve encryption, decryption, signature and verification
+ * performance.
+ *
+ * Third-party accelerators can be registered into the accelerator interface
+ * and used through the same generic interface.
+ *
+ * The interface can be used to accelerate public and private keys, and
+ * ciphers.
+ *
***/
#ifndef SILCACC_H
#define SILCACC_H
-/****s* silcacc/SilcAccAPI/SilcAccelerator
+/****s* silcacc/SilcAccelerator
*
* NAME
*
va_list va); /* Initialize accelerator */
SilcBool (*uninit)(void); /* Uninitialize accelerator */
const SilcPKCSAlgorithm *pkcs; /* Accelerated PKCS algorithms */
+ const SilcCipherObject *cipher; /* Accelerated ciphers */
#if 0
const SilcDHObject *dh; /* Accelerated Diffie-Hellmans */
- const SilcCipherObject *cipher; /* Accelerated ciphers */
const SilcHashObject *hash; /* Accelerated hashes */
const SilcHmacObject *hmac; /* Accelerated HMACs */
const SilcRngObject *rng; /* Accelerated RNG's */
#endif /* 0 */
} *SilcAccelerator, SilcAcceleratorStruct;
-/****f* silcacc/SilcAccAPI/silc_acc_register
+/****f* silcacc/silc_acc_register
*
* SYNOPSIS
*
***/
SilcBool silc_acc_register(const SilcAccelerator acc);
-/****f* silcacc/SilcAccAPI/silc_acc_unregister
+/****f* silcacc/silc_acc_unregister
*
* SYNOPSIS
*
***/
void silc_acc_unregister(SilcAccelerator acc);
-/****f* silcacc/SilcAccAPI/silc_acc_init
+/****f* silcacc/silc_acc_find
+ *
+ * SYNOPSIS
+ *
+ * SilcAccelerator silc_acc_find(const char *name);
+ *
+ * DESCRIPTION
+ *
+ * Find accelerator by its name indicated by `name'. Returns the
+ * accelerator context or NULL if such accelerator is not registered.
+ *
+ ***/
+SilcAccelerator silc_acc_find(const char *name);
+
+/****f* silcacc/silc_acc_init
*
* SYNOPSIS
*
***/
SilcBool silc_acc_init(SilcAccelerator acc, SilcSchedule schedule, ...);
-/****f* silcacc/SilcAccAPI/silc_acc_uninit
+/****f* silcacc/silc_acc_uninit
*
* SYNOPSIS
*
***/
SilcBool silc_acc_uninit(SilcAccelerator acc);
-/****f* silcacc/SilcAccAPI/silc_acc_get_supported
+/****f* silcacc/silc_acc_get_supported
*
* SYNOPSIS
*
***/
SilcDList silc_acc_get_supported(void);
-/****f* silcacc/SilcAccAPI/silc_acc_find
- *
- * SYNOPSIS
- *
- * SilcAccelerator silc_acc_find(const char *name);
- *
- * DESCRIPTION
- *
- * Find accelerator by its name indicated by `name'. Returns the
- * accelerator context or NULL if such accelerator is not registered.
- *
- ***/
-SilcAccelerator silc_acc_find(const char *name);
-
-/****f* silcacc/SilcAccAPI/silc_acc_get_name
+/****f* silcacc/silc_acc_get_name
*
* SYNOPSIS
*
***/
const char *silc_acc_get_name(SilcAccelerator acc);
-/****f* silcacc/SilcAccAPI/silc_acc_public_key
+/****f* silcacc/silc_acc_public_key
*
* SYNOPSIS
*
* The associated `public_key' can be retrieved from the returned
* public key by calling silc_acc_get_public_key.
*
+ * If this returns NULL the public key could not be accelerated. This
+ * usually should not be considered serious error. Instead, the public
+ * key should be used without acceleration.
+ *
***/
SilcPublicKey silc_acc_public_key(SilcAccelerator acc,
SilcPublicKey public_key);
-/****f* silcacc/SilcAccAPI/silc_acc_private_key
+/****f* silcacc/silc_acc_private_key
*
* SYNOPSIS
*
* The associated `private_key' can be retrieved from the returned
* private key by calling silc_acc_get_private_key.
*
+ * If this returns NULL the private key could not be accelerated. This
+ * usually should not be considered serious error. Instead, the private
+ * key should be used without acceleration.
+ *
***/
SilcPrivateKey silc_acc_private_key(SilcAccelerator acc,
SilcPrivateKey private_key);
-/****f* silcacc/SilcAccAPI/silc_acc_get_public_key
+/****f* silcacc/silc_acc_get_public_key
*
* SYNOPSIS
*
SilcPublicKey silc_acc_get_public_key(SilcAccelerator acc,
SilcPublicKey public_key);
-/****f* silcacc/SilcAccAPI/silc_acc_get_private_key
+/****f* silcacc/silc_acc_get_private_key
*
* SYNOPSIS
*
SilcPrivateKey silc_acc_get_private_key(SilcAccelerator acc,
SilcPrivateKey private_key);
+/****f* silcacc/silc_acc_cipher
+ *
+ * SYNOPSIS
+ *
+ * SilcCipher silc_acc_cipher(SilcAccelerator acc, SilcCipher cipher);
+ *
+ * DESCRIPTION
+ *
+ * Accelerate the cipher indicated by `cipher'. Returns new accelerated
+ * SilcCipher context. It can be used just as normal cipher and must be
+ * freed by calilng silc_cipher_free. The associated `cipher' is not
+ * freed when the accelerated cipher is freed. The `cipher' must not be
+ * freed as long as it is accelerated.
+ *
+ * When key and IV is set for the accelerated cipher, it is also set to
+ * the associated cipher.
+ *
+ * The associated `cipher' can be retrieved from the accelerated cipher
+ * by calling silc_acc_get_cipher.
+ *
+ * If this returns NULL the cipher could not be accelerated. This
+ * usually should not be considered serious error. Instead, the cipher
+ * should be used without acceleration.
+ *
+ ***/
+SilcCipher silc_acc_cipher(SilcAccelerator acc, SilcCipher cipher);
+
+/****f* silcacc/silc_acc_get_cipher
+ *
+ * SYNOPSIS
+ *
+ * SilcCipher silc_acc_get_cipher(SilcAccelerator acc, SilcCipher cipher);
+ *
+ * DESCRIPTION
+ *
+ * Returns the underlaying cipher from the accelerated cipher indicated
+ * by `cipher'. Returns NULL if `cipher' is not accelerated cipher.
+ *
+ ***/
+SilcCipher silc_acc_get_cipher(SilcAccelerator acc, SilcCipher cipher);
+
#endif /* SILCACC_H */