~ubuntu-branches/ubuntu/lucid/gnome-keyring/lucid-proposed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
HACKING GNOME KEYRING 

Patches should be submitted to bugzilla:
http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-keyring

The gnome-keyring mailing list is:
gnome-keyring-list@gnome.org

An overview of the architecture and graphical outline can be found here:

http://live.gnome.org/GnomeKeyring/Architecture

Gnome Keyring is made up of several distinct parts working on concert with 
each other. These parts generally live in different directories:

daemon 
   The main daemon startup code and gnome-keyring password protocol operations. 

daemon/pkcs11
   The various hooks that connect the PKCS#11 modules and code into the daemon.

daemon/ui 
   Prompting the user, asking for passwords.
   
egg
   Code that either: a) Really should be implemented elsewhere (eg: glib) but isn't.
   b) Code that needs to be shared between loosely coupled gnome-keyring components.  

gcr
   A public library for bits of crypto UI and parsing etc...
   
gp11
   A public library for accessing PKCS#11 modules. 

pam 
   The PAM module that unlocks the login keyring when the user logs in.
   
pkcs11
   The various bits of the PKCS#11 implementation.

pkcs11/gck
   A base library for implementing our internal PKCS#11 modules.
   
pkcs11/plex-layer
   A PKCS#11 module that combines slots from multiple PKCS#11 modules into one module.
   
pkcs11/roots-store
   A PKCS#11 module that exposes Root CA certificates from a directory like /etc/ssl/certs
   
pkcs11/rpc-layer
   A PKCS#11 module that calls into the daemon. This is the module that apps actually use.
   
pkcs11/ssh-agent
   An SSH agent implementation that uses a PKCS#11 module for it's cryto and key storage.
   
pkcs11/ssh-store
   A PKCS#11 module which exposes objects in ~/.ssh directory.
   
pkcs11/user-store
   A PKCS#11 module for general storage of certificates and keys.
      
tests  
   Test tools and unit tests.
   
   
--------------------------------------------------------------------------------
                            USE OF WORKER THREADS

Gnome Keyring uses threads in a limited manner, as state machines, (ie: execution
stacks). Only one thread runs at any given time, each thread hands off execution
to another thread. 

The *only* use of threading and/or synchronization primitives should be in:
 
   common/gkr-async.c
   
Worker threads are created by using gkr_async_worker_start(). Each worker needs 
to call gkr_async_yield() regularly, to give other threads a chance to run.

If a thread needs perform a blocking syscall, or do something that takes a long 
time (like create a key) it can use the gkr_async_begin_concurrent() and 
gkr_async_end_concurrent() functions. While running 'concurrent' no global
functions and/or data should be accessed.