summaryrefslogtreecommitdiff
path: root/src/libnm-crypto
Commit message (Collapse)AuthorAgeFilesLines
* doc: replace all (allow-none) annotations by (optional) and/or (nullable)Corentin Noël2023-03-271-3/+3
| | | | | | | | The (allow-none) annotation is deprecated since a long time now, it is better to use (nullable) and/or (optional) which clarifies what it means with the (out) annotation. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1551
* all: fix various "-Wcast-align=strict" warningsThomas Haller2022-12-091-3/+10
| | | | | | | The warning "-Wcast-align=strict" seems useful and will be enabled next. Fix places that currently cause the warning by using the new macro NM_CAST_ALIGN(). This macro also nm_assert()s that the alignment is correct.
* crypto: support EC private keysGeorg Müller2022-08-042-1/+9
| | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1324
* crypto: cleanup error handling in nm_crypto_is_pkcs12_data()Thomas Haller2022-03-293-15/+13
| | | | | | | | | | Our convention is that a function that fails MUST set the GError output. No need to check for that in nm_crypto_is_pkcs12_data(). Simplify the error paths. Also, in gnutls' _nm_crypto_verify_pkcs12(), don't call gnutls_pkcs12_deinit() before gnutls_strerror(). It's unclear whether that couldn't set a different error reason.
* crypto: move nm_crypto_read_file() to "libnm-glib-aux"Thomas Haller2022-03-291-33/+4
| | | | | | | | | | It has no actual dependency on the crypto library. All it does, is to be careful about not leaking secrets in memory. We have code for that in libnm-glib-aux already. Move. The goal is to reduce the number of places where we use libnm-crypto, because that has a large dependency. libnm-glib-aux is a very light dependency instead.
* libnm: move dependency to libnm-crypto out of libnm-core's "nm-utils.c"Thomas Haller2022-03-292-0/+54
| | | | | | | | | | | | | | | | | | | | | | | libnm-core is also used by the daemon, thus currently dragging in libnm-crypto there. But could we ever drop that dependency? One use of the libnm-crypto is in functions like nm_utils_file_is_certificate() in "nm-utils.h". These are part of the public API of libnm. But this is not used by the daemon. Move it to "libnm-client-core" to be closer to where it's actually used. As we have unit tests in "libnm-core-impl/tests" that test this function, those unit tests also would need to move to "libnm-client-impl". Instead, add the actual implementation of these function to "libnm-crypto" and test it there. This patch moves forward declarations from public header "nm-utils.h" to "nm-client.h". Arguably, "nm-client.h" is not a great name, but we don't have a general purpose header in "libnm-client-public", so use this. Note that libnm users can only include <NetworkManager.h> and including individual files is not supported (and even prevented). Thus moving the declarations won't break any users.
* build: move nm-crypto to separate directory "src/libnm-crypto"Thomas Haller2022-03-298-0/+2334
libnm-core currently has a dependency on crypto libraries (either "gnutls", "nss" or "null"). We need this huge dependency for few cases. Move the crypto code to a separate static library"src/libnm-crypto/libnm-crypto.la". The reasoning is that it becomes clearer where we have this dependency, to use it more consciously, and to be better see how it's used. We clearly need the crypto functionality in libnm. But do we also need it in the daemon? Could we ever link the daemon without crypto libraries? The goal of splitting the crypto part out, to better understand the crypto dependency.