104 Commits

Author SHA1 Message Date
Armin Novak
822257bf7c [c23,winpr] replace NULL with nullptr 2026-02-26 21:16:48 +01:00
Armin Novak
0531803808 [warnings] make function declaration names consistent
Use the same parameter names for declaration and implementation.
2026-02-26 10:35:25 +01:00
Armin Novak
208bcbd153 [winpr] Add initializer functions
* Add initializer for wStream
* Add initializer for ASN1 decoder
2026-02-25 19:39:24 +01:00
Armin Novak
48267edf2f [winpr] add WINPR_C_ARRAY_INIT
since C23 allows c++ style initializing replace direct use with this
macro
2026-02-25 19:23:08 +01:00
Armin Novak
a5609b929e [winpr,ncrypt] use pragma once as guard 2026-02-25 15:05:51 +01:00
Armin Novak
118afc0b95 [allocations] fix growth of preallocated buffers
* Replace * 2 with * sizeof(WCHAR) for string usages
* Grow streams and other buffers reasonably, e.g. add 128 elements per
  try and check for possible overflows
* Add constant postfix to force them to 64bit
2026-02-17 13:54:34 +01:00
akallabeth
fb8efd45f2 [c,format] fix format string and review warnings 2026-01-16 13:36:14 +01:00
akallabeth
9f788982a1 [c,printf] fix wlog format string to match arguments 2026-01-16 11:43:00 +01:00
akallabeth
bb1fab040d [c,printf] fix wlog format string to match arguments 2026-01-16 11:42:57 +01:00
Armin Novak
305196b6ba [winpr,ncrypt] fix Wimplicit-int-enum-cast warnings 2026-01-14 10:39:38 +01:00
Armin Novak
6e1ce92290 [clang,warnings] fix Wjump-misses-init 2026-01-08 11:32:45 +01:00
Armin Novak
f85072dd61 [winpr,ncrypt] fix nonstring warnings
gcc >= 15 and newer clang warn about non '\0' terminated string
constants. Initialize the struct in a compatible way.
2026-01-08 09:33:35 +01:00
Pavlo Myroniuk
101f7ad1c8 fix(winpr): pin cert labels; 2025-09-02 16:12:04 +03:00
akallabeth
65f18983ed [warnings] Fix format string errors
* Fix casts of format string arguments (%p requires void*)
* Fix format string to match type of arguments
2025-08-13 15:09:48 +02:00
akallabeth
c3e507a82e [winpr,wlog] Replace WLog_PrintMessage calls
Prefer WLog_PrintTextMessage to have proper format string checks in
place.
2025-08-13 15:08:01 +02:00
David Fort
9fd97beb23 ncrypt_pkcs11: remove verbose unneeded log 2025-03-31 11:15:52 +02:00
Armin Novak
c79f080e8d [warnings] improve array bound checks 2025-03-12 15:04:38 +01:00
akallabeth
76c2944d99 [winpr,warnings] fix -Wunused-parameter 2025-02-13 15:53:51 +01:00
akallabeth
307bf48870 [warnings] fix integer casting in winpr
* use WINPR_ASSERTING_INT_CAST to detect overflows in sign or narrow
  integer casts
* replace defines with static variables
2025-01-03 10:08:57 +01:00
akallabeth
1644b96875 [winpr,ncrypt] fix convertKeyType
* use _wcsnlen
* fix inverted length check
2024-12-31 20:07:23 +01:00
akallabeth
faae38120c [cmake,format] reformat all cmake files 2024-11-27 20:41:48 +01:00
stephanebill
4f2afa8c47 spell check with codespell 2024-11-20 16:53:40 -05:00
akallabeth
78acedb40e [warnigns] fix Wshorten-64-to-32 2024-11-11 10:22:37 +01:00
akallabeth
dcf5a8e28c [warnings] fix -Wswitch-default 2024-10-31 11:42:24 +01:00
Armin Novak
527db6783b [cmake] split tests
* Keep BUILD_TESTING, but only run tests compatible with API (for
  packaging)
* Add BUILD_TESTING_INTERNAL for all tests including internal function
  tests that modify API to be run on our CI
2024-10-24 09:45:44 +02:00
akallabeth
cb2cbdabfe [winpr,ncrypt] fix integer narrow 2024-10-03 18:58:26 +02:00
akallabeth
cd18dea174 [return checks] fix use of unicode functions 2024-09-16 06:48:26 +02:00
akallabeth
29697ca68d [winpr,ncryt] fix a memory leak
NCryptP11EnumKeys did leak memory under certain conditions
2024-09-12 13:29:55 +02:00
akallabeth
6481993305 [winpr,ncrypt] do not abort test if NCryptEnumKeys fails 2024-09-12 13:29:50 +02:00
akallabeth
f9141fb94b [winpr,ncrypt] improve logging 2024-09-12 13:29:48 +02:00
akallabeth
e00661d338 [warnings] fix dead store warnings 2024-09-12 13:29:46 +02:00
akallabeth
6a1c3b4545 [function pointer] use macro for GetProcAddress
Cast all results of GetProcAddress with WINPR_FUNC_PTR_CAST
2024-09-04 21:31:48 +02:00
akallabeth
245afb706c [function pointers] unify casts with macro 2024-09-04 20:06:45 +02:00
akallabeth
190929c018 [warnings] fix function pointer casts 2024-08-30 15:40:01 +02:00
akallabeth
6a3564407e [warnings] fix clang-tidy issues in winpr 2024-08-29 15:20:39 +02:00
akallabeth
9c9d74e920 [warnings] fix redundant casts 2024-08-29 12:03:09 +02:00
akallabeth
15456e1ee1 [warnings] fix implicit widening conversion 2024-08-29 10:47:20 +02:00
akallabeth
1d33095500 [warnings] fix cert-err33-c
Fix unused return values, cast to void if on purpose
2024-08-29 10:19:27 +02:00
Armin Novak
d71af44bb1 [warnings] disable warnings for generated code
* Disable clang-tidy in test build directories
* Disable compiler warnings for test binary directories.

These contain generated code we can not change, so the warnings are just noise
2024-08-28 09:18:30 +02:00
akallabeth
f938c32afa [winpr,ncrypt] check p11 for NULL 2024-08-09 10:41:43 +02:00
akallabeth
5e662cfb2d [winpr,ncrypt] add checks to NCryptOpenP11StorageProviderEx 2024-08-09 09:40:27 +02:00
akallabeth
776083234b [warnings] fix unused-but-set-variable 2024-07-23 09:14:19 +02:00
akallabeth
b3f268ef86 [winpr,ncrypt] improve pkcs11 logging 2024-07-01 10:25:28 +02:00
akallabeth
fed8943447 [pkcs11.h] remove extra-semi-stmt 2024-04-22 18:02:03 +02:00
Ondrej Holy
35d8bc1782 [winpr,ncrypt] use preferably p11-kit-proxy.so
Currently, the opensc-pkcs11.so library is used for ncrypt support.
However, the p11-kit-proxy.so library is able to aggregate more pkcs11
modules at runtime (OpenSC is one of them, but also some third party
modules that are not supported by OpenSC). Let's use preferably
p11-kit-proxy.so if available.
2024-04-22 17:42:52 +02:00
Ondrej Holy
5a28b046d5 [winpr,ncrypt] bundle pkcs11.h and drop pkcs11-helper dependency
The ncrypt implementation currently relies on the pkcs11-helper library.
That is not available on RHEL for example. Let's bundle the standardized
header file from https://github.com/latchset/pkcs11-headers to avoid the
need for extra dependency.

Related: https://github.com/FreeRDP/FreeRDP/discussions/9982
2024-04-22 17:42:52 +02:00
Ondrej Holy
cef3d5e9d4 [winpr,ncrypt] replace deprecated symbol
The CKK_ECDSA symbol is deprecated, it is recommended to use CKK_EC
instead. Let's do this as a preparation for the follow-up changes.
2024-04-22 17:42:52 +02:00
Ondrej Holy
73991c48ce [winpr,ncrypt] obtain module path from provider
Currently, the module path is hardcoded in the build_pkinit_args function.
Let's obtain the module path from provider as a preparation for the
follow-up changes.
2024-04-22 17:42:52 +02:00
Ondrej Holy
79975cfbe3 [winpr,ncrypt] drop redundant library paths
The pkcs11 implementaion contains a list of the standard library paths
for various architectures and distribution. But that list also contains
just the opensc-pkcs11.so basename without path. Therefor I am conviced
that all those other entries can be simply dropped. Let's do that as
a preparation for the follow-up changes.
2024-04-22 17:42:52 +02:00
akallabeth
0c9fb50170 [coverity] fix unchecked return 2024-04-12 13:30:35 +02:00