+
+ if (ret == DB_NOTFOUND) {
+ /* If we didn't find the key ID see if it's a subkey ID */
+ memset(&key, 0, sizeof(key));
+ memset(&data, 0, sizeof(data));
+ data.size = 0;
+ data.data = NULL;
+ key.size = sizeof(keyid);
+ key.data = &keyid;
+
+ ret = subkeydb->get(subkeydb,
+ txn,
+ &key,
+ &data,
+ 0); /* flags*/
+
+ if (ret == 0) {
+ /* We got a subkey match; retrieve the actual key */
+ keyid = *(uint64_t *) data.data;
+
+ memset(&key, 0, sizeof(key));
+ memset(&data, 0, sizeof(data));
+ data.size = 0;
+ data.data = NULL;
+ key.size = sizeof(keyid);
+ key.data = &keyid;
+
+ ret = keydb(keyid)->get(keydb(keyid),
+ txn,
+ &key,
+ &data,
+ 0); /* flags*/
+ }
+ }
+