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 Remove SilcCommandCb from silccommand.h.
50
51  o All payload test routines into lib/silccore/tests/.
52
53
54 lib/silcclient, The Client Library
55 ==================================
56
57  o UDP SILC connection support to SILC server
58
59  o Giving WHOIS for nick that doesn't exist should remove any same
60    named entries from the client cache.
61
62  o peer-to-peer private messages
63
64  o Private message key request notification to application.  See XXX in
65    client_prvmsg.c.
66
67  o in JOIN notify handle resolving that timedout.  Currently the user is
68    never joined the channel if this happens.  What to do if message is
69    received from user that hasn't been resolved/joined?
70
71  o Message ACKing support.
72
73  o in /cmode and /cumode with +r, maybe the public key and private key
74    could be just some "string", which would then match to "string.pub" and
75    "string.prv".
76
77  o If the SILC Events (see below) are implemented, perhaps client library
78    should provide events so that application developer has a choice of
79    developing the SILC app with callbacks or with events.
80
81
82 Runtime library, lib/silcutil/
83 ==============================
84
85  o Fix universal time decoding (doesn't accept all formats) in silctime.c.
86
87  o Add functions to manipulate environment variables. (***DONE)
88
89  o Add functions to loading shared/dynamic object symbols (replaces the
90    SIM library (lib/silcsim) and introduces generic library).  Add this
91    to lib/silcutil/silcdll.[ch].  (***TESTING NEEDED WIN32, TODO Symbian)
92
93  o Add directory opening/traversing functions
94
95  o silc_getopt routines
96
97  o Add silc_stream_get_root and add get_root stream operation.  It 
98    returns the root of the stream or NULL if stream doesn't have root.
99    Like SilcPacketStream might return SilcSocketStream.
100
101  o Change some stream routines (like socket stream API) to accept ANY
102    stream and use silc_stream_get_root to get the socket stream from the
103    given stream.  This will make various stream APIs more easier to use
104    when user doesn't have to dig up the correct stream.
105
106  o The SILC Event signals.  Asynchronous events that can be created,
107    connected to and signalled.  Either own event routines or glued into
108    SilcSchedule:
109
110    SilcTask silc_schedule_task_add_event(SilcSchedule schedule,
111                                          const char *event, ...);
112    SilcBool silc_schedule_event_connect(SilcSchedule schedule,
113                                         const char *event,
114                                         SilcTaskCallback event_callback,
115                                         void *context);
116    SilcBool silc_schedule_event_signal(SilcSchedule schedule,
117                                        const char *event, ...);
118
119    Example:
120      silc_schedule_task_add_event(schedule, "connected",
121                                   SILC_PARAM_UI32_INT,
122                                   SILC_PARAM_BUFFER,
123                                   SILC_PARAM_END);
124      silc_schedule_event_connect(schedule, "connected", connected_cb, ctx);
125      silc_schedule_event_signal(schedule, "connected", integer, buf,
126                                  SILC_PARAM_END);
127      SILC_TASK_CALLBACK(connected_cb)
128      {
129        FooCtx ctx = context;
130        va_list args;
131        SilcUInt32 integer;
132        SilcBuffer buf;
133
134        va_start(args, context);
135        integer = va_arg(args, SilcUInt32);
136        buf = va_arg(args, SilcBuffer);
137        va_end(args);
138        ...
139      }
140
141    Problems: Events would be SilcSchedule specific, and would not work on
142    multi-thread/multi-scheduler system.  The events should be copyable
143    between schedulers.  Another problem is the signal delivery.  Do we
144    deliver them synchronously possibly from any thread to any other thread
145    or do we deliver them through the target schedulers.  If we use the
146    schedulers then signalling would be asynchronous (data must be
147    duplicated and later freed) which is not very nice.
148
149  o If the event signals are added, the SILC_PARAM_* stuff needs to be
150    moved from silcbuffmt.h to silctypes.h or something similar.
151
152  o In case the SILC Events are done we shall create a new concept of
153    parent and child SilcSchedule's.  When new SilcSchedule is created a
154    parent can be associated to it.  This association could be done either
155    directly by the parent or by any other children.  This way the signals
156    would in effect be global and would reach all children schedulers.
157
158    This relationship would be associative only.  The schedulers are still
159    independent and run independently from each other.   All schedulers
160    would be linked and could be accessed from any of the schedulers.
161    It should be possible to retrieve the parent and enumate all children
162    from any of the schedulers.
163
164    SilcSchedule silc_schedule_init(int max_tasks, void *app_context,
165                                    SilcSchedule parent);
166    SilcSchedule silc_schedule_get_parent(SilcSchedule schedule);
167
168  o Additional scheduler changes: optimize silc_schedule_wakeup.  Wakeup
169    only if the scheduler is actually waiting something.  If it is
170    delivering tasks wakeup is not needed.
171
172  o Structured log messages to Log API.  Allows machine readable log
173    messages.  Would allow sending of any kind of data in a log message.
174
175  o Base64 to an own API (***DONE)
176
177  o Timer API (***DONE)
178
179  o Add builtin SOCKS and HTTP Proxy support, well the SOCKS at least.
180    SILC currently supports SOCKS4 and SOCKS5 but it needs to be compiled
181    in separately.
182
183  o silc_stringprep to non-allocating version.
184
185  o silc_hash_table_replace -> silc_hash_table_set.  Retain support for
186    silc_hash_table_replace as macro. (***DONE)
187
188  o SilcStack aware SilcHashTable. (***DONE)
189
190  o SilcStack aware SilcDList. (***DONE)
191
192  o Thread pool API.  Add this to lib/silcutil/silcthread.[ch].  (***DONE)
193
194  o Fast mutex implementation.  Fast rwlock implementation.  Mutex and
195    rwlock implementation using atomic operations.
196
197  o Compression routines are missing.  The protocol supports packet
198    compression thus it must be implemented.  SILC Zip API must be
199    defined.
200
201  o Add new functions to SilcStack API in lib/silcutil/silcstack.[ch].  Add
202    silc_stack_[set|get]_alignment.  It defines the default alignment used
203    when allocating memory from stack.  It can be used to specify special
204    alignments too when needed (such as for hardware devices like crypto
205    accelerators).  Move also the low level silc_stack_malloc and
206    silc_stack_realloc from silcstack_i.h to silcstack.h.  Remove the
207    _ua unaligned memory allocation routines.  Remove unaligned memory
208    allocation possibility. (***DONE)
209
210  o silc_malloc et. al. to respect --with-alignment.
211
212  o Add '%@' format to silc_snprintf functions.  It marks for external
213    rendering function of following type:
214
215      /* Snprintf rendering function.  The `data' is rendered into a string
216         and allocated string is returned.  If NULL is returned the
217         rendering is skipped and ignored.  If the returned string does
218         not fit to the destination buffer it may be truncated. */
219      typedef char *(*SilcSnprintfRender)(void *data);
220
221    It can work like following:
222
223    char *id_renderer(void *data)
224    {
225      char tmp[32];
226      id_to_str(tmp, sizeof(tmp), (SilcID *)data);
227      return strdup(tmp);
228    }
229
230    silc_snprintf(buf, sizeof(buf), "Client ID %@", id_renderer, client_id);
231
232  o Change silc_gettimeofday on Unix to use clock_gettime with REALTIME
233    clock if it is available, otherwise use gettimeofday(). (***DONE)
234
235  (o Generic SilcStatus or SilcResult that includes all possible status and
236     error conditions, including those of SILC protocol.  Though, the SILC
237     protocol related status (currently in silcstatus.h) cannot be in
238     runtime library) maybe
239
240  (o SILC specific socket creation/closing routines to silcnet.h, wrappers
241   to all send(), recv(), sendto() etc.  Bad thing is that we'd have to
242   define all socket options, sockaddrs, etc.) maybe
243
244  (o mmap) maybe
245
246
247 lib/silcutil/symbian/
248 =====================
249
250  o Something needs to be thought to the logging globals as well,
251    like silc_debug etc.  They won't work on EPOC.  Perhaps logging
252    and debugging is to be disabled on EPOC.  The logging currently works
253    by it cannot be controlled, same with debugging.
254
255
256 SFTP Library, lib/silcsftp/
257 ===========================
258
259  o Read prefetch (read-ahead, reading ahead of time).  Maybe if this can
260    be done easily.
261
262
263 SKR Library, lib/silcskr/
264 =========================
265
266  o Add fingerprint as search constraint.
267
268  o Add OpenPGP support.  Adding, removing, fetching PGP keys.  (Keyring
269    support?)
270
271  o Add support for importing public keys from a directory and/or from a
272    file.  Add support for exporting the repository (different formats for
273    different key types?).
274
275  o Change the entire silc_skr_find API.  Remove SilcSKRFind and just simply
276    add the find constraints as variable argument list to silc_skr_find, eg:
277
278   silc_skr_find(skr, schedule, callback, context,
279                 SILC_SKR_FIND_PUBLIC_KEY, public_key,
280                 SILC_SKR_FIND_COUNTRY, "FI",
281                 SILC_SKR_FIND_USAGE, SILC_SKR_USAGE_AUTH,
282                 SILC_SKR_FIND_END);
283
284    NULL argument would be ignored and skipped.
285
286  o Add OR logical rule in addition of the current default AND, eg:
287
288   // Found key(s) MUST have this public key AND this country.
289   silc_skr_find(skr, schedule, callback, context,
290                 SILC_SKR_FIND_RULE_AND,
291                 SILC_SKR_FIND_PUBLIC_KEY, public_key,
292                 SILC_SKR_FIND_COUNTRY, "FI",
293                 SILC_SKR_FIND_END);
294
295   // Found key(s) MUST have this public key OR this key context
296   silc_skr_find(skr, schedule, callback, context,
297                 SILC_SKR_FIND_RULE_OR,
298                 SILC_SKR_FIND_PUBLIC_KEY, public_key,
299                 SILC_SKR_FIND_CONTEXT, key_context,
300                 SILC_SKR_FIND_END);
301
302  o SilcStack to SKR API.
303
304
305 Crypto Library, lib/silccrypt/
306 ==============================
307
308  o Add silc_crypto_init and silc_crypto_uninit.  The _init should take
309    SilcStack that will act as global memory pool for all of crypto
310    library.  It should not be necessary anymore to separately register
311    default ciphers, HMACs, etc, the _init would do that.  However, if
312    user after _init calls silc_pkcs_register, for example, it would take
313    preference over the default once, ie. user can always dictate the
314    order of algorithms. (***DONE)
315
316  o Add fingerprint to SilcSILCPublicKey and retrieval to silcpk.h, and
317    possibly to silcpkcs.h.
318
319    /* Return fingerprint of the `public_key'.  Returns also the algorithm
320       that has been used to make the fingerprint. */
321    const unsigned char *
322    silc_pkcs_get_fingerprint(SilcPublicKey public_key,
323                              const char **hash_algorithm,
324                              SilcUInt32 *fingerprint_len);
325
326  o Change SILC PKCS API to asynchronous, so that accelerators can be used.
327    All PKCS routines should now take callbacks as argument and they should
328    be delivered to SilcPKCSObject and SilcPKCSAlgorithm too. (***DONE)
329
330  o Change PKCS Algorithm API to take SilcPKCSAlgorithm as argument to
331    encrypt, decrypt, sign and verify functions.  We may need to for exmaple
332    check the alg->hash, supported hash functions.  Maybe deliver it also
333    to all other functions in SilcPKCSAlgorithm to be consistent. (***DONE)
334
335  o Add DSA support to SILC public key.
336
337  o Add DSS support. (***DONE)
338
339  o Implement the defined SilcDH API.  The definition is in
340    lib/silccrypt/silcdh.h.  Make sure it is asynchronous so that it can
341    be accelerated.  Also take into account that it could use elliptic
342    curves.
343
344  o Add ECDSA support.
345
346  o Add ECDH support.
347
348  o AES CBC is missing proper alignment code (see silc_1_1_branch).
349
350  o All cipher, hash, hmac etc. allocation routines should take their name
351    in as const char * not const unsigned char *. (***DONE)
352
353
354 SILC Accelerator Library
355 ========================
356
357  o SILC Accelerator API.  Provides generic way to use different kind of
358    accelerators.  Basically implements SILC PKCS API so that SilcPublicKey
359    and SilcPrivateKey can be used but they call the accelerators.
360    (***DONE)
361
362  o Implement software accelerator.  It is a thread pool system where the
363    public key and private key operations are executed in threads. 
364    (***DONE)
365
366  o Diffie-Hellman acceleration
367
368  (o Symmetric key cryptosystem acceleration?  They are always sycnhronouos
369    even with hardware acceleration so the crypto API shouldn't require
370    changes.) maybe
371
372
373 lib/silcmath
374 ============
375
376  o Import TFM.  We want TFM's speed but its memory requirements are
377    just too much.  By default it uses large pre-allocated tables which 
378    will eat memory when there are thousands of public keys in system.
379    We probably want to change TFM's fp_int dynamic so that a specific
380    size can be allocated for the int.  We could have two new functions:
381
382    SilcBool silc_mp_init_size(SilcMPInt *mp, SilcUInt32 bit_size);
383    SilcBool silc_mp_sinit_size(SilcStack stack, SilcMPInt *mp,
384                                SilcUInt32 bit_size);
385
386    Which by default allocates `bit_size' bits instead of some default
387    value.  silc_mp_init would allocate the default FP_SIZE with TFM
388    and do normal init with TMA and GMP.  _init_size with TMA and GMP
389    would be same as _init.
390
391  o Add AND, OR and XOR support to TFM or ask Tom to do it.
392
393  o The SILC MP API function must start returning indication of success
394    and failure of the operation.
395
396  o Do SilcStack support for silc_mp_init, silc_mp_init_size and other
397    any other MP function (including utility ones) that may allocate
398    memory.
399
400  o All utility functions should be made non-allocating ones.
401
402
403 SILC XML Library, lib/silcxml/
404 ==============================
405
406  o SILC XML API (wrapper to expat).  Look at the expat API and simplify
407    it.  The SILC XML API should have at most 8-10 API functions.  It should
408    be possible to create full XML parser with only one function.  And, it
409    should be possible to have a function that is able to parse an entire
410    XML document.  It should also have a parser function to be able to
411    parse a stream of XML data (SilcStream).  It MUST NOT have operations
412    that require multiple function calls to be able to execute that one
413    operation (like creating parser).
414
415
416 lib/silcske/silcske.[ch]
417 ========================
418
419  o Ratelimit to UDP/IP transport for incoming packets.
420
421
422 lib/silcasn1
423 ============
424
425  o Negative integer encoding is missing, add it.
426
427  o SILC_ASN1_CHOICE should perhaps return an index what choice in the
428    choice list was found.  Currently it is left for caller to figure out
429    which choice was found. (***DONE)
430
431  o SILC_ASN1_NULL in decoding should return SilcBool whether or not
432    the NULL was present.  It's important when it's SILC_ASN1_OPTIONAL
433    and we need to know whether it was present or not. (***DONE)
434
435
436 lib/silcpgp
437 ===========
438
439  o OpenPGP certificate support, allowing the use of PGP public keys.
440
441
442 lib/silcssh
443 ===========
444
445  o SSH2 public key/private key support, allowing the use of SSH2 keys.
446    RFC 4716.  (***DONE)
447
448
449 lib/silcpkix
450 ============
451
452  o PKIX implementation
453
454
455 apps/silcd
456 ==========
457
458  o Deprecate the old server.  Write interface for the new lib/silcserver
459    server library.  The interface should work on Unix/Linux systems.
460
461  o Consider deprecating also the old config file format and use XML
462    istead.  This should require SILC XML API implementation first.
463
464  o The configuration must support dynamic router and server connections.
465    The silcd must work without specifying any servers or routers to
466    connect to.
467
468  o The configuration must support specifying whether the server is
469    SILC Server or SILC Router.  This should not be deduced from the
470    configuration as it was in < 1.2.
471
472  o The configuration must support specifying the ciphers and hmacs and
473    their order so that user can specify which algorithms take preference.
474
475
476 lib/silcserver
477 ==============
478
479  o Rewrite the entire server.  Deprecate apps/silcd as the main server
480    implementation and create lib/silcserver/.  It is a platform
481    independent server library.  The apps/silcd will merely provide a
482    a simple interface for the library.
483
484  o Write the SILC Server library extensively using SILC FSM.
485
486  o Server library must support multiple networks.  This means that one
487    server must be able to create multiple connections that each reach
488    different SILC network.  This means also that all cache's etc. must
489    be either connection-specific or network-specific.
490
491  o Library must support dynamic router and server connections.  This means
492    that connections are create only when they are needed, like when someone
493    says JOIN foo@foo.bar.com or WHOIS foobar@silcnet.org.
494
495  o Library must support server-to-server connections even though protocol
496    prohibits that.  The responder of the connection should automatically
497    act as a router.  The two servers create an own, isolated, SILC network.
498    To be used specifically with dynamic connections.
499
500  o Library must support multiple threads and must be entirely thread safe.
501
502  o Library must have support for SERVICE command.
503
504  o Both UDP and TCP support for incoming connecetions.  Maintaining long
505    term UDP sessions.
506
507  o The server must be able to run behind NAT device.  This means that
508    Server ID must be based on public IP instead of private IP.
509
510  o The following data must be in per-connection context: client id cache,
511    server id cache, channel id cache, all statistics must be
512    per-connection.
513
514  o The following data must be in per-thread context: command context
515    freelist/pool, pending commands, random number generator.
516
517  o Do inccoming packet processing in an own FSM thread in the
518    server-threads FSM.  Same as in client library.
519
520  o Reference count all Silc*Entry structures.
521
522  Some issues that must be kept in mind from 1.0 and 1.1 silcd's:
523
524  o The SERVER_SIGNOFF notify handing is not optimal, because it'll
525    cause sending of multiple SIGNOFF notify's instead of the one
526    SERVER_SIGNOFF notify that the server received.  This should be
527    optimized so that the only SERVER_SIGNOFF is sent and not
528    SIGNOFF of notify at all (using SIGNOFF takes the idea about
529    SERVER_SIGNOFF away entirely).
530
531  o Another SERVER_SIGNOFF opt/bugfix:  Currently the signoff is
532    sent to a client if it is on same channel as the client that
533    signoffed.  However, the entire SERVER_SIGNOFF list is sent to
534    the client, ie. it may receive clients that was not on the
535    same channel.  This is actually against the specs.  It must be
536    done per channel.  It shouldn't receive the whole list just
537    because one client happened to be on same channel.
538
539  o If client's public key is saved in the server (and doing public key
540    authentication) then the hostname and the username information could
541    be taken from the public key.  Should be a configuration option!
542
543  o Add a timeout to handling incoming JOIN commands.  It should be
544    enforced that JOIN command is executed only once in a second or two
545    seconds.  Now it is possible to accept n incoming JOIN commands
546    and process them without any timeouts.  THis must be employed because
547    each JOIN command will create and distribute the new channel key
548    to everybody on the channel.
549
550  o Related to above.  If multiple JOINs are received in sequence perhaps
551    new key should be created only once, if the JOINs are handeled at the same
552    time.  Now we create multiple keys and never end up using them because
553    many JOINs are processed at the same time in sequence.  Only the last
554    key ends up being used.