Skip to content
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

p11-kit: Expose version information through macros #635

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

ueno
Copy link
Member

@ueno ueno commented Apr 26, 2024

This provides P11_KIT_VERSION_{MAJOR,MINOR,MICRO} from the <p11-kit/version.h> header, along with a helper macro P11_KIT_CHECK_VERSION(major, minor, micro) for checking the version requirement with #if directive.

Fixes: #523

@ueno ueno force-pushed the wip/dueno/version-api branch 2 times, most recently from 88be5ef to 9eaea8f Compare April 26, 2024 21:50
@coveralls
Copy link

coveralls commented Apr 26, 2024

Coverage Status

coverage: 69.556% (+0.001%) from 69.555%
when pulling fda7039 on ueno:wip/dueno/version-api
into 8832556 on p11-glue:master.

@ueno ueno force-pushed the wip/dueno/version-api branch 8 times, most recently from d33f2bc to 42cf1f4 Compare April 28, 2024 00:31
This provides P11_KIT_VERSION_{MAJOR,MINOR,MICRO} from the
<p11-kit/version.h> header, along with a helper macro
P11_KIT_CHECK_VERSION(major, minor, micro) for checking the version
requirement with `#if` directive.

Signed-off-by: Daiki Ueno <[email protected]>
Copy link
Contributor

@ZoltanFridrich ZoltanFridrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@ueno
Copy link
Member Author

ueno commented Apr 29, 2024

Thanks for the review!

@ueno ueno merged commit 652927d into p11-glue:master Apr 29, 2024
14 checks passed
@bcsgh
Copy link

bcsgh commented Apr 29, 2024

Why is P11_KIT_CHECK_VERSION a macro rather than a function? That kind of removes one of the reason for including this sort of API which is to check at runtime that the library linked in (either linked statically at build time or dynamically from whatever environment things are run in) matches the expectation of the calling code. This macro at most allows calling code the verify that the set of headers resolved at build time are the expected ones but doesn't, by itself, provide a way to know what version of the p11 library the code is then linked with.

Given that p11 seems to require non-static builds, it seems like being able to verify that the (unavoidable) .so that is chosen at run time is what the calling code expects it to be (or at least having a way to know what it actually is) would be at least as desirable here as it is for other libraries that provide that sort of function:

@ueno
Copy link
Member Author

ueno commented Apr 29, 2024

I actually thought that run-time detection was already possible through PKCS#11 API (because libp11-kit.so is the same binary as p11-kit-proxy.so), but it turns out not the case. Maybe we could embed the actual version.

@ZoltanFridrich ZoltanFridrich added this to the 0.25.4 milestone Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FR: API for getting the code version.
4 participants