diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-02-03 21:51:57 +0100 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-02-09 20:38:10 +0100 |
commit | 5b6bb2ce4d60635b2af950d72b45f12686fd5218 (patch) | |
tree | ef3b5786591f6a8473a4a2174dd95a439f22af68 /src/include/gnunet_reclaim_attribute_lib.h | |
parent | 99d70615e37294d4f964992c6be0495e95777a27 (diff) | |
download | gnunet-5b6bb2ce4d60635b2af950d72b45f12686fd5218.tar.gz gnunet-5b6bb2ce4d60635b2af950d72b45f12686fd5218.zip |
move to 256-bit identifier; some cleanups
Diffstat (limited to 'src/include/gnunet_reclaim_attribute_lib.h')
-rw-r--r-- | src/include/gnunet_reclaim_attribute_lib.h | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/src/include/gnunet_reclaim_attribute_lib.h b/src/include/gnunet_reclaim_attribute_lib.h index 004f2bd10..93b4f8a13 100644 --- a/src/include/gnunet_reclaim_attribute_lib.h +++ b/src/include/gnunet_reclaim_attribute_lib.h | |||
@@ -61,6 +61,37 @@ extern "C" { | |||
61 | #define GNUNET_RECLAIM_ATTESTATION_TYPE_JWT 11 | 61 | #define GNUNET_RECLAIM_ATTESTATION_TYPE_JWT 11 |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * We want an ID to be a 256-bit symmetric key | ||
65 | */ | ||
66 | #define GNUNET_RECLAIM_ID_LENGTH (256 / 8) | ||
67 | |||
68 | /** | ||
69 | * A reclaim identifier | ||
70 | * FIXME maybe put this in a different namespace | ||
71 | */ | ||
72 | struct GNUNET_RECLAIM_Identifier | ||
73 | { | ||
74 | char id[GNUNET_RECLAIM_ID_LENGTH]; | ||
75 | }; | ||
76 | |||
77 | static const struct GNUNET_RECLAIM_Identifier GNUNET_RECLAIM_ID_ZERO; | ||
78 | |||
79 | #define GNUNET_RECLAIM_id_is_equal(a,b) ((0 == \ | ||
80 | memcmp (a,\ | ||
81 | b,\ | ||
82 | sizeof (GNUNET_RECLAIM_ID_ZERO))) ?\ | ||
83 | GNUNET_YES : GNUNET_NO) | ||
84 | |||
85 | |||
86 | #define GNUNET_RECLAIM_id_is_zero(a) GNUNET_RECLAIM_id_is_equal(a,\ | ||
87 | &GNUNET_RECLAIM_ID_ZERO) | ||
88 | |||
89 | #define GNUNET_RECLAIM_id_generate(id) \ | ||
90 | (GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG,\ | ||
91 | id,\ | ||
92 | sizeof (GNUNET_RECLAIM_ID_ZERO))) | ||
93 | |||
94 | /** | ||
64 | * An attribute. | 95 | * An attribute. |
65 | */ | 96 | */ |
66 | struct GNUNET_RECLAIM_ATTRIBUTE_Claim | 97 | struct GNUNET_RECLAIM_ATTRIBUTE_Claim |
@@ -68,7 +99,7 @@ struct GNUNET_RECLAIM_ATTRIBUTE_Claim | |||
68 | /** | 99 | /** |
69 | * ID | 100 | * ID |
70 | */ | 101 | */ |
71 | uint64_t id; | 102 | struct GNUNET_RECLAIM_Identifier id; |
72 | 103 | ||
73 | /** | 104 | /** |
74 | * Type of Claim | 105 | * Type of Claim |
@@ -106,7 +137,7 @@ struct GNUNET_RECLAIM_ATTESTATION_Claim | |||
106 | /** | 137 | /** |
107 | * ID | 138 | * ID |
108 | */ | 139 | */ |
109 | uint64_t id; | 140 | struct GNUNET_RECLAIM_Identifier id; |
110 | 141 | ||
111 | /** | 142 | /** |
112 | * Type/Format of Claim | 143 | * Type/Format of Claim |
@@ -114,9 +145,9 @@ struct GNUNET_RECLAIM_ATTESTATION_Claim | |||
114 | uint32_t type; | 145 | uint32_t type; |
115 | 146 | ||
116 | /** | 147 | /** |
117 | * Version | 148 | * Flag |
118 | */ | 149 | */ |
119 | uint32_t version; | 150 | uint32_t flag; |
120 | 151 | ||
121 | /** | 152 | /** |
122 | * The name of the attribute. Note "name" must never be individually | 153 | * The name of the attribute. Note "name" must never be individually |
@@ -145,12 +176,12 @@ struct GNUNET_RECLAIM_ATTESTATION_REFERENCE | |||
145 | /** | 176 | /** |
146 | * ID | 177 | * ID |
147 | */ | 178 | */ |
148 | uint64_t id; | 179 | struct GNUNET_RECLAIM_Identifier id; |
149 | 180 | ||
150 | /** | 181 | /** |
151 | * Referenced ID of Attestation | 182 | * Referenced ID of Attestation |
152 | */ | 183 | */ |
153 | uint64_t id_attest; | 184 | struct GNUNET_RECLAIM_Identifier id_attest; |
154 | 185 | ||
155 | /** | 186 | /** |
156 | * The name of the attribute/attestation reference value. Note "name" must never be individually | 187 | * The name of the attribute/attestation reference value. Note "name" must never be individually |