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

Symbol name collision with pkcs11.h identifier CKM_RSA_AES_KEY_WRAP #5588

Closed
3 tasks done
jepio opened this issue May 1, 2024 · 2 comments · Fixed by #5647
Closed
3 tasks done

Symbol name collision with pkcs11.h identifier CKM_RSA_AES_KEY_WRAP #5588

jepio opened this issue May 1, 2024 · 2 comments · Fixed by #5647
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. KeyVault

Comments

@jepio
Copy link
Member

jepio commented May 1, 2024

Describe the bug
Building an application that includes both sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/key_client_models.hpp and OASIS pkcs11.h fails due to both defining a symbol named CKM_RSA_AES_KEY_WRAP. Namespacing is irrelevant here, as pkcs11.h defines a macro.

Exception or Stack Trace
gcc compiler error:

In file included from /workspaces/azure_kms_pkcs11/pkcs11_compat.h:12,
                 from /workspaces/azure_kms_pkcs11/attributes.h:1,
                 from /workspaces/azure_kms_pkcs11/aws_kms_pkcs11.cpp:11:
/usr/include/p11-kit-1/p11-kit/pkcs11.h:802:42: error: expected unqualified-id before numeric constant
  802 | #define CKM_RSA_AES_KEY_WRAP            (0x1054UL)
      |                                          ^~~~~~~~
/usr/include/p11-kit-1/p11-kit/pkcs11.h:802:42: error: expected ')' before numeric constant
  802 | #define CKM_RSA_AES_KEY_WRAP            (0x1054UL)
      |                                         ~^~~~~~~~

To Reproduce

apt-get install gcc g++ p11-kit libp11-kit-dev
g++ -c snippet.cpp -I/usr/include/p11-kit-1/p11-kit -I<path to azure-sdk-for-cpp>

Code Snippet
Add the code snippet that causes the issue.

#include <pkcs11.h>
#include <azure/keyvault/keys/key_client_models.hpp>

Expected behavior
pkcs11 and Azure sdk can be used in the same compilation unit.

Screenshots
If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

  • OS: Ubuntu 22.04
  • IDE : no
  • Version of the Library used: main bd08d22

Additional context
Add any other context about the problem here.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
@github-actions github-actions bot added the needs-triage This is a new issue that needs to be triaged to the appropriate team. label May 1, 2024
@RickWinter RickWinter added bug This issue requires a change to an existing behavior in the product in order to be resolved. KeyVault labels May 17, 2024
@RickWinter RickWinter added the Client This issue points to a problem in the data-plane of the library. label May 17, 2024
@github-actions github-actions bot removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label May 17, 2024
@gearama
Copy link
Member

gearama commented May 20, 2024

Thank you for submitting this issue. Looking into it .

@gearama
Copy link
Member

gearama commented May 21, 2024

as a temporary workaround reverse the includes

#include <azure/keyvault/keys/key_client_models.hpp>
#include <pkcs11.h>

Also you might need to call the macro as such KeyEncryptionAlgorithm::(CKM_RSA_AES_KEY_WRAP) – taking macro in braces disables macro expansion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. KeyVault
Projects
Status: Untriaged
Development

Successfully merging a pull request may close this issue.

3 participants