-
Notifications
You must be signed in to change notification settings - Fork 803
Add configuration option for on-disk caching of private data #2588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Jakuje
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you. Generally, it looks ok, but you need a change in the minidriver to unbreak the windows build.
|
Thanks for looking into this. What I find confusing is the mix of the additional parameter to |
|
opensc.conf also allows a special handling of PIN-protected certificates. Unfortunately, the naming Also, instead of adding a new config option, we could think about making |
The The additional parameter
I found it a bit confusing too. It would help to rename it - maybe something like
Looks good to me, I will redo the handling of this option. |
Thanks for the clearification, I now understand the difference between the two. A different approach for avoiding caching on private data without changing diff --git a/src/libopensc/pkcs15-pubkey.c b/src/libopensc/pkcs15-pubkey.c
index 9aceea64..1fcd5f4f 100644
--- a/src/libopensc/pkcs15-pubkey.c
+++ b/src/libopensc/pkcs15-pubkey.c
@@ -951,7 +951,12 @@ sc_pkcs15_read_pubkey(struct sc_pkcs15_card *p15card, const struct sc_pkcs15_obj
}
else if (info->path.len) {
sc_log(ctx, "Read from EF and decode");
+ struct sc_pkcs15_card_opts old_opts = p15card->opts;
+ if (obj->flags & SC_PKCS15_CO_FLAG_PRIVATE) {
+ p15card->opts.use_file_cache = 0;
+ }
r = sc_pkcs15_read_file(p15card, &info->path, &data, &len);
+ p15card->opts = old_opts;
LOG_TEST_GOTO_ERR(ctx, r, "Failed to read public key file.");
if ((algorithm == SC_ALGORITHM_EC || algorithm == SC_ALGORITHM_EDDSA || algorithm == SC_ALGORITHM_XEDDSA)This would allow keeping the ABI stabile and it would block some of the complexity to drip through to the lower level. However, my review is purely informational - I'll leave it to you to decide which approach you find more suitable.
Yes, this would be more suitable. Maybe just open an issue about changing the naming would be sufficient for now. |
|
Yes, in |
By default, on-disk caching of private data is disabled.
|
@frankmorgner do you have some other concerns around this PR or are we good to merge it? |
|
no, fine for me |
The change OpenSC/OpenSC#2588 modified the API, which now breaks the OSX build for OpenSC. This updates the arguments to match new arguments.
This PR adds the configuration option
cache_private_datathat enables switching off on-disk caching of data flagged as private (withSC_PKCS15_CO_FLAG_PRIVATE). When both optionsuse_file_cachingandcache_private_dataare enabled in config file, private objects are cached along with non-private. By default, caching of private data is disabled.Most on-disk caching happens in
sc_pkcs15_read_file(), which is extended with a flag whether it is private data or not.Fixes #2210
Checklist