anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

commit 6232db293b36e986f64ea0644a3d26087834c83e
parent edd9d7b927e3f1b7be24a5615e100d053e79df41
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 30 Apr 2025 20:24:34 +0200

check return values

Diffstat:
Msrc/authorization/anastasis_authorization_plugin_totp.c | 7++++---
Msrc/util/anastasis-crypto-tvg.c | 14++++++++++----
2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/authorization/anastasis_authorization_plugin_totp.c b/src/authorization/anastasis_authorization_plugin_totp.c @@ -167,9 +167,10 @@ compute_totp (int time_off, gcry_md_open (&md, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC)); - gcry_md_setkey (md, - key, - key_size); + GNUNET_assert (GPG_ERR_NO_ERROR == + gcry_md_setkey (md, + key, + key_size)); gcry_md_write (md, &ctr, sizeof (ctr)); diff --git a/src/util/anastasis-crypto-tvg.c b/src/util/anastasis-crypto-tvg.c @@ -78,7 +78,9 @@ vec_for (json_t *vecs, const char *vecname) json_object_set_new (t, "operation", json_string (vecname))); - json_array_append_new (vecs, t); + GNUNET_assert (0 == + json_array_append_new (vecs, + t)); return t; } @@ -125,11 +127,12 @@ d2j_append (json_t *arr, buf = GNUNET_STRINGS_data_to_string_alloc (data, size); json = json_string (buf); + GNUNET_assert (NULL != json); GNUNET_free (buf); - GNUNET_break (NULL != json); - json_array_append_new (arr, - json); + GNUNET_assert (0 == + json_array_append_new (arr, + json)); } @@ -318,6 +321,8 @@ output_vectors () json_t *vecfile = json_object (); json_t *vecs = json_array (); + GNUNET_assert (NULL != vecfile); + GNUNET_assert (NULL != vecs); GNUNET_assert (0 == json_object_set_new (vecfile, "encoding", @@ -516,6 +521,7 @@ output_vectors () struct ANASTASIS_CRYPTO_PolicyKeyP policy_key; json_t *key_shares_json = json_array (); + GNUNET_assert (NULL != key_shares_json); random_auto (&key_shares[0]); random_auto (&key_shares[1]); random_auto (&salt);