diff options
author | Sebastian Nadler <sebastian.nadler@tum.de> | 2023-12-05 17:37:52 +0100 |
---|---|---|
committer | Sebastian Nadler <sebastian.nadler@tum.de> | 2023-12-07 16:33:21 +0100 |
commit | 065ac6e4a865adbf2faa2d1a834f9acfebeca8ad (patch) | |
tree | 6d7e94fb29c6a82d072806d5d8b4cd97235b6864 /src/include/gnunet_gnsrecord_lib.h | |
parent | ee105432a611a44249f867fb5f6f0bc101e000a9 (diff) | |
download | gnunet-065ac6e4a865adbf2faa2d1a834f9acfebeca8ad.tar.gz gnunet-065ac6e4a865adbf2faa2d1a834f9acfebeca8ad.zip |
GNS: Implementation of SBOX records
Fix memory allocation and string handling issues in plugin_gnsrecord_gns.c and gnunet-service-gns_resolver.c
GNS: sbox records
Add SBox record
Diffstat (limited to 'src/include/gnunet_gnsrecord_lib.h')
-rw-r--r-- | src/include/gnunet_gnsrecord_lib.h | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index 813409340..b4e45727b 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h | |||
@@ -331,6 +331,31 @@ struct GNUNET_GNSRECORD_BoxRecord | |||
331 | /* followed by the 'original' record */ | 331 | /* followed by the 'original' record */ |
332 | }; | 332 | }; |
333 | 333 | ||
334 | |||
335 | /** | ||
336 | * Record type used to box up SMIMEA records. For example, a | ||
337 | * SMIMEA record for "c93f1e400f26708f98cb19d936620da35eec8f72e57 | ||
338 | * f9eec01c1afd6._smimecert.foo.gnu" will be stored under | ||
339 | * "foo.gnu" as a SBOX record with the local-path of the associated | ||
340 | * e-mails hash turnicated to 28 octets encoded as hex and protocol _smimecert | ||
341 | * and record_type "SMIMEA". When a BOX record is received, GNS | ||
342 | * unboxes it if the name contained "hash._PROTO", otherwise GNS | ||
343 | * leaves it untouched. This is done to ensure that SMIMEA | ||
344 | * records do not require a separate network request, thus making SMIMEA | ||
345 | * records inseparable from the "main" A/AAAA/VPN/etc. records. | ||
346 | */ | ||
347 | struct GNUNET_GNSRECORD_SBoxRecord | ||
348 | { | ||
349 | /** | ||
350 | * GNS record type of the boxed record. In NBO. | ||
351 | */ | ||
352 | uint32_t record_type GNUNET_PACKED; | ||
353 | |||
354 | /* followed by the zero terminated hostname prefix */ | ||
355 | /* followed by the 'original' record */ | ||
356 | }; | ||
357 | |||
358 | |||
334 | /** | 359 | /** |
335 | * Record type used internally to keep track of reverse mappings into a | 360 | * Record type used internally to keep track of reverse mappings into a |
336 | * namespace. | 361 | * namespace. |
@@ -836,9 +861,9 @@ GNUNET_GNSRECORD_label_check (const char*label, char **emsg); | |||
836 | /** | 861 | /** |
837 | * Maximum length of a revocation | 862 | * Maximum length of a revocation |
838 | */ | 863 | */ |
839 | #define GNUNET_MAX_POW_SIZE sizeof(struct GNUNET_GNSRECORD_PowP) +\ | 864 | #define GNUNET_MAX_POW_SIZE sizeof(struct GNUNET_GNSRECORD_PowP) \ |
840 | sizeof(struct GNUNET_CRYPTO_PublicKey) +\ | 865 | + sizeof(struct GNUNET_CRYPTO_PublicKey) \ |
841 | 1024 //FIXME max sig_len | 866 | + 1024 // FIXME max sig_len |
842 | 867 | ||
843 | /** | 868 | /** |
844 | * The proof-of-work narrowing factor. | 869 | * The proof-of-work narrowing factor. |
@@ -910,8 +935,8 @@ struct GNUNET_GNSRECORD_PowCalculationHandle; | |||
910 | */ | 935 | */ |
911 | enum GNUNET_GenericReturnValue | 936 | enum GNUNET_GenericReturnValue |
912 | GNUNET_GNSRECORD_check_pow (const struct GNUNET_GNSRECORD_PowP *pow, | 937 | GNUNET_GNSRECORD_check_pow (const struct GNUNET_GNSRECORD_PowP *pow, |
913 | unsigned int matching_bits, | 938 | unsigned int matching_bits, |
914 | struct GNUNET_TIME_Relative epoch_duration); | 939 | struct GNUNET_TIME_Relative epoch_duration); |
915 | 940 | ||
916 | 941 | ||
917 | /** | 942 | /** |
@@ -922,7 +947,7 @@ GNUNET_GNSRECORD_check_pow (const struct GNUNET_GNSRECORD_PowP *pow, | |||
922 | */ | 947 | */ |
923 | void | 948 | void |
924 | GNUNET_GNSRECORD_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key, | 949 | GNUNET_GNSRECORD_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key, |
925 | struct GNUNET_GNSRECORD_PowP *pow); | 950 | struct GNUNET_GNSRECORD_PowP *pow); |
926 | 951 | ||
927 | 952 | ||
928 | /** | 953 | /** |
@@ -936,8 +961,8 @@ GNUNET_GNSRECORD_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key, | |||
936 | */ | 961 | */ |
937 | struct GNUNET_GNSRECORD_PowCalculationHandle* | 962 | struct GNUNET_GNSRECORD_PowCalculationHandle* |
938 | GNUNET_GNSRECORD_pow_start (struct GNUNET_GNSRECORD_PowP *pow, | 963 | GNUNET_GNSRECORD_pow_start (struct GNUNET_GNSRECORD_PowP *pow, |
939 | int epochs, | 964 | int epochs, |
940 | unsigned int difficulty); | 965 | unsigned int difficulty); |
941 | 966 | ||
942 | 967 | ||
943 | /** | 968 | /** |