GNUnet 0.21.2
json_helper.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 2014-2022 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
27#include "platform.h"
28#include "gnunet_json_lib.h"
29#include "gnunet_common.h"
30
31
34{
36 .parser = NULL,
37 .cleaner = NULL,
38 .cls = NULL
39 };
40
41 return ret;
42}
43
44
52string_to_cipher (const char *cipher_s)
53{
54 if ((0 == strcasecmp (cipher_s,
55 "RSA")) ||
56 (0 == strcasecmp (cipher_s,
57 "RSA+age_restricted")))
59 if ((0 == strcasecmp (cipher_s,
60 "CS")) ||
61 (0 == strcasecmp (cipher_s,
62 "CS+age_restricted")))
65}
66
67
78 json_t *root,
79 struct GNUNET_JSON_Specification *spec)
80{
81 const char *enc;
82 size_t len;
83
84 if (NULL == (enc = json_string_value (root)))
85 {
87 return GNUNET_SYSERR;
88 }
89 len = strlen (enc);
90 if (len >= SIZE_MAX / 5)
91 {
93 return GNUNET_SYSERR;
94 }
95 if (((len * 5) / 8) != spec->ptr_size)
96 {
99 "Field `%s' has wrong length\n",
100 spec->field);
101 return GNUNET_SYSERR;
102 }
103 if (GNUNET_OK !=
105 len,
106 spec->ptr,
107 spec->ptr_size))
108 {
109 GNUNET_break_op (0);
110 return GNUNET_SYSERR;
111 }
112 return GNUNET_OK;
113}
114
115
118 void *obj,
119 size_t size)
120{
122 .parser = &parse_fixed_data,
123 .cleaner = NULL,
124 .cls = NULL,
125 .field = name,
126 .ptr = obj,
127 .ptr_size = size,
128 .size_ptr = NULL
129 };
130
131 return ret;
132}
133
134
145 json_t *root,
146 struct GNUNET_JSON_Specification *spec)
147{
148 const char *enc;
149 unsigned int len;
150 void *output;
151 size_t olen;
152
153 if (NULL == (enc = json_string_value (root)))
154 {
155 GNUNET_break_op (0);
156 return GNUNET_SYSERR;
157 }
158 len = strlen (enc);
159 output = NULL;
161 len,
162 &output);
163 if (olen != spec->ptr_size)
164 {
165 GNUNET_break_op (0);
167 "Field `%s' has wrong length\n",
168 spec->field);
169 GNUNET_free (output);
170 return GNUNET_SYSERR;
171 }
172 memcpy (spec->ptr,
173 output,
174 olen);
175 GNUNET_free (output);
176 return GNUNET_OK;
177}
178
179
182 void *obj,
183 size_t size)
184{
186 .parser = &parse_fixed64_data,
187 .cleaner = NULL,
188 .cls = NULL,
189 .field = name,
190 .ptr = obj,
191 .ptr_size = size,
192 .size_ptr = NULL
193 };
194
195 return ret;
196}
197
198
209 json_t *root,
210 struct GNUNET_JSON_Specification *spec)
211{
212 const char *str;
213 size_t size;
214 void *data;
215
216 str = json_string_value (root);
217 if (NULL == str)
218 {
219 GNUNET_break_op (0);
220 return GNUNET_SYSERR;
221 }
222 if (GNUNET_OK !=
224 strlen (str),
225 &data,
226 &size))
227 {
228 GNUNET_break_op (0);
229 return GNUNET_SYSERR;
230 }
231 *(void **) spec->ptr = data;
232 *spec->size_ptr = size;
233 return GNUNET_OK;
234}
235
236
243static void
245 struct GNUNET_JSON_Specification *spec)
246{
247 (void) cls;
248 if (0 != *spec->size_ptr)
249 {
250 GNUNET_free (*(void **) spec->ptr);
251 *(void **) spec->ptr = NULL;
252 *spec->size_ptr = 0;
253 }
254}
255
256
259 void **obj,
260 size_t *size)
261{
263 .parser = &parse_variable_data,
264 .cleaner = &clean_variable_data,
265 .cls = NULL,
266 .field = name,
267 .ptr = obj,
268 .ptr_size = 0,
269 .size_ptr = size
270 };
271
272 *obj = NULL;
273 *size = 0;
274 return ret;
275}
276
277
288 json_t *root,
289 struct GNUNET_JSON_Specification *spec)
290{
291 const char *str;
292
293 (void) cls;
294 str = json_string_value (root);
295 if (NULL == str)
296 {
297 GNUNET_break_op (0);
298 return GNUNET_SYSERR;
299 }
300 *(const char **) spec->ptr = str;
301 return GNUNET_OK;
302}
303
304
307 const char **strptr)
308{
310 .parser = &parse_string,
311 .field = name,
312 .ptr = strptr
313 };
314
315 *strptr = NULL;
316 return ret;
317}
318
319
330 json_t *root,
331 struct GNUNET_JSON_Specification *spec)
332{
333 if (! (json_is_object (root) || json_is_array (root)))
334 {
335 GNUNET_break_op (0);
336 return GNUNET_SYSERR;
337 }
338 json_incref (root);
339 *(json_t **) spec->ptr = root;
340 return GNUNET_OK;
341}
342
343
350static void
352 struct GNUNET_JSON_Specification *spec)
353{
354 json_t **ptr = (json_t **) spec->ptr;
355
356 if (NULL != *ptr)
357 {
358 json_decref (*ptr);
359 *ptr = NULL;
360 }
361}
362
363
366 json_t **jsonp)
367{
369 .parser = &parse_json,
370 .cleaner = &clean_json,
371 .cls = NULL,
372 .field = name,
373 .ptr = jsonp,
374 .ptr_size = 0,
375 .size_ptr = NULL
376 };
377
378 *jsonp = NULL;
379 return ret;
380}
381
382
393 json_t *root,
394 struct GNUNET_JSON_Specification *spec)
395{
396 if (NULL == root)
397 return GNUNET_OK;
398 if (! json_is_object (root))
399 {
400 GNUNET_break_op (0);
401 return GNUNET_SYSERR;
402 }
403 *(const json_t **) spec->ptr = (const json_t *) root;
404 return GNUNET_OK;
405}
406
407
410 const json_t **jsonp)
411{
413 .parser = &parse_object_const,
414 .cls = NULL,
415 .field = name,
416 .ptr = jsonp,
417 .ptr_size = 0,
418 .size_ptr = NULL
419 };
420
421 *jsonp = NULL;
422 return ret;
423}
424
425
436 json_t *root,
437 struct GNUNET_JSON_Specification *spec)
438{
439 if (NULL == root)
440 return GNUNET_OK;
441 if (! json_is_array (root))
442 {
443 GNUNET_break_op (0);
444 return GNUNET_SYSERR;
445 }
446 *(const json_t **) spec->ptr = (const json_t *) root;
447 return GNUNET_OK;
448}
449
450
453 const json_t **jsonp)
454{
456 .parser = &parse_array_const,
457 .cls = NULL,
458 .field = name,
459 .ptr = jsonp,
460 .ptr_size = 0,
461 .size_ptr = NULL
462 };
463
464 *jsonp = NULL;
465 return ret;
466}
467
468
479 json_t *root,
480 struct GNUNET_JSON_Specification *spec)
481{
482 bool *b = spec->ptr;
483
484 if (json_true () == root)
485 {
486 *b = true;
487 return GNUNET_OK;
488 }
489 if (json_false () == root)
490 {
491 *b = false;
492 return GNUNET_OK;
493 }
494 GNUNET_break_op (0);
495 return GNUNET_SYSERR;
496}
497
498
501 bool *b)
502{
504 .parser = &parse_bool,
505 .cleaner = NULL,
506 .cls = NULL,
507 .field = name,
508 .ptr = b,
509 .ptr_size = sizeof(bool),
510 .size_ptr = NULL
511 };
512
513 return ret;
514}
515
516
527 json_t *root,
528 struct GNUNET_JSON_Specification *spec)
529{
530 double *f = spec->ptr;
531
532 if (! json_is_real (root))
533 {
534 GNUNET_break_op (0);
535 return GNUNET_SYSERR;
536 }
537 *f = json_real_value (root);
538 return GNUNET_OK;
539}
540
541
544 double *f)
545{
547 .parser = &parse_double,
548 .cleaner = NULL,
549 .cls = NULL,
550 .field = name,
551 .ptr = f,
552 .ptr_size = sizeof(double),
553 .size_ptr = NULL
554 };
555
556 return ret;
557}
558
559
570 json_t *root,
571 struct GNUNET_JSON_Specification *spec)
572{
573 json_int_t val;
574 uint8_t *up = spec->ptr;
575
576 if (! json_is_integer (root))
577 {
578 GNUNET_break_op (0);
579 return GNUNET_SYSERR;
580 }
581 val = json_integer_value (root);
582 if ((0 > val) || (val > UINT8_MAX))
583 {
584 GNUNET_break_op (0);
585 return GNUNET_SYSERR;
586 }
587 *up = (uint8_t) val;
588 return GNUNET_OK;
589}
590
591
594 uint8_t *u8)
595{
597 .parser = &parse_u8,
598 .cleaner = NULL,
599 .cls = NULL,
600 .field = name,
601 .ptr = u8,
602 .ptr_size = sizeof(uint8_t),
603 .size_ptr = NULL
604 };
605
606 return ret;
607}
608
609
620 json_t *root,
621 struct GNUNET_JSON_Specification *spec)
622{
623 json_int_t val;
624 uint16_t *up = spec->ptr;
625
626 if (! json_is_integer (root))
627 {
628 GNUNET_break_op (0);
629 return GNUNET_SYSERR;
630 }
631 val = json_integer_value (root);
632 if ((0 > val) || (val > UINT16_MAX))
633 {
634 GNUNET_break_op (0);
635 return GNUNET_SYSERR;
636 }
637 *up = (uint16_t) val;
638 return GNUNET_OK;
639}
640
641
644 uint16_t *u16)
645{
647 .parser = &parse_u16,
648 .cleaner = NULL,
649 .cls = NULL,
650 .field = name,
651 .ptr = u16,
652 .ptr_size = sizeof(uint16_t),
653 .size_ptr = NULL
654 };
655
656 return ret;
657}
658
659
670 json_t *root,
671 struct GNUNET_JSON_Specification *spec)
672{
673 json_int_t val;
674 uint32_t *up = spec->ptr;
675
676 if (! json_is_integer (root))
677 {
678 GNUNET_break_op (0);
679 return GNUNET_SYSERR;
680 }
681 val = json_integer_value (root);
682 if ((0 > val) || (val > UINT32_MAX))
683 {
684 GNUNET_break_op (0);
685 return GNUNET_SYSERR;
686 }
687 *up = (uint32_t) val;
688 return GNUNET_OK;
689}
690
691
694 uint32_t *u32)
695{
697 .parser = &parse_u32,
698 .cleaner = NULL,
699 .cls = NULL,
700 .field = name,
701 .ptr = u32,
702 .ptr_size = sizeof(uint32_t),
703 .size_ptr = NULL
704 };
705
706 return ret;
707}
708
709
720 json_t *root,
721 struct GNUNET_JSON_Specification *spec)
722{
723 json_int_t val;
724 uint64_t *up = spec->ptr;
725
726 if (! json_is_integer (root))
727 {
728 GNUNET_break_op (0);
729 return GNUNET_SYSERR;
730 }
731 val = json_integer_value (root);
732 *up = (uint64_t) val;
733 return GNUNET_OK;
734}
735
736
739 uint64_t *u64)
740{
742 .parser = &parse_u64,
743 .cleaner = NULL,
744 .cls = NULL,
745 .field = name,
746 .ptr = u64,
747 .ptr_size = sizeof(uint64_t),
748 .size_ptr = NULL
749 };
750
751 return ret;
752}
753
754
765 json_t *root,
766 struct GNUNET_JSON_Specification *spec)
767{
768 json_int_t val;
769 int64_t *up = spec->ptr;
770
771 if (! json_is_integer (root))
772 {
773 GNUNET_break_op (0);
774 return GNUNET_SYSERR;
775 }
776 val = json_integer_value (root);
777 *up = (int64_t) val;
778 return GNUNET_OK;
779}
780
781
784 int64_t *i64)
785{
787 .parser = &parse_i64,
788 .cleaner = NULL,
789 .cls = NULL,
790 .field = name,
791 .ptr = i64,
792 .ptr_size = sizeof(int64_t),
793 .size_ptr = NULL
794 };
795
796 return ret;
797}
798
799
800/* ************ GNUnet-specific parser specifications ******************* */
801
812 json_t *root,
813 struct GNUNET_JSON_Specification *spec)
814{
815 struct GNUNET_TIME_Timestamp *ts = spec->ptr;
816 json_t *json_t_s;
817 unsigned long long int tval;
818
819 if (! json_is_object (root))
820 {
821 GNUNET_break_op (0);
822 return GNUNET_SYSERR;
823 }
824 json_t_s = json_object_get (root,
825 "t_s");
826 if (json_is_integer (json_t_s))
827 {
828 tval = json_integer_value (json_t_s);
829 /* Time is in seconds in JSON, but in microseconds in GNUNET_TIME_Absolute */
831 = tval * GNUNET_TIME_UNIT_SECONDS.rel_value_us;
832 if (ts->abs_time.abs_value_us
833 / GNUNET_TIME_UNIT_SECONDS.rel_value_us
834 != tval)
835 {
836 /* Integer overflow */
837 GNUNET_break_op (0);
838 return GNUNET_SYSERR;
839 }
840 return GNUNET_OK;
841 }
842 if (json_is_string (json_t_s))
843 {
844 const char *val;
845
846 val = json_string_value (json_t_s);
847 if ((0 == strcasecmp (val,
848 "never")))
849 {
851 return GNUNET_OK;
852 }
853 GNUNET_break_op (0);
854 return GNUNET_SYSERR;
855 }
856 GNUNET_break_op (0);
857 return GNUNET_SYSERR;
858}
859
860
863 struct GNUNET_TIME_Timestamp *t)
864{
866 .parser = &parse_timestamp,
867 .field = name,
868 .ptr = t,
869 .ptr_size = sizeof(struct GNUNET_TIME_Timestamp)
870 };
871
872 return ret;
873}
874
875
886 json_t *root,
887 struct GNUNET_JSON_Specification *spec)
888{
889 struct GNUNET_TIME_TimestampNBO *ts = spec->ptr;
890 struct GNUNET_TIME_Timestamp a;
891 struct GNUNET_JSON_Specification ispec;
892
893 ispec = *spec;
894 ispec.parser = &parse_timestamp;
895 ispec.ptr = &a;
896 if (GNUNET_OK !=
897 parse_timestamp (NULL,
898 root,
899 &ispec))
900 return GNUNET_SYSERR;
902 return GNUNET_OK;
903}
904
905
908 struct GNUNET_TIME_TimestampNBO *at)
909{
911 .parser = &parse_timestamp_nbo,
912 .field = name,
913 .ptr = at,
914 .ptr_size = sizeof(struct GNUNET_TIME_TimestampNBO)
915 };
916
917 return ret;
918}
919
920
930parse_rel_time (void *cls,
931 json_t *root,
932 struct GNUNET_JSON_Specification *spec)
933{
934 struct GNUNET_TIME_Relative *rel = spec->ptr;
935 json_t *json_d_us;
936 unsigned long long int tval;
937
938 if (! json_is_object (root))
939 {
940 GNUNET_break_op (0);
941 return GNUNET_SYSERR;
942 }
943 json_d_us = json_object_get (root,
944 "d_us");
945 if (json_is_integer (json_d_us))
946 {
947 tval = json_integer_value (json_d_us);
948 if (tval >= (1LLU << 53))
949 {
950 /* value is larger than allowed */
951 GNUNET_break_op (0);
952 return GNUNET_SYSERR;
953 }
954 rel->rel_value_us = tval;
955 return GNUNET_OK;
956 }
957 if (json_is_string (json_d_us))
958 {
959 const char *val;
960
961 val = json_string_value (json_d_us);
962 if ((0 == strcasecmp (val,
963 "forever")))
964 {
966 return GNUNET_OK;
967 }
968 GNUNET_break_op (0);
969 return GNUNET_SYSERR;
970 }
971 GNUNET_break_op (0);
972 return GNUNET_SYSERR;
973}
974
975
978 struct GNUNET_TIME_Relative *rt)
979{
981 .parser = &parse_rel_time,
982 .field = name,
983 .ptr = rt,
984 .ptr_size = sizeof(struct GNUNET_TIME_Relative)
985 };
986
987 return ret;
988}
989
990
1001 json_t *root,
1002 struct GNUNET_JSON_Specification *spec)
1003{
1004 struct GNUNET_CRYPTO_RsaPublicKey **pk = spec->ptr;
1005 const char *enc;
1006 char *buf;
1007 size_t len;
1008 size_t buf_len;
1009
1010 if (NULL == (enc = json_string_value (root)))
1011 {
1012 GNUNET_break_op (0);
1013 return GNUNET_SYSERR;
1014 }
1015 len = strlen (enc);
1016 buf_len = (len * 5) / 8;
1017 buf = GNUNET_malloc (buf_len);
1018 if (GNUNET_OK !=
1020 len,
1021 buf,
1022 buf_len))
1023 {
1024 GNUNET_break_op (0);
1025 GNUNET_free (buf);
1026 return GNUNET_SYSERR;
1027 }
1028 if (NULL == (*pk = GNUNET_CRYPTO_rsa_public_key_decode (buf,
1029 buf_len)))
1030 {
1031 GNUNET_break_op (0);
1032 GNUNET_free (buf);
1033 return GNUNET_SYSERR;
1034 }
1035 GNUNET_free (buf);
1036 return GNUNET_OK;
1037}
1038
1039
1046static void
1048 struct GNUNET_JSON_Specification *spec)
1049{
1050 struct GNUNET_CRYPTO_RsaPublicKey **pk = spec->ptr;
1051
1052 if (NULL != *pk)
1053 {
1055 *pk = NULL;
1056 }
1057}
1058
1059
1063{
1065 .parser = &parse_rsa_public_key,
1066 .cleaner = &clean_rsa_public_key,
1067 .field = name,
1068 .ptr = pk
1069 };
1070
1071 *pk = NULL;
1072 return ret;
1073}
1074
1075
1084static enum GNUNET_GenericReturnValue
1086 json_t *root,
1087 struct GNUNET_JSON_Specification *spec)
1088{
1089 struct GNUNET_CRYPTO_RsaSignature **sig = spec->ptr;
1090 size_t size;
1091 const char *str;
1092 int res;
1093 void *buf;
1094
1095 str = json_string_value (root);
1096 if (NULL == str)
1097 {
1098 GNUNET_break_op (0);
1099 return GNUNET_SYSERR;
1100 }
1101 size = (strlen (str) * 5) / 8;
1102 buf = GNUNET_malloc (size);
1104 strlen (str),
1105 buf,
1106 size);
1107 if (GNUNET_OK != res)
1108 {
1109 GNUNET_free (buf);
1110 GNUNET_break_op (0);
1111 return GNUNET_SYSERR;
1112 }
1113 if (NULL == (*sig = GNUNET_CRYPTO_rsa_signature_decode (buf,
1114 size)))
1115 {
1116 GNUNET_break_op (0);
1117 GNUNET_free (buf);
1118 return GNUNET_SYSERR;
1119 }
1120 GNUNET_free (buf);
1121 return GNUNET_OK;
1122}
1123
1124
1131static void
1133 struct GNUNET_JSON_Specification *spec)
1134{
1135 struct GNUNET_CRYPTO_RsaSignature **sig = spec->ptr;
1136
1137 if (NULL != *sig)
1138 {
1140 *sig = NULL;
1141 }
1142}
1143
1144
1147 struct GNUNET_CRYPTO_RsaSignature **sig)
1148{
1150 .parser = &parse_rsa_signature,
1151 .cleaner = &clean_rsa_signature,
1152 .cls = NULL,
1153 .field = name,
1154 .ptr = sig,
1155 .ptr_size = 0,
1156 .size_ptr = NULL
1157 };
1158
1159 *sig = NULL;
1160 return ret;
1161}
1162
1163
1172static enum GNUNET_GenericReturnValue
1174 json_t *root,
1175 struct GNUNET_JSON_Specification *spec)
1176{
1177 int *bp = spec->ptr;
1178
1179 if (! json_is_boolean (root))
1180 {
1181 GNUNET_break_op (0);
1182 return GNUNET_SYSERR;
1183 }
1184 *bp = json_boolean_value (root) ? GNUNET_YES : GNUNET_NO;
1185 return GNUNET_OK;
1186}
1187
1188
1191 int *boolean)
1192{
1194 .parser = &parse_boolean,
1195 .cleaner = NULL,
1196 .cls = NULL,
1197 .field = name,
1198 .ptr = boolean,
1199 .ptr_size = sizeof(int),
1200 .size_ptr = NULL
1201 };
1202
1203 return ret;
1204}
1205
1206
1215static enum GNUNET_GenericReturnValue
1217 json_t *root,
1218 struct GNUNET_JSON_Specification *spec)
1219{
1220 struct GNUNET_CRYPTO_BlindedMessage **target = spec->ptr;
1221 struct GNUNET_CRYPTO_BlindedMessage *blinded_message;
1222 const char *cipher;
1223 struct GNUNET_JSON_Specification dspec[] = {
1224 GNUNET_JSON_spec_string ("cipher",
1225 &cipher),
1227 };
1228 const char *emsg;
1229 unsigned int eline;
1230
1231 (void) cls;
1232 if (GNUNET_OK !=
1233 GNUNET_JSON_parse (root,
1234 dspec,
1235 &emsg,
1236 &eline))
1237 {
1238 GNUNET_break_op (0);
1239 return GNUNET_SYSERR;
1240 }
1241 blinded_message = GNUNET_new (struct GNUNET_CRYPTO_BlindedMessage);
1242 blinded_message->rc = 1;
1243 blinded_message->cipher = string_to_cipher (cipher);
1244 switch (blinded_message->cipher)
1245 {
1247 break;
1249 {
1250 struct GNUNET_JSON_Specification ispec[] = {
1252 /* TODO: Change this field name to something
1253 more generic / pass in as argument. */
1254 "rsa_blinded_planchet",
1255 &blinded_message->details.rsa_blinded_message.blinded_msg,
1256 &blinded_message->details.rsa_blinded_message.blinded_msg_size),
1258 };
1259
1260 if (GNUNET_OK !=
1261 GNUNET_JSON_parse (root,
1262 ispec,
1263 &emsg,
1264 &eline))
1265 {
1266 GNUNET_break_op (0);
1267 GNUNET_free (blinded_message);
1268 return GNUNET_SYSERR;
1269 }
1270 *target = blinded_message;
1271 return GNUNET_OK;
1272 }
1274 {
1275 struct GNUNET_JSON_Specification ispec[] = {
1277 "cs_nonce",
1278 &blinded_message->details.cs_blinded_message.nonce),
1280 "cs_blinded_c0",
1281 &blinded_message->details.cs_blinded_message.c[0]),
1283 "cs_blinded_c1",
1284 &blinded_message->details.cs_blinded_message.c[1]),
1286 };
1287
1288 if (GNUNET_OK !=
1289 GNUNET_JSON_parse (root,
1290 ispec,
1291 &emsg,
1292 &eline))
1293 {
1294 GNUNET_break_op (0);
1295 GNUNET_free (blinded_message);
1296 return GNUNET_SYSERR;
1297 }
1298 *target = blinded_message;
1299 return GNUNET_OK;
1300 }
1301 }
1302 GNUNET_break_op (0);
1303 GNUNET_free (blinded_message);
1304 return GNUNET_SYSERR;
1305}
1306
1313static void
1315 struct GNUNET_JSON_Specification *spec)
1316{
1317 struct GNUNET_CRYPTO_BlindedMessage **blinded_message = spec->ptr;
1318
1319 (void) cls;
1320 if (NULL != blinded_message)
1321 {
1322 GNUNET_CRYPTO_blinded_message_decref (*blinded_message);
1323 *blinded_message = NULL;
1324 }
1325}
1326
1327
1331{
1333 .parser = &parse_blinded_message,
1334 .cleaner = &clean_blinded_message,
1335 .cls = NULL,
1336 .field = name,
1337 .ptr = msg,
1338 .ptr_size = 0,
1339 .size_ptr = NULL
1340 };
1341
1342 *msg = NULL;
1343 return ret;
1344}
1345
1346
1355static enum GNUNET_GenericReturnValue
1357 json_t *root,
1358 struct GNUNET_JSON_Specification *spec)
1359{
1360 struct GNUNET_CRYPTO_BlindedSignature **target = spec->ptr;
1361 struct GNUNET_CRYPTO_BlindedSignature *blinded_sig;
1362 const char *cipher;
1363 struct GNUNET_JSON_Specification dspec[] = {
1364 GNUNET_JSON_spec_string ("cipher",
1365 &cipher),
1367 };
1368 const char *emsg;
1369 unsigned int eline;
1370
1371 (void) cls;
1372 if (GNUNET_OK !=
1373 GNUNET_JSON_parse (root,
1374 dspec,
1375 &emsg,
1376 &eline))
1377 {
1378 GNUNET_break_op (0);
1379 return GNUNET_SYSERR;
1380 }
1381 blinded_sig = GNUNET_new (struct GNUNET_CRYPTO_BlindedSignature);
1382 blinded_sig->cipher = string_to_cipher (cipher);
1383 blinded_sig->rc = 1;
1384 switch (blinded_sig->cipher)
1385 {
1387 break;
1389 {
1390 struct GNUNET_JSON_Specification ispec[] = {
1392 "blinded_rsa_signature",
1393 &blinded_sig->details.blinded_rsa_signature),
1395 };
1396
1397 if (GNUNET_OK !=
1398 GNUNET_JSON_parse (root,
1399 ispec,
1400 &emsg,
1401 &eline))
1402 {
1403 GNUNET_break_op (0);
1404 GNUNET_free (blinded_sig);
1405 return GNUNET_SYSERR;
1406 }
1407 *target = blinded_sig;
1408 return GNUNET_OK;
1409 }
1411 {
1412 struct GNUNET_JSON_Specification ispec[] = {
1414 &blinded_sig->details.blinded_cs_answer.b),
1416 &blinded_sig->details.blinded_cs_answer.
1417 s_scalar),
1419 };
1420
1421 if (GNUNET_OK !=
1422 GNUNET_JSON_parse (root,
1423 ispec,
1424 &emsg,
1425 &eline))
1426 {
1427 GNUNET_break_op (0);
1428 GNUNET_free (blinded_sig);
1429 return GNUNET_SYSERR;
1430 }
1431 *target = blinded_sig;
1432 return GNUNET_OK;
1433 }
1434 }
1435 GNUNET_break_op (0);
1436 GNUNET_free (blinded_sig);
1437 return GNUNET_SYSERR;
1438}
1439
1440
1447static void
1449 struct GNUNET_JSON_Specification *spec)
1450{
1451 struct GNUNET_CRYPTO_BlindedSignature **b_sig = spec->ptr;
1452
1453 (void) cls;
1454
1455 if (NULL != *b_sig)
1456 {
1458 *b_sig = NULL;
1459 }
1460}
1461
1462
1465 struct GNUNET_CRYPTO_BlindedSignature **b_sig)
1466{
1468 .parser = &parse_blinded_sig,
1469 .cleaner = &clean_blinded_sig,
1470 .field = field,
1471 .ptr = b_sig
1472 };
1473
1474 *b_sig = NULL;
1475 return ret;
1476}
1477
1486static enum GNUNET_GenericReturnValue
1488 json_t *root,
1489 struct GNUNET_JSON_Specification *spec)
1490{
1491 struct GNUNET_CRYPTO_UnblindedSignature **target = spec->ptr;
1492 struct GNUNET_CRYPTO_UnblindedSignature *unblinded_sig;
1493 const char *cipher;
1494 struct GNUNET_JSON_Specification dspec[] = {
1495 GNUNET_JSON_spec_string ("cipher",
1496 &cipher),
1498 };
1499 const char *emsg;
1500 unsigned int eline;
1501
1502 (void) cls;
1503 if (GNUNET_OK !=
1504 GNUNET_JSON_parse (root,
1505 dspec,
1506 &emsg,
1507 &eline))
1508 {
1509 GNUNET_break_op (0);
1510 return GNUNET_SYSERR;
1511 }
1512 unblinded_sig = GNUNET_new (struct GNUNET_CRYPTO_UnblindedSignature);
1513 unblinded_sig->cipher = string_to_cipher (cipher);
1514 unblinded_sig->rc = 1;
1515 switch (unblinded_sig->cipher)
1516 {
1518 break;
1520 {
1521 struct GNUNET_JSON_Specification ispec[] = {
1523 "rsa_signature",
1524 &unblinded_sig->details.rsa_signature),
1526 };
1527
1528 if (GNUNET_OK !=
1529 GNUNET_JSON_parse (root,
1530 ispec,
1531 &emsg,
1532 &eline))
1533 {
1534 GNUNET_break_op (0);
1535 GNUNET_free (unblinded_sig);
1536 return GNUNET_SYSERR;
1537 }
1538 *target = unblinded_sig;
1539 return GNUNET_OK;
1540 }
1542 {
1543 struct GNUNET_JSON_Specification ispec[] = {
1544 GNUNET_JSON_spec_fixed_auto ("cs_signature_r",
1545 &unblinded_sig->details.cs_signature.
1546 r_point),
1547 GNUNET_JSON_spec_fixed_auto ("cs_signature_s",
1548 &unblinded_sig->details.cs_signature.
1549 s_scalar),
1551 };
1552
1553 if (GNUNET_OK !=
1554 GNUNET_JSON_parse (root,
1555 ispec,
1556 &emsg,
1557 &eline))
1558 {
1559 GNUNET_break_op (0);
1560 GNUNET_free (unblinded_sig);
1561 return GNUNET_SYSERR;
1562 }
1563 *target = unblinded_sig;
1564 return GNUNET_OK;
1565 }
1566 }
1567 GNUNET_break_op (0);
1568 GNUNET_free (unblinded_sig);
1569 return GNUNET_SYSERR;
1570}
1571
1572
1579static void
1581 struct GNUNET_JSON_Specification *spec)
1582{
1583 struct GNUNET_CRYPTO_UnblindedSignature **ub_sig = spec->ptr;
1584
1585 (void) cls;
1586 if (NULL != *ub_sig)
1587 {
1589 *ub_sig = NULL;
1590 }
1591}
1592
1593
1596 struct GNUNET_CRYPTO_UnblindedSignature **ub_sig)
1597{
1599 .parser = &parse_unblinded_sig,
1600 .cleaner = &clean_unblinded_sig,
1601 .field = field,
1602 .ptr = ub_sig
1603 };
1604
1605 *ub_sig = NULL;
1606 return ret;
1607}
1608
1609
1610
1611/* end of json_helper.c */
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static int ret
Final status code.
Definition: gnunet-arm.c:94
static char * data
The data to insert into the dht.
static OpusEncoder * enc
OPUS encoder.
struct GNUNET_CRYPTO_PrivateKey pk
Private key from command line option, or NULL.
static char * name
Name (label) of the records to list.
static char * res
Currently read line or NULL on EOF.
static struct GNUNET_SCHEDULER_Task * t
Main task.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
functions to parse JSON objects into GNUnet objects
#define GNUNET_JSON_spec_fixed_auto(name, obj)
Fixed size object (in network byte order, encoded using Crockford Base32hex encoding).
enum GNUNET_GenericReturnValue GNUNET_JSON_parse(const json_t *root, struct GNUNET_JSON_Specification *spec, const char **error_json_name, unsigned int *error_line)
Navigate and parse data in a JSON tree.
Definition: json.c:32
void GNUNET_CRYPTO_blinded_message_decref(struct GNUNET_CRYPTO_BlindedMessage *bm)
Decrement reference counter of a bm, and free it if it reaches zero.
#define GNUNET_log(kind,...)
void GNUNET_CRYPTO_rsa_signature_free(struct GNUNET_CRYPTO_RsaSignature *sig)
Free memory occupied by signature.
Definition: crypto_rsa.c:1015
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_signature_decode(const void *buf, size_t buf_size)
Decode the signature from the data-format back to the "normal", internal format.
Definition: crypto_rsa.c:1063
GNUNET_CRYPTO_BlindSignatureAlgorithm
Types of public keys used for blind signatures.
struct GNUNET_CRYPTO_RsaPublicKey * GNUNET_CRYPTO_rsa_public_key_decode(const char *buf, size_t len)
Decode the public key from the data-format back to the "normal", internal format.
Definition: crypto_rsa.c:423
void GNUNET_CRYPTO_rsa_public_key_free(struct GNUNET_CRYPTO_RsaPublicKey *key)
Free memory occupied by the public key.
Definition: crypto_rsa.c:268
void GNUNET_CRYPTO_unblinded_sig_decref(struct GNUNET_CRYPTO_UnblindedSignature *ub_sig)
Decrement reference counter of a ub_sig, and free it if it reaches zero.
void GNUNET_CRYPTO_blinded_sig_decref(struct GNUNET_CRYPTO_BlindedSignature *blind_sig)
Decrement reference counter of a blind_sig, and free it if it reaches zero.
GNUNET_GenericReturnValue
Named constants for return values.
@ GNUNET_CRYPTO_BSA_INVALID
Invalid type of signature.
@ GNUNET_CRYPTO_BSA_CS
Clause Blind Schnorr signature.
@ GNUNET_CRYPTO_BSA_RSA
RSA blind signature.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
@ GNUNET_ERROR_TYPE_WARNING
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_string_to_data_alloc(const char *enc, size_t enclen, void **out, size_t *out_size)
Convert CrockfordBase32 encoding back to data.
Definition: strings.c:855
enum GNUNET_GenericReturnValue GNUNET_STRINGS_string_to_data(const char *enc, size_t enclen, void *out, size_t out_size)
Convert CrockfordBase32 encoding back to data.
Definition: strings.c:789
size_t GNUNET_STRINGS_base64_decode(const char *data, size_t len, void **output)
Decode from Base64.
Definition: strings.c:1724
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
#define GNUNET_TIME_UNIT_SECONDS
One second.
struct GNUNET_TIME_TimestampNBO GNUNET_TIME_timestamp_hton(struct GNUNET_TIME_Timestamp t)
Convert timestamp to network byte order.
Definition: time.c:91
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
struct GNUNET_JSON_Specification GNUNET_JSON_spec_object_const(const char *name, const json_t **jsonp)
JSON object, reference counter not incremented.
Definition: json_helper.c:409
struct GNUNET_JSON_Specification GNUNET_JSON_spec_blinded_message(const char *name, struct GNUNET_CRYPTO_BlindedMessage **msg)
Specification for parsing a blinded message.
Definition: json_helper.c:1329
static enum GNUNET_GenericReturnValue parse_u32(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a uint32_t.
Definition: json_helper.c:669
static void clean_unblinded_sig(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing unblinded signature.
Definition: json_helper.c:1580
static enum GNUNET_GenericReturnValue parse_blinded_sig(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a blinded signature.
Definition: json_helper.c:1356
struct GNUNET_JSON_Specification GNUNET_JSON_spec_varsize(const char *name, void **obj, size_t *size)
Variable size object (in network byte order, encoded using Crockford Base32hex encoding).
Definition: json_helper.c:258
struct GNUNET_JSON_Specification GNUNET_JSON_spec_fixed(const char *name, void *obj, size_t size)
Variable size object (in network byte order, encoded using Crockford Base32hex encoding).
Definition: json_helper.c:117
static enum GNUNET_GenericReturnValue parse_u16(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a uint16_t.
Definition: json_helper.c:619
struct GNUNET_JSON_Specification GNUNET_JSON_spec_end()
End of a parser specification.
Definition: json_helper.c:33
static enum GNUNET_GenericReturnValue parse_i64(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a int64_t.
Definition: json_helper.c:764
static enum GNUNET_GenericReturnValue parse_blinded_message(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a blinded message.
Definition: json_helper.c:1216
static enum GNUNET_GenericReturnValue parse_rsa_signature(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to RSA signature.
Definition: json_helper.c:1085
static enum GNUNET_GenericReturnValue parse_double(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a double.
Definition: json_helper.c:526
struct GNUNET_JSON_Specification GNUNET_JSON_spec_json(const char *name, json_t **jsonp)
JSON object or array.
Definition: json_helper.c:365
static enum GNUNET_GenericReturnValue parse_unblinded_sig(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to unblinded signature.
Definition: json_helper.c:1487
static void clean_rsa_public_key(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing RSA public key.
Definition: json_helper.c:1047
struct GNUNET_JSON_Specification GNUNET_JSON_spec_blinded_signature(const char *field, struct GNUNET_CRYPTO_BlindedSignature **b_sig)
Specification for parsing a blinded signature.
Definition: json_helper.c:1464
static void clean_rsa_signature(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing RSA signature.
Definition: json_helper.c:1132
struct GNUNET_JSON_Specification GNUNET_JSON_spec_boolean(const char *name, int *boolean)
Boolean (true mapped to GNUNET_YES, false mapped to GNUNET_NO).
Definition: json_helper.c:1190
static enum GNUNET_GenericReturnValue parse_timestamp(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a timestamp.
Definition: json_helper.c:811
struct GNUNET_JSON_Specification GNUNET_JSON_spec_rsa_public_key(const char *name, struct GNUNET_CRYPTO_RsaPublicKey **pk)
Specification for parsing an RSA public key.
Definition: json_helper.c:1061
struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint16(const char *name, uint16_t *u16)
16-bit integer.
Definition: json_helper.c:643
static enum GNUNET_GenericReturnValue parse_u8(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a uint8_t.
Definition: json_helper.c:569
static enum GNUNET_GenericReturnValue parse_timestamp_nbo(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to absolute time.
Definition: json_helper.c:885
static void clean_blinded_message(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing blinded message.
Definition: json_helper.c:1314
struct GNUNET_JSON_Specification GNUNET_JSON_spec_timestamp_nbo(const char *name, struct GNUNET_TIME_TimestampNBO *at)
Timestamp in network byte order.
Definition: json_helper.c:907
struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint32(const char *name, uint32_t *u32)
32-bit integer.
Definition: json_helper.c:693
static enum GNUNET_GenericReturnValue parse_string(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to string.
Definition: json_helper.c:287
struct GNUNET_JSON_Specification GNUNET_JSON_spec_string(const char *name, const char **strptr)
The expected field stores a string.
Definition: json_helper.c:306
struct GNUNET_JSON_Specification GNUNET_JSON_spec_double(const char *name, double *f)
double.
Definition: json_helper.c:543
static enum GNUNET_GenericReturnValue parse_object_const(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a JSON object.
Definition: json_helper.c:392
struct GNUNET_JSON_Specification GNUNET_JSON_spec_int64(const char *name, int64_t *i64)
64-bit signed integer.
Definition: json_helper.c:783
static enum GNUNET_GenericReturnValue parse_boolean(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to an int as a boolean.
Definition: json_helper.c:1173
static enum GNUNET_CRYPTO_BlindSignatureAlgorithm string_to_cipher(const char *cipher_s)
Convert string value to numeric cipher value.
Definition: json_helper.c:52
struct GNUNET_JSON_Specification GNUNET_JSON_spec_rsa_signature(const char *name, struct GNUNET_CRYPTO_RsaSignature **sig)
Specification for parsing an RSA signature.
Definition: json_helper.c:1146
static enum GNUNET_GenericReturnValue parse_fixed64_data(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to fixed size data.
Definition: json_helper.c:144
static void clean_blinded_sig(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing blinded sig.
Definition: json_helper.c:1448
static void clean_json(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing JSON object.
Definition: json_helper.c:351
struct GNUNET_JSON_Specification GNUNET_JSON_spec_timestamp(const char *name, struct GNUNET_TIME_Timestamp *t)
Timestamp.
Definition: json_helper.c:862
static enum GNUNET_GenericReturnValue parse_array_const(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON to a JSON array.
Definition: json_helper.c:435
struct GNUNET_JSON_Specification GNUNET_JSON_spec_unblinded_signature(const char *field, struct GNUNET_CRYPTO_UnblindedSignature **ub_sig)
Specification for parsing an unblinded signature.
Definition: json_helper.c:1595
static enum GNUNET_GenericReturnValue parse_fixed_data(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to fixed size data.
Definition: json_helper.c:77
struct GNUNET_JSON_Specification GNUNET_JSON_spec_array_const(const char *name, const json_t **jsonp)
JSON array, reference counter not incremented.
Definition: json_helper.c:452
struct GNUNET_JSON_Specification GNUNET_JSON_spec_fixed64(const char *name, void *obj, size_t size)
Variable size object (in network byte order, encoded using base64 encoding).
Definition: json_helper.c:181
static enum GNUNET_GenericReturnValue parse_u64(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a uint64_t.
Definition: json_helper.c:719
static enum GNUNET_GenericReturnValue parse_bool(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a bool.
Definition: json_helper.c:478
struct GNUNET_JSON_Specification GNUNET_JSON_spec_bool(const char *name, bool *b)
boolean.
Definition: json_helper.c:500
struct GNUNET_JSON_Specification GNUNET_JSON_spec_relative_time(const char *name, struct GNUNET_TIME_Relative *rt)
Relative time.
Definition: json_helper.c:977
struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint8(const char *name, uint8_t *u8)
8-bit integer.
Definition: json_helper.c:593
struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint64(const char *name, uint64_t *u64)
64-bit integer.
Definition: json_helper.c:738
static enum GNUNET_GenericReturnValue parse_rel_time(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to relative time.
Definition: json_helper.c:930
static enum GNUNET_GenericReturnValue parse_json(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a JSON object.
Definition: json_helper.c:329
static enum GNUNET_GenericReturnValue parse_rsa_public_key(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to RSA public key.
Definition: json_helper.c:1000
static void clean_variable_data(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing variable size data.
Definition: json_helper.c:244
static enum GNUNET_GenericReturnValue parse_variable_data(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to variable size data.
Definition: json_helper.c:208
static unsigned int size
Size of the "table".
Definition: peer.c:68
#define SIZE_MAX
Definition: platform.h:208
Blinded message ready for blind signing.
unsigned int rc
Reference counter.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the sign blinded message.
struct GNUNET_CRYPTO_CsBlindedMessage cs_blinded_message
If we use GNUNET_CRYPTO_BSA_CS in cipher.
union GNUNET_CRYPTO_BlindedMessage::@18 details
Details, depending on cipher.
struct GNUNET_CRYPTO_RsaBlindedMessage rsa_blinded_message
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
Type for blinded signatures.
unsigned int rc
Reference counter.
struct GNUNET_CRYPTO_CsBlindSignature blinded_cs_answer
If we use GNUNET_CRYPTO_BSA_CS in cipher.
union GNUNET_CRYPTO_BlindedSignature::@15 details
Details, depending on cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the signature.
struct GNUNET_CRYPTO_RsaSignature * blinded_rsa_signature
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
unsigned int b
To make ROS problem harder, the signer chooses an unpredictable b and only calculates signature of c_...
struct GNUNET_CRYPTO_CsC c[2]
The Clause Schnorr c_0 and c_1 containing the blinded message.
struct GNUNET_CRYPTO_CsSessionNonce nonce
Nonce used in initial request.
size_t blinded_msg_size
Size of the blinded_msg to be signed.
void * blinded_msg
Blinded message to be signed Note: is malloc()'ed!
The public information of an RSA key pair.
Definition: crypto_rsa.c:53
an RSA signature
Definition: crypto_rsa.c:65
Type of (unblinded) signatures.
struct GNUNET_CRYPTO_RsaSignature * rsa_signature
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
unsigned int rc
Reference counter.
union GNUNET_CRYPTO_UnblindedSignature::@14 details
Details, depending on cipher.
struct GNUNET_CRYPTO_CsSignature cs_signature
If we use GNUNET_CRYPTO_BSA_CS in cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the signature.
Entry in parser specification for GNUNET_JSON_parse().
void * ptr
Pointer, details specific to the parser.
const char * field
Name of the field to parse, use NULL to get the JSON of the main object instead of the JSON of an ind...
size_t ptr_size
Number of bytes available in ptr.
size_t * size_ptr
Where should we store the final size of ptr.
void * cls
Closure for parser and cleaner.
GNUNET_JSON_Parser parser
Function for how to parse this type of entry.
uint64_t abs_value_us
The actual value.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
Time for timestamps used by GNUnet, in seconds and in network byte order.
Rounded time for timestamps used by GNUnet, in seconds.
struct GNUNET_TIME_Absolute abs_time
The actual value.