summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gnsrecord/gnsrecord_crypto.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c
index 6eda1e962..d34be30c4 100644
--- a/src/gnsrecord/gnsrecord_crypto.c
+++ b/src/gnsrecord/gnsrecord_crypto.c
@@ -54,7 +54,23 @@ derive_block_aes_key(struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
54{ 54{
55 static const char ctx_key[] = "gns-aes-ctx-key"; 55 static const char ctx_key[] = "gns-aes-ctx-key";
56 static const char ctx_iv[] = "gns-aes-ctx-iv"; 56 static const char ctx_iv[] = "gns-aes-ctx-iv";
57 57/**
58 * Next time we break protocol (v12) we harmonize the KDF usage in GNS:
59 * We use the strings above as salt and the public key as IKM similar to
60 * how derive_h is done in crypto_ecc.c.
61 */
62#ifdef GNUNET_PROTOCOL_V12
63 GNUNET_CRYPTO_kdf(skey, sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey),
64 ctx_key, strlen(ctx_key),
65 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
66 label, strlen(label),
67 NULL, 0);
68 GNUNET_CRYPTO_kdf(iv, sizeof(struct GNUNET_CRYPTO_SymmetricInitializationVector),
69 ctx_iv, strlen(ctx_iv),
70 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
71 label, strlen(label),
72 NULL, 0);
73#else
58 GNUNET_CRYPTO_kdf(skey, sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey), 74 GNUNET_CRYPTO_kdf(skey, sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey),
59 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 75 pub, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
60 label, strlen(label), 76 label, strlen(label),
@@ -65,6 +81,7 @@ derive_block_aes_key(struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
65 label, strlen(label), 81 label, strlen(label),
66 ctx_iv, strlen(ctx_iv), 82 ctx_iv, strlen(ctx_iv),
67 NULL, 0); 83 NULL, 0);
84#endif
68} 85}
69 86
70 87
@@ -454,7 +471,6 @@ GNUNET_GNSRECORD_query_from_public_key(const struct GNUNET_CRYPTO_EcdsaPublicKey
454 struct GNUNET_HashCode *query) 471 struct GNUNET_HashCode *query)
455{ 472{
456 struct GNUNET_CRYPTO_EcdsaPublicKey pd; 473 struct GNUNET_CRYPTO_EcdsaPublicKey pd;
457
458 GNUNET_CRYPTO_ecdsa_public_key_derive(pub, 474 GNUNET_CRYPTO_ecdsa_public_key_derive(pub,
459 label, 475 label,
460 "gns", 476 "gns",