Commit Graph

2 Commits

Author SHA1 Message Date
Jason A. Donenfeld
92b27a4f88 shared: add nm_utils_memeqzero_secret()
[thaller@redhat.com: the code is effectively key_is_zero() by
  <Jason@zx2c4.com> (LGPL2.1+). I took it into our source tree
  and adjusted it to our style]

(cherry picked from commit 6234e41153)
2019-03-07 22:22:39 +01:00
Thomas Haller
b232508707 shared: add nm-secret-utils.h helper
We already had nm_free_secret() to clear the secret out
of a NUL terminated string. That works well for secrets
which are strings, it can be used with a cleanup attribute
(nm_auto_free_secret) and as a cleanup function for a
GBytes.

However, it does not work for secrets which are binary.
For those, we must also track the length of the allocated
data and clear it.

Add two new structs NMSecretPtr and NMSecretBuf to help
with that.
2018-09-04 07:38:30 +02:00