From 4f0011a6b2e61648aa483123bd97384f2c19aa58 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Tue, 22 May 2007 14:42:19 +0000 Subject: [PATCH] updates. --- TODO | 76 ++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/TODO b/TODO index ecc39242..49071a22 100644 --- a/TODO +++ b/TODO @@ -373,20 +373,23 @@ SILC Accelerator Library Something in the lines of (preliminary): - /* Register accelerator to system */ - SilcBool silc_acc_register(const SilcAccelerator acc); + /* Register accelerator to system. Initializes the accelerator. */ + Varargs are optional accelerator specific init parameteres. */ + SilcBool silc_acc_register(const SilcAccelerator acc, ...); - /* Unregister accelerator */ + silc_acc_register(softacc, "min_threads", 2, "max_threads", 16, NULL); + + /* Unregister accelerator. Uninitializes the accelerator. */ SilcBool silc_acc_unregister(const SilcAccelerator acc); - /* Find existing accelerator. `name' is accelerator's name. Varags - are optional accelerator specific parameteres. */ - SilcAccelerator silc_acc_find(const char *name, ...); + /* Return list of the registered accelerators */ + SilcDList silc_acc_get_supported(void); - silc_acc_find("softacc", "min_threads", 2, "max_threads", 8, NULL); + /* Find existing accelerator. `name' is accelerator's name. */ + SilcAccelerator silc_acc_find(const char *name); - /* Return accelerator's displayable name */ - const char *silc_ac_get_display_name(SilcAccelerator acc); + /* Return accelerator's name */ + const char *silc_acc_get_name(SilcAccelerator acc); /* Accelerate `public_key'. Return accelerated public key. */ SilcPublicKey silc_acc_public_key(SilcAccelerator acc, @@ -404,42 +407,45 @@ SILC Accelerator Library SilcPrivateKey silc_acc_get_private_key(SilcAccelerator acc, SilcPrivateKey private_key); - typedef enum { - SILC_ACCELERATOR_PKCS, - SILC_ACCELERATOR_DH, - SILC_ACCELERATOR_CIPHER, - SILC_ACCELERATOR_HASH - } SilcAcceleratorType; - typedef struct SilcAcceleratorObject { const char *name; /* Accelerator's name */ - const char *display_name; /* Displayable name */ - union { - struct { - SilcPKCSObject *pkcs; /* Accelerator PKCS*/ - SilcPKCSAlgorithm *algorithm; /* Accelerator Alg, may be NULL */ - } pkcs; - - SilcDHObject *dh; - SilcCipherObject *cipher; - SilcHashObject *hash; - } u; - - SilcAcceleratorType type; /* Accelerator type */ + SilcBool (*init)(va_list va); /* Initialize accelerator */ + SilcBool (*uninit)(void); /* Uninitialize accelerator */ + const SilcPKCSAlgorithm *pkcs; /* Accelerated PKCS algorithms */ + const SilcDHObject *dh; /* Accelerated Diffie-Hellmans */ + const SilcCipherObject *cipher; /* Accelerated ciphers */ + const SilcHashObject *hash; /* Accelerated hashes */ + const SilcRngObject *rng; /* Accelerated RNG's */ } *SilcAccelerator, SilcAcceleratorStruct; + Allows accelerator to have multiple accelerators (cipher, hash etc) + and multiple different algorithms and implementations (SHA-1, SHA-256 etc). + SilcPublicKey->SilcSILCPublicKey->RsaPublicKey accelerated as: - SilcPublicKey->SilcAcceleratorSoftware->SilcSILCPublicKey->RsaPublicKey or - SilcPublicKey->SilcAcceleratorPublicKey->SilcAcceleratorSoftware-> - SilcSILCPublicKey->RsaPublicKey + SilcPublicKey->SilcAcceleratorPublicKey->SilcSoftAccPublicKey-> + SilcPublicKey->SilcSILCPublicKey->RsaPublicKey - The former one if u.pkcs.algorithm == NULL. + silc_acc_public_key creates SilcPublicKey and SilcAcceleratorPublicKey + and acc->pkcs->import_public_key creates SilcSoftAccPublicKey. o Implement software accelerator. It is a thread pool system where the public key and private key operations are executed in threads. - This implements SilcPKCSAlgorithm (and SilcPKCSObject if needed) that - implements the thread acclerated system. + const struct SilcAcceleratorObject softacc = + { + "softacc", softacc_init, softacc_uninit, + softacc_pkcs, NULL, NULL, NULL, NULL + } + + /* Called from silc_acc_private_key */ + int silc_softacc_import_private_key(void *key, SilcUInt32 key_len, + void **ret_private_key) + { + SilcSoftAccPrivateKey prv = silc_calloc(1, sizeof(*prv)); + prv->pkcs = acc->pkcs; + prv->private_key = key; + *ret_private_key = prv; + } (o Symmetric key cryptosystem acceleration? They are always sycnhronouos even with hardware acceleration so the crypto API shouldn't require -- 2.24.0