diff options
Diffstat (limited to 'doc/DETAILS')
-rw-r--r-- | doc/DETAILS | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/doc/DETAILS b/doc/DETAILS index 661a4a1ef..04236b7e9 100644 --- a/doc/DETAILS +++ b/doc/DETAILS @@ -56,23 +56,18 @@ Record type 1: -------------- Version information for this TrustDB. This is always the first record of the DB and the only one with type 1. - 1 byte value 2 + 1 byte value 1 3 bytes 'gpg' magic value 1 byte Version of the TrustDB 3 byte reserved - 1 u32 locked by (pid) 0 = not locked. + 1 u32 locked flags 1 u32 timestamp of trustdb creation 1 u32 timestamp of last modification 1 u32 timestamp of last validation (Used to keep track of the time, when this TrustDB was checked against the pubring) - 1 u32 reserved - 1 byte marginals needed - 1 byte completes needed - 1 byte max. cert depth - If any of this 3 values are changed, all cache records - must be invalidated. - 9 bytes reserved + 1 u32 record number of keyhashtable + 12 bytes reserved Record type 2: (directory record) @@ -183,9 +178,9 @@ Record type 9: (cache record) Record Type 10 (hash table) -------------- - Due to the fact that we use the keyid to lookup keys, we can + Due to the fact that we use fingerprints to lookup keys, we can implement quick access by some simple hash methods, and avoid - the overhead of gdbm. A property of keyids is that they can be + the overhead of gdbm. A property of fingerprints is that they can be used directly as hash values. (They can be considered as strong random numbers.) What we use is a dynamic multilevel architecture, which combines @@ -194,11 +189,11 @@ Record Type 10 (hash table) This record is a hashtable of 256 entries; a special property is that all these records are stored consecutively to make one big table. The hash value is simple the 1st, 2nd, ... byte of - the keyid (depending on the indirection level). + the fingerprint (depending on the indirection level). 1 byte value 10 1 byte reserved - n u32 recnum; n depends on th record length: + n u32 recnum; n depends on the record length: n = (reclen-2)/4 which yields 9 for the current record length of 40 bytes. @@ -206,18 +201,15 @@ Record Type 10 (hash table) m = (256+n-1) / n which is 29 for a record length of 40. - To look up a key we use its lsb to get the recnum from this - hashtable and look up the addressed record: - - If this record is another hashtable, we use 2nd lsb + To look up a key we use the first byte of the fingerprint to get + the recnum from this hashtable and look up the addressed record: + - If this record is another hashtable, we use 2nd byte to index this hast table and so on. - - if this record is a hashlist, we walk thru the - reclist records until we found one whose hash field - matches the MSB of our keyid, and lookup this record - - if this record is a dir record, we compare the - keyid and if this is correct, we get the keyrecod and compare - the fingerprint to decide whether it is the requested key; - if this is not the correct dir record, we look at the next - dir record which is linked by the link field. + - if this record is a hashlist, we walk all entries + until we found one a matching one. + - if this record is a key record, we compare the + fingerprint and to decide whether it is the requested key; + Record type 11 (hash list) -------------- @@ -226,11 +218,10 @@ Record type 11 (hash list) 1 byte value 11 1 byte reserved 1 u32 next next hash list record - n times n = (reclen-6)/5 - 1 byte hash + n times n = (reclen-5)/5 1 u32 recnum - For the current record length of 40, n is 6 + For the current record length of 40, n is 7 |