Changeset View
Changeset View
Standalone View
Standalone View
b/g10/keydb.c
Context not available. | |||||
{ | { | ||||
gpg_error_t err = 0; | gpg_error_t err = 0; | ||||
log_info ("%s: enter (cache state: %d).\n", | |||||
__func__, hd->keyblock_cache.state); | |||||
*ret_kb = NULL; | *ret_kb = NULL; | ||||
if (!hd) | if (!hd) | ||||
Context not available. | |||||
if (hd->keyblock_cache.state == KEYBLOCK_CACHE_FILLED) | if (hd->keyblock_cache.state == KEYBLOCK_CACHE_FILLED) | ||||
{ | { | ||||
log_info ("%s: returning data from cache.\n", __func__); | |||||
err = iobuf_seek (hd->keyblock_cache.iobuf, 0); | err = iobuf_seek (hd->keyblock_cache.iobuf, 0); | ||||
if (err) | if (err) | ||||
{ | { | ||||
Context not available. | |||||
ret_kb); | ret_kb); | ||||
if (!err && hd->keyblock_cache.state == KEYBLOCK_CACHE_PREPARED) | if (!err && hd->keyblock_cache.state == KEYBLOCK_CACHE_PREPARED) | ||||
{ | { | ||||
log_info ("%s: filling cache.\n", __func__); | |||||
hd->keyblock_cache.state = KEYBLOCK_CACHE_FILLED; | hd->keyblock_cache.state = KEYBLOCK_CACHE_FILLED; | ||||
hd->keyblock_cache.sigstatus = sigstatus; | hd->keyblock_cache.sigstatus = sigstatus; | ||||
hd->keyblock_cache.iobuf = iobuf; | hd->keyblock_cache.iobuf = iobuf; | ||||
Context not available. | |||||
} | } | ||||
if (hd->keyblock_cache.state != KEYBLOCK_CACHE_FILLED) | if (hd->keyblock_cache.state != KEYBLOCK_CACHE_FILLED) | ||||
keyblock_cache_clear (hd); | { | ||||
log_info ("%s: cache not filled, clearing.\n", __func__); | |||||
keyblock_cache_clear (hd); | |||||
} | |||||
if (DBG_CLOCK) | if (DBG_CLOCK) | ||||
log_clock (err? "keydb_get_keyblock leave (failed)" | log_clock (err? "keydb_get_keyblock leave (failed)" | ||||
Context not available. | |||||
&& ndesc == 1 && (desc[0].mode == KEYDB_SEARCH_MODE_FPR20 | && ndesc == 1 && (desc[0].mode == KEYDB_SEARCH_MODE_FPR20 | ||||
|| desc[0].mode == KEYDB_SEARCH_MODE_FPR)) | || desc[0].mode == KEYDB_SEARCH_MODE_FPR)) | ||||
{ | { | ||||
log_info("%s: preparing cache\n", __func__); | |||||
hd->keyblock_cache.state = KEYBLOCK_CACHE_PREPARED; | hd->keyblock_cache.state = KEYBLOCK_CACHE_PREPARED; | ||||
memcpy (hd->keyblock_cache.fpr, desc[0].u.fpr, 20); | memcpy (hd->keyblock_cache.fpr, desc[0].u.fpr, 20); | ||||
} | } | ||||
else | |||||
log_info("%s: NOT preparing cache\n", __func__); | |||||
if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND | if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND | ||||
&& ndesc == 1 && desc[0].mode == KEYDB_SEARCH_MODE_LONG_KID && was_reset | && ndesc == 1 && desc[0].mode == KEYDB_SEARCH_MODE_LONG_KID && was_reset | ||||
Context not available. |