diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2023-07-03 01:42:04 +0200 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-07-03 01:42:04 +0200 |
commit | 60efbba7bbe1c61f371603e56497297271173f3e (patch) | |
tree | 47608f007b2184ceb95bc127bccee4b7ad0e4a88 | |
parent | 795186a6cc4aa6fa23482d313c19abf53e3f80ab (diff) | |
download | gnunet-60efbba7bbe1c61f371603e56497297271173f3e.tar.gz gnunet-60efbba7bbe1c61f371603e56497297271173f3e.zip |
GNS: Assert return values in key derivation.
-rw-r--r-- | src/gnsrecord/gnsrecord_crypto.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c index 175967b1e..886a93ad8 100644 --- a/src/gnsrecord/gnsrecord_crypto.c +++ b/src/gnsrecord/gnsrecord_crypto.c | |||
@@ -1056,6 +1056,7 @@ GNUNET_GNSRECORD_query_from_public_key (const struct | |||
1056 | { | 1056 | { |
1057 | char *norm_label; | 1057 | char *norm_label; |
1058 | struct GNUNET_IDENTITY_PublicKey pd; | 1058 | struct GNUNET_IDENTITY_PublicKey pd; |
1059 | ssize_t pd_len; | ||
1059 | 1060 | ||
1060 | norm_label = GNUNET_GNSRECORD_string_normalize (label); | 1061 | norm_label = GNUNET_GNSRECORD_string_normalize (label); |
1061 | 1062 | ||
@@ -1067,8 +1068,10 @@ GNUNET_GNSRECORD_query_from_public_key (const struct | |||
1067 | norm_label, | 1068 | norm_label, |
1068 | "gns", | 1069 | "gns", |
1069 | &pd.ecdsa_key); | 1070 | &pd.ecdsa_key); |
1071 | pd_len = GNUNET_IDENTITY_public_key_get_length (&pd); | ||
1072 | GNUNET_assert (0 < pd_len); | ||
1070 | GNUNET_CRYPTO_hash (&pd, | 1073 | GNUNET_CRYPTO_hash (&pd, |
1071 | GNUNET_IDENTITY_public_key_get_length (&pd), | 1074 | pd_len, |
1072 | query); | 1075 | query); |
1073 | break; | 1076 | break; |
1074 | case GNUNET_GNSRECORD_TYPE_EDKEY: | 1077 | case GNUNET_GNSRECORD_TYPE_EDKEY: |
@@ -1077,8 +1080,10 @@ GNUNET_GNSRECORD_query_from_public_key (const struct | |||
1077 | norm_label, | 1080 | norm_label, |
1078 | "gns", | 1081 | "gns", |
1079 | &(pd.eddsa_key)); | 1082 | &(pd.eddsa_key)); |
1083 | pd_len = GNUNET_IDENTITY_public_key_get_length (&pd); | ||
1084 | GNUNET_assert (0 < pd_len); | ||
1080 | GNUNET_CRYPTO_hash (&pd, | 1085 | GNUNET_CRYPTO_hash (&pd, |
1081 | GNUNET_IDENTITY_public_key_get_length (&pd), | 1086 | pd_len, |
1082 | query); | 1087 | query); |
1083 | break; | 1088 | break; |
1084 | default: | 1089 | default: |