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