Skip to content

Commit

Permalink
Fix a few FFI bindings
Browse files Browse the repository at this point in the history
They were not correctly defined and it manifested in compilation errors with GCC
14 which enabled -Werror=incompatible-pointer-types.
  • Loading branch information
arybczak committed Aug 9, 2024
1 parent bdab8fa commit df0f747
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions botan-bindings/src/Botan/Bindings/PubKey.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ foreign import capi safe "botan/ffi.h botan_privkey_view_der"
botan_privkey_view_der
:: BotanPrivKey -- ^ __key__
-> BotanViewContext ctx -- ^ __ctx__
-> FunPtr (BotanViewBinCallback ctx) -- ^ __view__
-> BotanViewBinCallback ctx -- ^ __view__
-> IO CInt

-- | View the private key's PEM encoding
foreign import capi safe "botan/ffi.h botan_privkey_view_pem"
botan_privkey_view_pem
:: BotanPrivKey -- ^ __key__
-> BotanViewContext ctx -- ^ __ctx__
-> FunPtr (BotanViewStrCallback ctx) -- ^ __view__
-> BotanViewStrCallback ctx -- ^ __view__
-> IO CInt

foreign import capi safe "botan/ffi.h botan_privkey_algo_name"
Expand Down Expand Up @@ -347,7 +347,7 @@ foreign import capi safe "botan/ffi.h botan_privkey_view_encrypted_der"
-> ConstPtr CChar -- ^ __pbkdf_algo__
-> CSize -- ^ __pbkdf_iterations__
-> BotanViewContext ctx -- ^ __ctx__
-> FunPtr (BotanViewBinCallback ctx) -- ^ __view__
-> BotanViewBinCallback ctx -- ^ __view__
-> IO CInt

{- |
Expand All @@ -364,7 +364,7 @@ foreign import capi safe "botan/ffi.h botan_privkey_view_encrypted_der_timed"
-> ConstPtr CChar -- ^ __pbkdf_algo__
-> CSize -- ^ __pbkdf_runtime_msec__
-> BotanViewContext ctx -- ^ __ctx__
-> FunPtr (BotanViewBinCallback ctx) -- ^ __view__
-> BotanViewBinCallback ctx -- ^ __view__
-> IO CInt

{- |
Expand All @@ -382,7 +382,7 @@ foreign import capi safe "botan/ffi.h botan_privkey_view_encrypted_pem"
-> ConstPtr CChar -- ^ __pbkdf_algo__
-> CSize -- ^ __pbkdf_iterations__
-> BotanViewContext ctx -- ^ __ctx__
-> FunPtr (BotanViewStrCallback ctx) -- ^ __view__
-> BotanViewStrCallback ctx -- ^ __view__
-> IO CInt

{- |
Expand All @@ -399,7 +399,7 @@ foreign import capi safe "botan/ffi.h botan_privkey_view_encrypted_pem_timed"
-> ConstPtr CChar -- ^ __pbkdf_algo__
-> CSize -- ^ __pbkdf_runtime_msec__
-> BotanViewContext ctx -- ^ __ctx__
-> FunPtr (BotanViewStrCallback ctx) -- ^ __view__
-> BotanViewStrCallback ctx -- ^ __view__
-> IO CInt

foreign import capi safe "botan/ffi.h botan_privkey_get_field"
Expand Down Expand Up @@ -455,15 +455,15 @@ foreign import capi safe "botan/ffi.h botan_pubkey_view_der"
botan_pubkey_view_der
:: BotanPubKey -- ^ __key__
-> BotanViewContext ctx -- ^ __ctx__
-> FunPtr (BotanViewBinCallback ctx) -- ^ __view__
-> BotanViewBinCallback ctx -- ^ __view__
-> IO CInt

-- | View the public key's PEM encoding
foreign import capi safe "botan/ffi.h botan_pubkey_view_pem"
botan_pubkey_view_pem
:: BotanPubKey -- ^ __key__
-> BotanViewContext ctx -- ^ __ctx__
-> FunPtr (BotanViewStrCallback ctx) -- ^ __view__
-> BotanViewStrCallback ctx -- ^ __view__
-> IO CInt

foreign import capi safe "botan/ffi.h botan_pubkey_algo_name"
Expand Down Expand Up @@ -508,5 +508,5 @@ foreign import capi safe "botan/ffi.h botan_pubkey_view_ec_public_point"
botan_pubkey_view_ec_public_point
:: BotanPubKey -- ^ __key__
-> BotanViewContext ctx -- ^ __ctx__
-> FunPtr (BotanViewBinCallback ctx) -- ^ __view__
-> BotanViewBinCallback ctx -- ^ __view__
-> IO CInt
2 changes: 1 addition & 1 deletion botan-bindings/src/Botan/Bindings/PubKey/KeyAgreement.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ foreign import capi safe "botan/ffi.h botan_pk_op_key_agreement_view_public"
botan_pk_op_key_agreement_view_public
:: BotanPrivKey -- ^ __key__
-> BotanViewContext ctx -- ^ __ctx__
-> FunPtr (BotanViewBinCallback ctx) -- ^ __view__
-> BotanViewBinCallback ctx -- ^ __view__
-> IO CInt

foreign import capi safe "botan/ffi.h botan_pk_op_key_agreement_size"
Expand Down
4 changes: 2 additions & 2 deletions botan-bindings/src/Botan/Bindings/X509.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ foreign import capi safe "botan/ffi.h botan_x509_cert_view_public_key_bits"
botan_x509_cert_view_public_key_bits
:: BotanX509Cert -- ^ __cert__
-> BotanViewContext ctx -- ^ __ctx__
-> FunPtr (BotanViewBinCallback ctx) -- ^ __view__
-> BotanViewBinCallback ctx -- ^ __view__
-> IO CInt

foreign import capi safe "botan/ffi.h botan_x509_cert_get_public_key"
Expand Down Expand Up @@ -164,7 +164,7 @@ foreign import capi safe "botan/ffi.h botan_x509_cert_view_as_string"
botan_x509_cert_view_as_string
:: BotanX509Cert -- ^ __cert__
-> BotanViewContext ctx -- ^ __ctx__
-> FunPtr (BotanViewStrCallback ctx) -- ^ __view__
-> BotanViewStrCallback ctx -- ^ __view__
-> IO CInt

pattern NO_CONSTRAINTS
Expand Down

0 comments on commit df0f747

Please sign in to comment.