updates.
[silc.git] / TODO
1 TODO for 1.2 And Beyond
2 =======================
3
4 NOTE: Any item that doesn't have (***DONE) in it, isn't done yet.  The
5 (***TESTING NEEDED) means that the item has been done but not yet properly
6 tested.
7
8 NOTE: A TODO entry does not mean that it is ever going to be done.  Some 
9 of the entries may be just ideas, good, bad or ugly.  If you want to work 
10 on some of the TODO entries simply let us know about it by dropping a note 
11 to silc-devel mailing list or appear on 'silc' channel on SILCNet.
12
13
14 General
15 =======
16
17  o Create apps/tutorial containing various Toolkit API tutorials.
18
19  o The Toolkit split.  The Toolkit is to be splitted in parts.  How many
20    parts and what the parts are isn't decided yet.  Each part is a separate
21    software package.  Current thinking is of the following:
22
23    SILC Toolkit                 SILC protocol, client and server library
24    SILC Runtime Toolkit         runtime library
25    SILC Crypto Toolkit          crypto, asn1, math, skr, pgp, etc.
26
27    The rationale for this is of course that other than SILC projects
28    might like to use the various libraries SILC Toolkit provides, but
29    naturally they don't want the bloat of SILC protocol related stuff.
30
31    The Runtime library in SILC Toolkit is a general purpose runtime library,
32    like Glib and APR are.  The runtime library is to be developed further
33    to provide alternative to Glib and APR.
34
35    The Crypto library in SILC Toolkit is a general purpose crypto library
36    providing pretty nice APIs compared to many other crypto libraries,
37    especially OpenSSL.  The Crypto library is to be developed further
38    to include support for OpenPGP, X.509 and SSH2.
39
40
41 lib/silccore
42 ============
43
44  o SILC_PACKET_FLAG_ACK support.  Implement ACK packet and packet payload
45    to silcpacket.c.
46
47  o All payload encoding routines should take SilcStack as argument.
48
49  o All payload test routines into lib/silccore/tests/.
50
51
52 lib/silcclient, The Client Library
53 ==================================
54
55  o peer-to-peer private messages
56
57  o Private message key request notification to application.  See XXX in
58    client_prvmsg.c.
59
60  o in JOIN notify handle resolving that timedout.  Currently the user is
61    never joined the channel if this happens.  What to do if message is
62    received from user that hasn't been resolved/joined?
63
64  o Message ACKing support.
65
66  o in /cmode and /cumode with +r, maybe the public key and private key
67    could be just some "string", which would then match to "string.pub" and
68    "string.prv".
69
70
71 Runtime library, lib/silcutil/
72 ==============================
73
74  o Fix universal time decoding (doesn't accept all formats) in silctime.c.
75
76  o Add functions to manipulate environment variables.
77
78    SilcBool silc_setenv(const char *variable, const char *value);
79    const char *silc_getenv(const char *variable);
80    SilcBool silc_clearenv(const char *variable);
81
82  o Add functions to loading shared/dynamic object symbols (replaces the
83    SIM library (lib/silcsim) and introduces generic library).  Add this
84    to lib/silcutil/silcdll.[ch].
85
86    SilcDll silc_dll_load(const char *object_path, SilcDllFlags flags);
87    void silc_dll_close(SilcDll dll);
88    void *silc_dll_getsym(SilcDll dll, const char *symbol);
89    const char *silc_dll_error(SilcDll dll);
90
91  o Add directory opening/traversing functions
92
93  o silc_getopt routines
94
95  o silc_hash_table_replace -> silc_hash_table_set.  Retain support for
96    silc_hash_table_replace as macro.
97
98  o The SILC Event signals.  Asynchronous events that can be created,
99    connected to and signalled.  Either own event routines or glued into
100    SilcSchedule:
101
102    SilcTask silc_schedule_task_add_event(SilcSchedule schedule,
103                                          const char *event, ...);
104    SilcBool silc_schedule_event_connect(SilcSchedule schedule,
105                                         const char *event,
106                                         SilcTaskCallback event_callback,
107                                         void *context);
108    SilcBool silc_schedule_event_signal(SilcSchedule schedule,
109                                        const char *event, ...);
110
111    Example:
112      silc_schedule_task_add_event(schedule, "connected",
113                                   SILC_PARAM_UI32_INT,
114                                   SILC_PARAM_BUFFER,
115                                   SILC_PARAM_END);
116      silc_schedule_event_connect(schedule, "connected", connected_cb, ctx);
117      silc_schedule_event_signal(schedule, "connected", integer, buf,
118                                  SILC_PARAM_END);
119      SILC_TASK_CALLBACK(connected_cb)
120      {
121        FooCtx ctx = context;
122        va_list args;
123        SilcUInt32 integer;
124        SilcBuffer buf;
125  
126        va_start(args, context);
127        integer = va_arg(args, SilcUInt32);
128        buf = va_arg(args, SilcBuffer);
129        va_end(args);
130        ...
131      }
132
133    Problems: Events would be SilcSchedule specific, and would not work on 
134    multi-thread/multi-scheduler system.  The events should be copyable 
135    between schedulers.  Another problem is the signal delivery.  Do we
136    deliver them synchronously possibly from any thread to any other thread
137    or do we deliver them through the target schedulers.  If we use the
138    schedulers then signalling would be asynchronous (data must be 
139    duplicated and later freed) which is not very nice.
140
141  o If the event signals are added, the SILC_PARAM_* stuff needs to be
142    moved from silcbuffmt.h to silctypes.h or something similar.
143
144  o In case the SILC Events are done we shall create a new concept of
145    parent and child SilcSchedule's.  When new SilcSchedule is created a
146    parent can be associated to it.  This association could be done either
147    directly by the parent or by any other children.  This way the signals
148    would in effect be global and would reach all children schedulers.
149
150    This relationship would be associative only.  The schedulers are still
151    independent and run independently from each other.   All schedulers
152    would be linked and could be accessed from any of the schedulers.
153    It should be possible to retrieve the parent and enumate all children
154    from any of the schedulers.
155
156    SilcSchedule silc_schedule_init(int max_tasks, void *app_context,
157                                    SilcSchedule parent);
158    SilcSchedule silc_schedule_get_parent(SilcSchedule schedule);
159
160  o Additional scheduler changes: optimize silc_schedule_wakeup.  Wakeup 
161    only if the scheduler is actually waiting something.  If it is 
162    delivering tasks wakeup is not needed.
163
164  o Structured log messages to Log API.  Allows machine readable log
165    messages.  Would allow sending of any kind of data in a log message.
166
167  o Base64 to an own API
168
169  o Timer API
170
171  o Add builtin SOCKS and HTTP Proxy support, well the SOCKS at least.
172    SILC currently supports SOCKS4 and SOCKS5 but it needs to be compiled
173    in separately.
174
175  o silc_stringprep to non-allocating version.
176
177  o SilcStack aware SilcHashTable.
178
179  o SilcStack aware SilcDList.
180
181  o Thread pool API.  Add this to lib/silcutil/silcthread.[ch].
182
183    typedef void (*SilcThreadPoolFunc)(SilcSchedule schedule,
184                                       void *context);
185
186    /* Allocate thread pool with at least `min_threads' and at most
187       `max_threads' many threads.  If `stack' is non-NULL all memory
188       is allocated from the `stack'.  If `start_min_threads' is TRUE
189       this will start `min_threads' many threads immediately. */
190    SilcThreadPool silc_thread_pool_alloc(SilcStack stack,
191                                          SilcUInt32 min_threads,
192                                          SilcUInt32 max_threads,
193                                          SilcBool start_min_threads);
194
195    /* Free thread pool.  If `wait_unfinished' is TRUE this will block
196       and waits that all remaining active threads finish before freeing
197       the pool. */
198    void silc_thread_pool_free(SilcThreadPool tp, SilcBool wait_unfinished);
199
200    /* Run `run' function with `run_context' in one of the threads in the
201       thread pool.  Returns FALSE if the thread pool is being freed.  If
202       there are no free threads left in the pool this will queue the
203       the `run' and will call it once a thread becomes free.
204
205       If `completion' is non-NULL it will be called to indicate completion
206       of the `run' function.  If `schedule' is non-NULL the `completion'
207       will be called through the scheduler in the main thread.  If it is
208       NULL the `completion' is called directly from the thread after the
209       `run' has returned. */
210    SilcBool silc_thread_pool_run(SilcThreadPool tp,
211                                  SilcSchedule schedule,
212                                  SilcThreadPoolFunc run,
213                                  void *run_context,
214                                  SilcThreadPoolFunc completion,
215                                  void *completion_context);
216
217    /* Modify the amount of maximum threads of the pool. */
218    void silc_thread_pool_set_max_threads(SilcThreadPool tp,
219                                          SilcUInt32 max_threads);
220
221    /* Returns the amount of maximum size the pool can grow. */
222    SilcUInt32 silc_thread_pool_num_max_threads(SilcThreadPool tp);
223
224    /* Returns the amount of free threads in the pool currently. */
225    SilcUInt32 silc_thread_pool_num_free_threads(SilcThreadPool tp);
226
227    /* Stops all free and started threads.  The minumum amount of threads
228       specified to silc_thread_pool_alloc always remains. */
229    void silc_thread_pool_purge(SilcThreadPool tp);
230
231  o Fast mutex implementation.  Fast rwlock implementation.  Mutex and
232    rwlock implementation using atomic operations.
233
234  o Compression routines are missing.  The protocol supports packet
235    compression thus it must be implemented.  SILC Zip API must be
236    defined.
237
238  (o Generic SilcStatus or SilcResult that includes all possible status and 
239     error conditions, including those of SILC protocol.  Though, the SILC
240     protocol related status (currently in silcstatus.h) cannot be in 
241     runtime library) maybe
242
243  (o SILC specific socket creation/closing routines to silcnet.h, wrappers
244   to all send(), recv(), sendto() etc.  Bad thing is that we'd have to
245   define all socket options, sockaddrs, etc.) maybe
246
247  (o mmap) maybe
248
249
250 lib/silcutil/symbian/
251 =====================
252
253  o Something needs to be thought to the logging globals as well,
254    like silc_debug etc.  They won't work on EPOC.  Perhaps logging
255    and debugging is to be disabled on EPOC.  The logging currently works
256    by it cannot be controlled, same with debugging.
257
258
259 SFTP Library, lib/silcsftp/
260 ===========================
261
262  o Read prefetch (read-ahead, reading ahead of time).  Maybe if this can
263    be done easily.
264
265
266 SKR Library, lib/silcskr/
267 =========================
268
269  o Add fingerprint as search constraint.
270
271  o Add OpenPGP support.  Adding, removing, fetching PGP keys.  (Keyring
272    support?)
273
274  o Add support for importing public keys from a directory and/or from a
275    file.  Add support for exporting the repository (different formats for
276    different key types?).
277
278  o Change the entire silc_skr_find API.  Remove SilcSKRFind and just simply
279    add the find constraints as variable argument list to silc_skr_find, eg:
280
281   silc_skr_find(skr, schedule, callback, context,
282                 SILC_SKR_FIND_PUBLIC_KEY, public_key,
283                 SILC_SKR_FIND_COUNTRY, "FI",
284                 SILC_SKR_FIND_USAGE, SILC_SKR_USAGE_AUTH,
285                 SILC_SKR_FIND_END);
286
287    NULL argument would be ignored and skipped.
288
289  o Add OR logical rule in addition of the current default AND, eg:
290
291   // Found key(s) MUST have this public key AND this country.
292   silc_skr_find(skr, schedule, callback, context,
293                 SILC_SKR_FIND_RULE_AND,
294                 SILC_SKR_FIND_PUBLIC_KEY, public_key,
295                 SILC_SKR_FIND_COUNTRY, "FI",
296                 SILC_SKR_FIND_END);
297
298   // Found key(s) MUST have this public key OR this key context
299   silc_skr_find(skr, schedule, callback, context,
300                 SILC_SKR_FIND_RULE_OR,
301                 SILC_SKR_FIND_PUBLIC_KEY, public_key,
302                 SILC_SKR_FIND_CONTEXT, key_context,
303                 SILC_SKR_FIND_END);
304
305
306 Crypto Library, lib/silccrypt/
307 ==============================
308
309  o Add fingerprint to SilcSILCPublicKey and retrieval to silcpk.h, and
310    possibly to silcpkcs.h.
311
312    /* Return fingerprint of the `public_key'.  Returns also the algorithm
313       that has been used to make the fingerprint. */
314    const unsigned char *
315    silc_pkcs_get_fingerprint(SilcPublicKey public_key,
316                              const char **hash_algorithm,
317                              SilcUInt32 *fingerprint_len);
318
319  o Change SILC PKCS API to asynchronous, so that accelerators can be used.
320    All PKCS routines should now take callbacks as argument and they should
321    be delivered to SilcPKCSObject and SilcPKCSAlgorithm too.
322
323    /* Signature computation callback */
324    typedef void (*SilcPKCSSignCb)(SilcBool success,
325                                   const unsigned char *signature,
326                                   SilcUInt32 signature_len,
327                                   void *context);
328
329    /* Signature verification callback */
330    typedef void (*SilcPKCSVerifyCb)(SilcBool success, void *context);
331
332    /* Encryption callback */
333    typedef void (*SilcPKCSEncryptCb)(SilcBool success,
334                                      const unsigned char *encrypted,
335                                      SilcUInt32 encrypted_len,
336                                      void *context);
337
338    /* Decryption callback */
339    typedef void (*SilcPKCSDecryptCb)(SilcBool success,
340                                      const unsigned char *decrypted,
341                                      SilcUInt32 decrypted_len,
342                                      void *context);
343
344    Either add new _async functions or add the callbacks to existing API
345    and if the callback is NULL then the API is not async and if provided
346    it may be async.  For example;
347
348    SilcBool silc_pkcs_sign(SilcPrivateKey private_key,
349                            unsigned char *src, SilcUInt32 src_len,
350                            unsigned char *dst, SilcUInt32 dst_size,
351                            SilcUInt32 *dst_len,
352                            SilcBool compute_hash, SilcHash hash,
353                            SilcPKCSSignCb async_sign,
354                            void *async_sign_context);
355
356    (if this is done then there's no reason why the buffers in the 
357     callbacks cannot be the ones user gives here) or allow only async:
358
359    SilcBool silc_pkcs_sign(SilcPrivateKey private_key,
360                            unsigned char *src, SilcUInt32 src_len,
361                            SilcBool compute_hash, SilcHash hash,
362                            SilcPKCSSignCb async_sign,
363                            void *async_sign_context);
364
365    or add new:
366
367    SilcBool silc_pkcs_sign_async(SilcPrivateKey private_key,
368                                  unsigned char *src, SilcUInt32 src_len,
369                                  SilcBool compute_hash, SilcHash hash,
370                                  SilcPKCSSignCb async_sign,
371                                  void *async_sign_context);
372
373  o Change PKCS Algorithm API to take SilcPKCSAlgorithm as argument to
374    encrypt, decrypt, sign and verify functions.  We may need to for exmaple
375    check the alg->hash, supported hash functions.  Maybe deliver it also
376    to all other functions in SilcPKCSAlgorithm to be consistent.
377
378  o Add DSS support.  Take implementation from Tom or make it yourself.
379
380  o Implement the defined SilcDH API.  The definition is in
381    lib/silccrypt/silcdh.h.  Make sure it is asynchronous so that it can
382    be accelerated.  Also take into account that it could use elliptic
383    curves.
384
385  o ECDSA and ECDH
386
387  o All cipher, hash, hmac etc. allocation routines should take their name
388    in as const char * not const unsigned char *.
389
390
391 SILC Accelerator Library
392 ========================
393
394  o SILC Accelerator API.  Provides generic way to use different kind of
395    accelerators.  Basically implements SILC PKCS API so that SilcPublicKey
396    and SilcPrivateKey can be used but they call the accelerators.
397
398    Something in the lines of (preliminary):
399
400    /* Register accelerator to system.  Initializes the accelerator. */
401       Varargs are optional accelerator specific init parameteres. */
402    SilcBool silc_acc_register(SilcAccelerator acc, ...);
403
404      silc_acc_register(softacc, "min_threads", 2, "max_threads", 16, NULL);
405
406    /* Unregister accelerator.  Uninitializes the accelerator. */
407    SilcBool silc_acc_unregister(const SilcAccelerator acc);
408
409    /* Return list of the registered accelerators */
410    SilcDList silc_acc_get_supported(void);
411
412    /* Find existing accelerator.  `name' is accelerator's name. */
413    SilcAccelerator silc_acc_find(const char *name);
414
415    /* Return accelerator's name */
416    const char *silc_acc_get_name(SilcAccelerator acc);
417
418    /* Accelerate `public_key'.  Return accelerated public key. */
419    SilcPublicKey silc_acc_public_key(SilcAccelerator acc,
420                                      SilcPublicKey public_key);
421
422    /* Accelerate `private_key'.  Returns accelerated private key. */
423    SilcPrivateKey silc_acc_private_key(SilcAccelerator acc,
424                                        SilcPrivateKey private_key);
425
426    /* Return the underlaying public key */
427    SilcPublicKey silc_acc_get_public_key(SilcAccelerator acc,
428                                          SilcPublicKey public_key);
429
430    /* Return the underlaying private key */
431    SilcPrivateKey silc_acc_get_private_key(SilcAccelerator acc,
432                                            SilcPrivateKey private_key);
433
434    typedef struct SilcAcceleratorObject {
435      const char *name;                  /* Accelerator's name */
436      SilcBool (*init)(va_list va);      /* Initialize accelerator */
437      SilcBool (*uninit)(void);          /* Uninitialize accelerator */
438      const SilcPKCSAlgorithm *pkcs;     /* Accelerated PKCS algorithms */
439      const SilcDHObject *dh;            /* Accelerated Diffie-Hellmans */
440      const SilcCipherObject *cipher;    /* Accelerated ciphers */
441      const SilcHashObject *hash;        /* Accelerated hashes */
442      const SilcHmacObject *hmac;        /* Accelerated HMACs */
443      const SilcRngObject *rng;          /* Accelerated RNG's */
444    } *SilcAccelerator, SilcAcceleratorStruct;
445
446    Allows accelerator to have multiple accelerators (cipher, hash etc)
447    and multiple different algorithms and implementations (SHA-1, SHA-256 etc).
448
449    SilcPublicKey->SilcSILCPublicKey->RsaPublicKey accelerated as:
450    SilcPublicKey->SilcAcceleratorPublicKey->SilcSoftAccPublicKey->
451      SilcPublicKey->SilcSILCPublicKey->RsaPublicKey
452
453    silc_acc_public_key creates SilcPublicKey and SilcAcceleratorPublicKey
454    and acc->pkcs->import_public_key creates SilcSoftAccPublicKey.
455
456  o Implement software accelerator.  It is a thread pool system where the
457    public key and private key operations are executed in threads.
458
459    const struct SilcAcceleratorObject softacc =
460    {
461      "softacc", softacc_init, softacc_uninit,
462      softacc_pkcs, NULL, NULL, NULL, NULL
463    }
464
465    /* Called from silc_acc_private_key */
466    int silc_softacc_import_private_key(void *key, SilcUInt32 key_len,
467                                        void **ret_private_key)
468    {
469      SilcSoftAccPrivateKey prv = silc_calloc(1, sizeof(*prv));
470      prv->pkcs = acc->pkcs;
471      prv->private_key = key;
472      *ret_private_key = prv;
473    }
474
475  (o Symmetric key cryptosystem acceleration?  They are always sycnhronouos
476    even with hardware acceleration so the crypto API shouldn't require
477    changes.) maybe
478
479
480 lib/silcmath
481 ============
482
483  o Import TFM.  Talk to Tom to add the missing functions.  Use TFM in
484    client and client library, but TMA in server, due to the significantly
485    increased memory consumption with TFM, and the rare need for public
486    key operations in server.
487
488    We want TFM's speed but not TFM's memory requirements.  Talk to Tom
489    about making the TFM mp dynamic just as it is in LTM.
490
491  o The SILC MP API function must start returning indication of success
492    and failure of the operation.
493
494  o Do SilcStack support for silc_mp_init, silc_mp_init_size and other
495    any other MP function (including utility ones) that may allocate
496    memory.
497
498  o All utility functions should be made non-allocating ones.
499
500
501 SILC XML Library, lib/silcxml/
502 ==============================
503
504  o SILC XML API (wrapper to expat).  Look at the expat API and simplify
505    it.  The SILC XML API should have at most 8-10 API functions.  It should 
506    be possible to create full XML parser with only one function.  And, it 
507    should be possible to have a function that is able to parse an entire
508    XML document.  It should also have a parser function to be able to
509    parse a stream of XML data (SilcStream).  It MUST NOT have operations
510    that require multiple function calls to be able to execute that one
511    operation (like creating parser).
512
513
514 lib/silcske/silcske.[ch]
515 ========================
516
517  o Ratelimit to UDP/IP transport for incoming packets.
518
519
520 lib/silcasn1
521 ============
522
523  o Negative integer encoding is missing, add it.
524
525  o SILC_ASN1_CHOICE should perhaps return an index what choice in the
526    choice list was found.  Currently it is left for caller to figure out
527    which choice was found.
528
529  o SILC_ASN1_NULL in decoding should return SilcBool whether or not
530    the NULL was present.  It's important when it's SILC_ASN1_OPTIONAL
531    and we need to know whether it was present or not.
532
533
534 lib/silcpgp
535 ===========
536
537  o OpenPGP certificate support, allowing the use of PGP public keys
538    in SILC.
539
540
541 lib/silcssh
542 ===========
543
544  o SSH2 public key/private key support, allowing the use of SSH2 keys
545    in SILC.  RFC 4716.
546
547
548 lib/silcpkix
549 ============
550
551  o PKIX implementation
552
553
554 lib/silcserver
555 ==============
556
557  o (Re)write commands/command replys.
558
559  o (Re)write notify handling.
560
561  o The SERVER_SIGNOFF notify handing is not optimal, because it'll
562    cause sending of multiple SIGNOFF notify's instead of the one
563    SERVER_SIGNOFF notify that the server received.  This should be
564    optimized so that the only SERVER_SIGNOFF is sent and not
565    SIGNOFF of notify at all (using SIGNOFF takes the idea about
566    SERVER_SIGNOFF away entirely).
567
568  o Another SERVER_SIGNOFF opt/bugfix:  Currently the signoff is
569    sent to a client if it is on same channel as the client that
570    signoffed.  However, the entire SERVER_SIGNOFF list is sent to
571    the client, ie. it may receive clients that was not on the
572    same channel.  This is actually against the specs.  It must be
573    done per channel.  It shouldn't receive the whole list just
574    because one client happened to be on same channel.
575
576  o Add reference counters to all Silc*Entry structures
577
578  o SERVICEs support (plugin, SIM)
579
580  o If client's public key is saved in the server (and doing public key
581    authentication) then the hostname and the username information could
582    be taken from the public key.  Should be a configuration option!
583
584  o Add a timeout to handling incoming JOIN commands.  It should be
585    enforced that JOIN command is executed only once in a second or two
586    seconds.  Now it is possible to accept n incoming JOIN commands
587    and process them without any timeouts.  THis must be employed because
588    each JOIN command will create and distribute the new channel key
589    to everybody on the channel.
590
591  o Related to above.  If multiple JOINs are received in sequence perhaps
592    new key should be created only once, if the JOINs are handeled at the same
593    time.  Now we create multiple keys and never end up using them because
594    many JOINs are processed at the same time in sequence.  Only the last
595    key ends up being used.
596
597  o The CMODE cipher & hmac change problem (#101).