GNUnet 0.22.2
pq_query_helper.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 2014, 2015, 2016, 2020 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 */
25#include "platform.h"
26#include "gnunet_common.h"
27#include "gnunet_pq_lib.h"
28#include "gnunet_time_lib.h"
29#include "pq.h"
30
45static int
46qconv_null (void *cls,
47 const void *data,
48 size_t data_len,
49 void *param_values[],
50 int param_lengths[],
51 int param_formats[],
52 unsigned int param_length,
53 void *scratch[],
54 unsigned int scratch_length)
55{
56 (void) scratch;
57 (void) scratch_length;
58 (void) data;
59 (void) data_len;
60 GNUNET_break (NULL == cls);
61 if (1 != param_length)
62 return -1;
63 param_values[0] = NULL;
64 param_lengths[0] = 0;
65 param_formats[0] = 1;
66 return 0;
67}
68
69
72{
73 struct GNUNET_PQ_QueryParam res = {
74 .conv = &qconv_null,
75 .num_params = 1
76 };
77
78 return res;
79}
80
81
96static int
97qconv_fixed (void *cls,
98 const void *data,
99 size_t data_len,
100 void *param_values[],
101 int param_lengths[],
102 int param_formats[],
103 unsigned int param_length,
104 void *scratch[],
105 unsigned int scratch_length)
106{
107 (void) scratch;
108 (void) scratch_length;
109 GNUNET_break (NULL == cls);
110 if (1 != param_length)
111 return -1;
112 param_values[0] = (void *) data;
113 param_lengths[0] = data_len;
114 param_formats[0] = 1;
115 return 0;
116}
117
118
121 size_t ptr_size)
122{
123 struct GNUNET_PQ_QueryParam res = {
124 .conv = &qconv_fixed,
125 .conv_cls = NULL,
126 .data = ptr,
127 .size = ptr_size,
128 .num_params = 1
129 };
130
131 return res;
132}
133
134
137{
139 strlen (ptr));
140}
141
142
145{
146 static uint8_t bt = 1;
147 static uint8_t bf = 0;
148
149 return GNUNET_PQ_query_param_fixed_size (b ? &bt : &bf,
150 sizeof (uint8_t));
151}
152
153
168static int
169qconv_uint16 (void *cls,
170 const void *data,
171 size_t data_len,
172 void *param_values[],
173 int param_lengths[],
174 int param_formats[],
175 unsigned int param_length,
176 void *scratch[],
177 unsigned int scratch_length)
178{
179 const uint16_t *u_hbo = data;
180 uint16_t *u_nbo;
181
182 (void) scratch;
183 (void) scratch_length;
184 GNUNET_break (NULL == cls);
185 if (1 != param_length)
186 return -1;
187 u_nbo = GNUNET_new (uint16_t);
188 scratch[0] = u_nbo;
189 *u_nbo = htons (*u_hbo);
190 param_values[0] = (void *) u_nbo;
191 param_lengths[0] = sizeof(uint16_t);
192 param_formats[0] = 1;
193 return 1;
194}
195
196
199{
200 struct GNUNET_PQ_QueryParam res = {
201 .conv = &qconv_uint16,
202 .data = x,
203 .size = sizeof(*x),
204 .num_params = 1
205 };
206
207 return res;
208}
209
210
225static int
226qconv_uint32 (void *cls,
227 const void *data,
228 size_t data_len,
229 void *param_values[],
230 int param_lengths[],
231 int param_formats[],
232 unsigned int param_length,
233 void *scratch[],
234 unsigned int scratch_length)
235{
236 const uint32_t *u_hbo = data;
237 uint32_t *u_nbo;
238
239 (void) scratch;
240 (void) scratch_length;
241 GNUNET_break (NULL == cls);
242 if (1 != param_length)
243 return -1;
244 u_nbo = GNUNET_new (uint32_t);
245 scratch[0] = u_nbo;
246 *u_nbo = htonl (*u_hbo);
247 param_values[0] = (void *) u_nbo;
248 param_lengths[0] = sizeof(uint32_t);
249 param_formats[0] = 1;
250 return 1;
251}
252
253
256{
257 struct GNUNET_PQ_QueryParam res = {
258 .conv = &qconv_uint32,
259 .data = x,
260 .size = sizeof(*x),
261 .num_params = 1
262 };
263
264 return res;
265}
266
267
282static int
283qconv_uint64 (void *cls,
284 const void *data,
285 size_t data_len,
286 void *param_values[],
287 int param_lengths[],
288 int param_formats[],
289 unsigned int param_length,
290 void *scratch[],
291 unsigned int scratch_length)
292{
293 const uint64_t *u_hbo = data;
294 uint64_t *u_nbo;
295
296 (void) scratch;
297 (void) scratch_length;
298 GNUNET_break (NULL == cls);
299 if (1 != param_length)
300 return -1;
301 u_nbo = GNUNET_new (uint64_t);
302 scratch[0] = u_nbo;
303 *u_nbo = GNUNET_htonll (*u_hbo);
304 param_values[0] = (void *) u_nbo;
305 param_lengths[0] = sizeof(uint64_t);
306 param_formats[0] = 1;
307 return 1;
308}
309
310
313{
314 struct GNUNET_PQ_QueryParam res = {
315 .conv = &qconv_uint64,
316 .data = x,
317 .size = sizeof(*x),
318 .num_params = 1
319 };
320
321 return res;
322}
323
324
339static int
340qconv_int64 (void *cls,
341 const void *data,
342 size_t data_len,
343 void *param_values[],
344 int param_lengths[],
345 int param_formats[],
346 unsigned int param_length,
347 void *scratch[],
348 unsigned int scratch_length)
349{
350 const int64_t *u_hbo = data;
351 int64_t *u_nbo;
352
353 (void) scratch;
354 (void) scratch_length;
355 GNUNET_break (NULL == cls);
356 if (1 != param_length)
357 return -1;
358 u_nbo = GNUNET_new (int64_t);
359 scratch[0] = u_nbo;
360 *u_nbo = GNUNET_htonll (*u_hbo);
361 param_values[0] = (void *) u_nbo;
362 param_lengths[0] = sizeof(int64_t);
363 param_formats[0] = 1;
364 return 1;
365}
366
367
370{
371 struct GNUNET_PQ_QueryParam res = {
372 .conv = &qconv_int64,
373 .data = x,
374 .size = sizeof(*x),
375 .num_params = 1
376 };
377
378 return res;
379}
380
381
396static int
398 const void *data,
399 size_t data_len,
400 void *param_values[],
401 int param_lengths[],
402 int param_formats[],
403 unsigned int param_length,
404 void *scratch[],
405 unsigned int scratch_length)
406{
407 const struct GNUNET_CRYPTO_RsaPublicKey *rsa = data;
408 void *buf;
409 size_t buf_size;
410
411 GNUNET_break (NULL == cls);
412 if (1 != param_length)
413 return -1;
415 &buf);
416 scratch[0] = buf;
417 param_values[0] = (void *) buf;
418 param_lengths[0] = buf_size;
419 param_formats[0] = 1;
420 return 1;
421}
422
423
426 const struct GNUNET_CRYPTO_RsaPublicKey *x)
427{
428 struct GNUNET_PQ_QueryParam res = {
429 .conv = &qconv_rsa_public_key,
430 .data = x,
431 .num_params = 1
432 };
433
434 return res;
435}
436
437
452static int
454 const void *data,
455 size_t data_len,
456 void *param_values[],
457 int param_lengths[],
458 int param_formats[],
459 unsigned int param_length,
460 void *scratch[],
461 unsigned int scratch_length)
462{
463 const struct GNUNET_CRYPTO_RsaSignature *sig = data;
464 void *buf;
465 size_t buf_size;
466
467 GNUNET_break (NULL == cls);
468 if (1 != param_length)
469 return -1;
471 &buf);
472 scratch[0] = buf;
473 param_values[0] = (void *) buf;
474 param_lengths[0] = buf_size;
475 param_formats[0] = 1;
476 return 1;
477}
478
479
482{
483 struct GNUNET_PQ_QueryParam res = {
484 .conv = &qconv_rsa_signature,
485 .data = x,
486 .num_params = 1
487 };
488
489 return res;
490}
491
492
507static int
508qconv_rel_time (void *cls,
509 const void *data,
510 size_t data_len,
511 void *param_values[],
512 int param_lengths[],
513 int param_formats[],
514 unsigned int param_length,
515 void *scratch[],
516 unsigned int scratch_length)
517{
518 const struct GNUNET_TIME_Relative *u = data;
519 struct GNUNET_TIME_Relative rel;
520 uint64_t *u_nbo;
521
522 GNUNET_break (NULL == cls);
523 if (1 != param_length)
524 return -1;
525 rel = *u;
526 if (rel.rel_value_us > INT64_MAX)
527 rel.rel_value_us = INT64_MAX;
528 u_nbo = GNUNET_new (uint64_t);
529 scratch[0] = u_nbo;
530 *u_nbo = GNUNET_htonll (rel.rel_value_us);
531 param_values[0] = (void *) u_nbo;
532 param_lengths[0] = sizeof(uint64_t);
533 param_formats[0] = 1;
534 return 1;
535}
536
537
540{
541 struct GNUNET_PQ_QueryParam res = {
542 .conv = &qconv_rel_time,
543 .data = x,
544 .size = sizeof(*x),
545 .num_params = 1
546 };
547
548 return res;
549}
550
551
566static int
567qconv_abs_time (void *cls,
568 const void *data,
569 size_t data_len,
570 void *param_values[],
571 int param_lengths[],
572 int param_formats[],
573 unsigned int param_length,
574 void *scratch[],
575 unsigned int scratch_length)
576{
577 const struct GNUNET_TIME_Absolute *u = data;
578 struct GNUNET_TIME_Absolute abs;
579 uint64_t *u_nbo;
580
581 GNUNET_break (NULL == cls);
582 if (1 != param_length)
583 return -1;
584 abs = *u;
585 if (abs.abs_value_us > INT64_MAX)
586 abs.abs_value_us = INT64_MAX;
587 u_nbo = GNUNET_new (uint64_t);
588 scratch[0] = u_nbo;
589 *u_nbo = GNUNET_htonll (abs.abs_value_us);
590 param_values[0] = (void *) u_nbo;
591 param_lengths[0] = sizeof(uint64_t);
592 param_formats[0] = 1;
593 return 1;
594}
595
596
599{
600 struct GNUNET_PQ_QueryParam res = {
601 .conv = &qconv_abs_time,
602 .data = x,
603 .size = sizeof(*x),
604 .num_params = 1
605 };
606
607 return res;
608}
609
610
613 const struct GNUNET_TIME_AbsoluteNBO *x)
614{
615 return GNUNET_PQ_query_param_auto_from_type (&x->abs_value_us__);
616}
617
618
621{
622 return GNUNET_PQ_query_param_absolute_time (&x->abs_time);
623}
624
625
628 const struct GNUNET_TIME_TimestampNBO *x)
629{
630 return GNUNET_PQ_query_param_absolute_time_nbo (&x->abs_time_nbo);
631}
632
633
641{
648 const size_t *sizes;
649
654 size_t same_size;
655
662
667
671 Oid oid;
672};
673
678static void
680{
681 GNUNET_free (cls);
682}
683
684
703static int
705 void *cls,
706 const void *data,
707 size_t data_len,
708 void *param_values[],
709 int param_lengths[],
710 int param_formats[],
711 unsigned int param_length,
712 void *scratch[],
713 unsigned int scratch_length)
714{
715 struct qconv_array_cls *meta = cls;
716 size_t num = data_len;
717 size_t total_size;
718 const size_t *sizes;
719 bool same_sized;
720 size_t *string_lengths = NULL;
721 void *elements = NULL;
722 bool noerror = true;
723
724 (void) (param_length);
725 (void) (scratch_length);
726
727 GNUNET_assert (NULL != meta);
728 GNUNET_assert (num < INT_MAX);
729
730 sizes = meta->sizes;
731 same_sized = (0 != meta->same_size);
732
733#define RETURN_UNLESS(cond) \
734 do { \
735 if (! (cond)) \
736 { \
737 GNUNET_break ((cond)); \
738 noerror = false; \
739 goto DONE; \
740 } \
741 } while (0)
742
743 /* Calculate sizes and check bounds */
744 {
745 /* num * length-field */
746 size_t x = sizeof(uint32_t);
747 size_t y = x * num;
748 RETURN_UNLESS ((0 == num) || (y / num == x));
749
750 /* size of header */
751 total_size = x = sizeof(struct pq_array_header);
752 total_size += y;
753 RETURN_UNLESS (total_size >= x);
754
755 /* sizes of elements */
756 if (same_sized)
757 {
758 x = num * meta->same_size;
759 RETURN_UNLESS ((0 == num) || (x / num == meta->same_size));
760
761 y = total_size;
762 total_size += x;
763 RETURN_UNLESS (total_size >= y);
764 }
765 else /* sizes are different per element */
766 {
767 /* for an array of strings we need to get their length's first */
768 if (array_of_string == meta->typ)
769 {
770 string_lengths = GNUNET_new_array (num, size_t);
771
772 if (meta->continuous)
773 {
774 const char *ptr = data;
775 for (unsigned int i = 0; i < num; i++)
776 {
777 size_t len = strlen (ptr);
778 string_lengths[i] = len;
779 ptr += len + 1;
780 }
781 }
782 else
783 {
784 const char **str = (const char **) data;
785 for (unsigned int i = 0; i < num; i++)
786 string_lengths[i] = strlen (str[i]);
787 }
788
789 sizes = string_lengths;
790 }
791
792 for (unsigned int i = 0; i < num; i++)
793 {
794 x = total_size;
795 total_size += sizes[i];
796 RETURN_UNLESS (total_size >= x);
797 }
798 }
799
800 RETURN_UNLESS (total_size < INT_MAX);
801
802 elements = GNUNET_malloc (total_size);
803 }
804
805 /* Write data */
806 {
807 char *in = (char *) data;
808 char *out = elements;
809 size_t nullbyte = (array_of_string == meta->typ) ? 1 : 0;
810 struct pq_array_header h = {
811 .ndim = htonl (1), /* We only support one-dimensional arrays */
812 .has_null = htonl (0), /* We do not support NULL entries in arrays */
813 .lbound = htonl (1), /* Default start index value */
814 .dim = htonl (num),
815 .oid = htonl (meta->oid),
816 };
817
818 /* Write header */
819 GNUNET_memcpy (out, &h, sizeof(h));
820 out += sizeof(h);
821
822
823 /* Write elements */
824 for (unsigned int i = 0; i < num; i++)
825 {
826 size_t sz = same_sized ? meta->same_size : sizes[i];
827 uint32_t hsz = htonl (sz);
828
829 GNUNET_memcpy (out,
830 &hsz,
831 sizeof(hsz));
832 out += sizeof(uint32_t);
833
834 switch (meta->typ)
835 {
836 case array_of_bool:
837 {
838 GNUNET_assert (sizeof(bool) == sz);
839 *(bool *) out = (*(bool *) in);
840 in += sz;
841 break;
842 }
843 case array_of_uint16:
844 {
845 GNUNET_assert (sizeof(uint16_t) == sz);
846 *(uint16_t *) out = htons (*(uint16_t *) in);
847 in += sz;
848 break;
849 }
850 case array_of_uint32:
851 {
852 uint32_t v;
853 GNUNET_assert (sizeof(uint32_t) == sz);
854
855 v = htonl (*(uint32_t *) in);
856 GNUNET_memcpy (out,
857 &v,
858 sizeof(v));
859 in += sz;
860 break;
861 }
862 case array_of_uint64:
863 {
864 uint64_t tmp;
865 GNUNET_assert (sizeof(uint64_t) == sz);
866
867 tmp = GNUNET_htonll (*(uint64_t *) in);
868 GNUNET_memcpy (out,
869 &tmp,
870 sizeof(tmp));
871 in += sz;
872 break;
873 }
874 case array_of_byte:
875 case array_of_string:
876 {
877 const void *ptr;
878
879 if (meta->continuous)
880 {
881 ptr = in;
882 in += sz + nullbyte;
883 }
884 else
885 ptr = ((const void **) data)[i];
886
887 GNUNET_memcpy (out,
888 ptr,
889 sz);
890 break;
891 }
895 {
896 uint64_t val;
897
898 switch (meta->typ)
899 {
901 {
902 const struct GNUNET_TIME_Absolute *abs =
903 (const struct GNUNET_TIME_Absolute *) in;
904
905 GNUNET_assert (sizeof(struct GNUNET_TIME_Absolute) == sz);
906
907 if (! meta->continuous)
908 abs = ((const struct GNUNET_TIME_Absolute **) data)[i];
909
910 val = abs->abs_value_us;
911 break;
912 }
914 {
915 const struct GNUNET_TIME_Relative *rel =
916 (const struct GNUNET_TIME_Relative *) in;
917
918 GNUNET_assert (sizeof(struct GNUNET_TIME_Relative) == sz);
919
920 if (! meta->continuous)
921 rel = ((const struct GNUNET_TIME_Relative **) data)[i];
922
923 val = rel->rel_value_us;
924 break;
925 }
927 {
928 const struct GNUNET_TIME_Timestamp *ts =
929 (const struct GNUNET_TIME_Timestamp *) in;
930
931 GNUNET_assert (sizeof(struct GNUNET_TIME_Timestamp) == sz);
932
933 if (! meta->continuous)
934 ts = ((const struct GNUNET_TIME_Timestamp **) data)[i];
935
936 val = ts->abs_time.abs_value_us;
937 break;
938 }
939 default:
940 {
941 GNUNET_assert (0);
942 }
943 }
944
945 if (val > INT64_MAX)
946 val = INT64_MAX;
947
948 val = GNUNET_htonll (val);
949 GNUNET_memcpy (out,
950 &val,
951 sizeof(val));
952
953 if (meta->continuous)
954 in += sz;
955
956 break;
957 }
958 default:
959 {
960 GNUNET_assert (0);
961 break;
962 }
963 }
964 out += sz;
965 }
966 }
967
968 param_values[0] = elements;
969 param_lengths[0] = total_size;
970 param_formats[0] = 1;
971 scratch[0] = elements;
972
973DONE:
974 GNUNET_free (string_lengths);
975
976 if (noerror)
977 return 1;
978
979 return -1;
980}
981
982
995static struct GNUNET_PQ_QueryParam
997 unsigned int num,
998 bool continuous,
999 const void *elements,
1000 const size_t *sizes,
1001 size_t same_size,
1002 enum array_types typ,
1003 Oid oid)
1004{
1006
1007 meta->typ = typ;
1008 meta->oid = oid;
1009 meta->sizes = sizes;
1010 meta->same_size = same_size;
1011 meta->continuous = continuous;
1012
1013 {
1014 struct GNUNET_PQ_QueryParam res = {
1015 .conv = qconv_array,
1016 .conv_cls = meta,
1017 .conv_cls_cleanup = &qconv_array_cls_cleanup,
1018 .data = elements,
1019 .size = num,
1020 .num_params = 1,
1021 };
1022
1023 return res;
1024 }
1025}
1026
1027
1030 unsigned int num,
1031 const bool *elements,
1032 struct GNUNET_PQ_Context *db)
1033{
1034 Oid oid;
1035
1038 "bool",
1039 &oid));
1041 true,
1042 elements,
1043 NULL,
1044 sizeof(bool),
1046 oid);
1047}
1048
1049
1052 unsigned int num,
1053 const uint16_t *elements,
1054 struct GNUNET_PQ_Context *db)
1055{
1056 Oid oid;
1057
1060 "int2",
1061 &oid));
1063 true,
1064 elements,
1065 NULL,
1066 sizeof(uint16_t),
1068 oid);
1069}
1070
1071
1074 unsigned int num,
1075 const uint32_t *elements,
1076 struct GNUNET_PQ_Context *db)
1077{
1078 Oid oid;
1079
1082 "int4",
1083 &oid));
1085 true,
1086 elements,
1087 NULL,
1088 sizeof(uint32_t),
1090 oid);
1091}
1092
1093
1096 unsigned int num,
1097 const uint64_t *elements,
1098 struct GNUNET_PQ_Context *db)
1099{
1100 Oid oid;
1101
1104 "int8",
1105 &oid));
1107 true,
1108 elements,
1109 NULL,
1110 sizeof(uint64_t),
1112 oid);
1113}
1114
1115
1118 unsigned int num,
1119 const void *elements,
1120 const size_t *sizes,
1121 struct GNUNET_PQ_Context *db)
1122{
1123 Oid oid;
1124
1127 "bytea",
1128 &oid));
1130 true,
1131 elements,
1132 sizes,
1133 0,
1135 oid);
1136}
1137
1138
1141 unsigned int num,
1142 const void *elements[static num],
1143 const size_t *sizes,
1144 struct GNUNET_PQ_Context *db)
1145{
1146 Oid oid;
1147
1150 "bytea",
1151 &oid));
1153 false,
1154 elements,
1155 sizes,
1156 0,
1158 oid);
1159}
1160
1161
1164 unsigned int num,
1165 const void *elements,
1166 size_t same_size,
1167 struct GNUNET_PQ_Context *db)
1168{
1169 Oid oid;
1170
1173 "bytea",
1174 &oid));
1176 true,
1177 elements,
1178 NULL,
1179 same_size,
1181 oid);
1182}
1183
1184
1187 unsigned int num,
1188 const void *elements[static num],
1189 size_t same_size,
1190 struct GNUNET_PQ_Context *db)
1191{
1192 Oid oid;
1193
1196 "bytea",
1197 &oid));
1199 false,
1200 elements,
1201 NULL,
1202 same_size,
1204 oid);
1205}
1206
1207
1210 unsigned int num,
1211 const char *elements,
1212 struct GNUNET_PQ_Context *db)
1213{
1214 Oid oid;
1215
1218 "text",
1219 &oid));
1221 true,
1222 elements,
1223 NULL,
1224 0,
1226 oid);
1227}
1228
1229
1232 unsigned int num,
1233 const char *elements[static num],
1234 struct GNUNET_PQ_Context *db)
1235{
1236 Oid oid;
1237
1240 "text",
1241 &oid));
1243 false,
1244 elements,
1245 NULL,
1246 0,
1248 oid);
1249}
1250
1251
1254 unsigned int num,
1255 const struct GNUNET_TIME_Absolute *elements,
1256 struct GNUNET_PQ_Context *db)
1257{
1258 Oid oid;
1259
1262 "int8",
1263 &oid));
1265 true,
1266 elements,
1267 NULL,
1268 sizeof(struct GNUNET_TIME_Absolute),
1270 oid);
1271}
1272
1273
1276 unsigned int num,
1277 const struct GNUNET_TIME_Absolute *elements[],
1278 struct GNUNET_PQ_Context *db)
1279{
1280 Oid oid;
1281
1284 "int8",
1285 &oid));
1287 false,
1288 elements,
1289 NULL,
1290 sizeof(struct GNUNET_TIME_Absolute),
1292 oid);
1293}
1294
1295
1298 unsigned int num,
1299 const struct GNUNET_TIME_Relative *elements,
1300 struct GNUNET_PQ_Context *db)
1301{
1302 Oid oid;
1303
1306 "int8",
1307 &oid));
1309 true,
1310 elements,
1311 NULL,
1312 sizeof(struct GNUNET_TIME_Relative),
1314 oid);
1315}
1316
1317
1320 unsigned int num,
1321 const struct GNUNET_TIME_Relative *elements[],
1322 struct GNUNET_PQ_Context *db)
1323{
1324 Oid oid;
1325
1328 "int8",
1329 &oid));
1331 false,
1332 elements,
1333 NULL,
1334 sizeof(struct GNUNET_TIME_Relative),
1336 oid);
1337}
1338
1339
1342 unsigned int num,
1343 const struct GNUNET_TIME_Timestamp *elements,
1344 struct GNUNET_PQ_Context *db)
1345{
1346 Oid oid;
1347
1350 "int8",
1351 &oid));
1353 true,
1354 elements,
1355 NULL,
1356 sizeof(struct GNUNET_TIME_Timestamp),
1358 oid);
1359}
1360
1361
1364 unsigned int num,
1365 const struct GNUNET_TIME_Timestamp *elements[],
1366 struct GNUNET_PQ_Context *db)
1367{
1368 Oid oid;
1369
1372 "int8",
1373 &oid));
1375 false,
1376 elements,
1377 NULL,
1378 sizeof(struct GNUNET_TIME_Timestamp),
1380 oid);
1381}
1382
1383
1398static int
1400 const void *data,
1401 size_t data_len,
1402 void *param_values[],
1403 int param_lengths[],
1404 int param_formats[],
1405 unsigned int param_length,
1406 void *scratch[],
1407 unsigned int scratch_length)
1408{
1409 const struct GNUNET_CRYPTO_BlindSignPublicKey *public_key = data;
1410 size_t tlen;
1411 size_t len;
1412 uint32_t be;
1413 char *buf;
1414 void *tbuf;
1415
1416 (void) cls;
1417 (void) data_len;
1418 GNUNET_assert (1 == param_length);
1419 GNUNET_assert (scratch_length > 0);
1420 GNUNET_break (NULL == cls);
1421 be = htonl ((uint32_t) public_key->cipher);
1422 switch (public_key->cipher)
1423 {
1426 public_key->details.rsa_public_key,
1427 &tbuf);
1428 break;
1430 tlen = sizeof (public_key->details.cs_public_key);
1431 break;
1432 default:
1433 GNUNET_assert (0);
1434 }
1435 len = tlen + sizeof (be);
1436 buf = GNUNET_malloc (len);
1437 GNUNET_memcpy (buf,
1438 &be,
1439 sizeof (be));
1440 switch (public_key->cipher)
1441 {
1443 GNUNET_memcpy (&buf[sizeof (be)],
1444 tbuf,
1445 tlen);
1446 GNUNET_free (tbuf);
1447 break;
1449 GNUNET_memcpy (&buf[sizeof (be)],
1450 &public_key->details.cs_public_key,
1451 tlen);
1452 break;
1453 default:
1454 GNUNET_assert (0);
1455 }
1456
1457 scratch[0] = buf;
1458 param_values[0] = (void *) buf;
1459 param_lengths[0] = len;
1460 param_formats[0] = 1;
1461 return 1;
1462}
1463
1464
1473{
1474 struct GNUNET_PQ_QueryParam res = {
1475 .conv = &qconv_blind_sign_pub,
1476 .data = pub,
1477 .num_params = 1
1478 };
1479
1480 return res;
1481}
1482
1483
1498static int
1500 const void *data,
1501 size_t data_len,
1502 void *param_values[],
1503 int param_lengths[],
1504 int param_formats[],
1505 unsigned int param_length,
1506 void *scratch[],
1507 unsigned int scratch_length)
1508{
1509 const struct GNUNET_CRYPTO_BlindSignPrivateKey *private_key = data;
1510 size_t tlen;
1511 size_t len;
1512 uint32_t be;
1513 char *buf;
1514 void *tbuf;
1515
1516 (void) cls;
1517 (void) data_len;
1518 GNUNET_assert (1 == param_length);
1519 GNUNET_assert (scratch_length > 0);
1520 GNUNET_break (NULL == cls);
1521 be = htonl ((uint32_t) private_key->cipher);
1522 switch (private_key->cipher)
1523 {
1526 private_key->details.rsa_private_key,
1527 &tbuf);
1528 break;
1530 tlen = sizeof (private_key->details.cs_private_key);
1531 break;
1532 default:
1533 GNUNET_assert (0);
1534 }
1535 len = tlen + sizeof (be);
1536 buf = GNUNET_malloc (len);
1537 GNUNET_memcpy (buf,
1538 &be,
1539 sizeof (be));
1540 switch (private_key->cipher)
1541 {
1543 GNUNET_memcpy (&buf[sizeof (be)],
1544 tbuf,
1545 tlen);
1546 GNUNET_free (tbuf);
1547 break;
1549 GNUNET_memcpy (&buf[sizeof (be)],
1550 &private_key->details.cs_private_key,
1551 tlen);
1552 break;
1553 default:
1554 GNUNET_assert (0);
1555 }
1556
1557 scratch[0] = buf;
1558 param_values[0] = (void *) buf;
1559 param_lengths[0] = len;
1560 param_formats[0] = 1;
1561 return 1;
1562}
1563
1564
1572 const struct GNUNET_CRYPTO_BlindSignPrivateKey *priv)
1573{
1574 struct GNUNET_PQ_QueryParam res = {
1575 .conv = &qconv_blind_sign_priv,
1576 .data = priv,
1577 .num_params = 1
1578 };
1579
1580 return res;
1581}
1582
1583
1598static int
1600 const void *data,
1601 size_t data_len,
1602 void *param_values[],
1603 int param_lengths[],
1604 int param_formats[],
1605 unsigned int param_length,
1606 void *scratch[],
1607 unsigned int scratch_length)
1608{
1609 const struct GNUNET_CRYPTO_UnblindedSignature *ubs = data;
1610 size_t tlen;
1611 size_t len;
1612 uint32_t be[2];
1613 char *buf;
1614 void *tbuf;
1615
1616 (void) cls;
1617 (void) data_len;
1618 GNUNET_assert (1 == param_length);
1619 GNUNET_assert (scratch_length > 0);
1620 GNUNET_break (NULL == cls);
1621 be[0] = htonl ((uint32_t) ubs->cipher);
1622 be[1] = htonl (0x00); /* magic marker: unblinded */
1623 switch (ubs->cipher)
1624 {
1628 &tbuf);
1629 break;
1631 tlen = sizeof (ubs->details.cs_signature);
1632 break;
1633 default:
1634 GNUNET_assert (0);
1635 }
1636 len = tlen + sizeof (be);
1637 buf = GNUNET_malloc (len);
1638 GNUNET_memcpy (buf,
1639 &be,
1640 sizeof (be));
1641 switch (ubs->cipher)
1642 {
1644 GNUNET_memcpy (&buf[sizeof (be)],
1645 tbuf,
1646 tlen);
1647 GNUNET_free (tbuf);
1648 break;
1650 GNUNET_memcpy (&buf[sizeof (be)],
1651 &ubs->details.cs_signature,
1652 tlen);
1653 break;
1654 default:
1655 GNUNET_assert (0);
1656 }
1657
1658 scratch[0] = buf;
1659 param_values[0] = (void *) buf;
1660 param_lengths[0] = len;
1661 param_formats[0] = 1;
1662 return 1;
1663}
1664
1665
1673 const struct GNUNET_CRYPTO_UnblindedSignature *sig)
1674{
1675 struct GNUNET_PQ_QueryParam res = {
1676 .conv = &qconv_unblinded_sig,
1677 .data = sig,
1678 .num_params = 1
1679 };
1680
1681 return res;
1682}
1683
1684
1699static int
1701 const void *data,
1702 size_t data_len,
1703 void *param_values[],
1704 int param_lengths[],
1705 int param_formats[],
1706 unsigned int param_length,
1707 void *scratch[],
1708 unsigned int scratch_length)
1709{
1710 const struct GNUNET_CRYPTO_BlindedSignature *bs = data;
1711 size_t tlen;
1712 size_t len;
1713 uint32_t be[2];
1714 char *buf;
1715 void *tbuf;
1716
1717 (void) cls;
1718 (void) data_len;
1719 GNUNET_assert (1 == param_length);
1720 GNUNET_assert (scratch_length > 0);
1721 GNUNET_break (NULL == cls);
1722 be[0] = htonl ((uint32_t) bs->cipher);
1723 be[1] = htonl (0x01); /* magic marker: blinded */
1724 switch (bs->cipher)
1725 {
1729 &tbuf);
1730 break;
1732 tlen = sizeof (bs->details.blinded_cs_answer);
1733 break;
1734 default:
1735 GNUNET_assert (0);
1736 }
1737 len = tlen + sizeof (be);
1738 buf = GNUNET_malloc (len);
1739 GNUNET_memcpy (buf,
1740 &be,
1741 sizeof (be));
1742 switch (bs->cipher)
1743 {
1745 GNUNET_memcpy (&buf[sizeof (be)],
1746 tbuf,
1747 tlen);
1748 GNUNET_free (tbuf);
1749 break;
1751 GNUNET_memcpy (&buf[sizeof (be)],
1753 tlen);
1754 break;
1755 default:
1756 GNUNET_assert (0);
1757 }
1758
1759 scratch[0] = buf;
1760 param_values[0] = (void *) buf;
1761 param_lengths[0] = len;
1762 param_formats[0] = 1;
1763 return 1;
1764}
1765
1766
1774 const struct GNUNET_CRYPTO_BlindedSignature *b_sig)
1775{
1776 struct GNUNET_PQ_QueryParam res = {
1777 .conv = &qconv_blinded_sig,
1778 .data = b_sig,
1779 .num_params = 1
1780 };
1781
1782 return res;
1783}
1784
1785
1786/* end of pq_query_helper.c */
#define INT_MAX
static mp_limb_t u[(((256)+GMP_NUMB_BITS - 1)/GMP_NUMB_BITS)]
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:98
static char * data
The data to insert into the dht.
static char * res
Currently read line or NULL on EOF.
static struct GNUNET_FS_MetaData * meta
Meta-data provided via command-line option.
static struct GNUNET_CRYPTO_EddsaPublicKey pub
Definition: gnunet-scrypt.c:47
static struct GNUNET_FS_DirectoryBuilder * db
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
helper functions for Postgres DB interactions
#define GNUNET_PQ_query_param_auto_from_type(x)
Generate fixed-size query parameter with size determined by variable type.
uint32_t oid
Definition: gnunet_pq_lib.h:2
enum GNUNET_GenericReturnValue GNUNET_PQ_get_oid_by_name(struct GNUNET_PQ_Context *db, const char *name, Oid *oid)
Returns the oid for a given datatype by name.
Definition: pq_connect.c:461
Functions related to time.
size_t GNUNET_CRYPTO_rsa_public_key_encode(const struct GNUNET_CRYPTO_RsaPublicKey *key, void **buffer)
Encode the public key in a format suitable for storing it into a file.
Definition: crypto_rsa.c:325
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:37
size_t GNUNET_CRYPTO_rsa_signature_encode(const struct GNUNET_CRYPTO_RsaSignature *sig, void **buffer)
Encode the given signature in a format suitable for storing it into a file.
Definition: crypto_rsa.c:1023
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
size_t GNUNET_CRYPTO_rsa_private_key_encode(const struct GNUNET_CRYPTO_RsaPrivateKey *key, void **buffer)
Encode the private key in a format suitable for storing it into a file.
Definition: crypto_rsa.c:181
@ GNUNET_CRYPTO_BSA_CS
Clause Blind Schnorr signature.
@ GNUNET_CRYPTO_BSA_RSA
RSA blind signature.
@ GNUNET_OK
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
shared internal data structures of libgnunetpq
array_types
Internal types that are supported as array types.
Definition: pq.h:142
@ array_of_byte
Definition: pq.h:147
@ array_of_uint32
Definition: pq.h:145
@ array_of_string
Definition: pq.h:148
@ array_of_rel_time
Definition: pq.h:150
@ array_of_uint16
Definition: pq.h:144
@ array_of_uint64
Definition: pq.h:146
@ array_of_abs_time
Definition: pq.h:149
@ array_of_timestamp
Definition: pq.h:151
@ array_of_bool
Definition: pq.h:143
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_fixed_size(const void *ptr, size_t ptr_size)
Generate query parameter for a buffer ptr of ptr_size bytes.
static int qconv_fixed(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_rel_time(unsigned int num, const struct GNUNET_TIME_Relative *elements[], struct GNUNET_PQ_Context *db)
Generate query parameter for an array of relative time stamps (pointers)
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_uint64(const uint64_t *x)
Generate query parameter for an uint64_t in host byte order.
static int qconv_rel_time(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_abs_time(unsigned int num, const struct GNUNET_TIME_Absolute *elements, struct GNUNET_PQ_Context *db)
Generate query parameter for an array of absolute time stamps (continuous)
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_null(void)
Generate query parameter to create a NULL value.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_timestamp(unsigned int num, const struct GNUNET_TIME_Timestamp *elements[], struct GNUNET_PQ_Context *db)
Generate query parameter for an array of time stamps (pointers)
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_blind_sign_pub(const struct GNUNET_CRYPTO_BlindSignPublicKey *pub)
Generate query parameter for a blind sign public key of variable size.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_abs_time(unsigned int num, const struct GNUNET_TIME_Absolute *elements[], struct GNUNET_PQ_Context *db)
Generate query parameter for an array of absolute time stamps (pointers)
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_uint32(unsigned int num, const uint32_t *elements, struct GNUNET_PQ_Context *db)
Generate query parameter for an array of uint32_t in host byte order.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_unblinded_sig(const struct GNUNET_CRYPTO_UnblindedSignature *sig)
Generate query parameter for an unblinded signature of variable size.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_bytes(unsigned int num, const void *elements[static num], const size_t *sizes, struct GNUNET_PQ_Context *db)
Generate query parameter for an array of buffers elements, with sizes sizes.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_absolute_time(const struct GNUNET_TIME_Absolute *x)
Generate query parameter for an absolute time value.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_relative_time(const struct GNUNET_TIME_Relative *x)
Generate query parameter for a relative time value.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_uint64(unsigned int num, const uint64_t *elements, struct GNUNET_PQ_Context *db)
Generate query parameter for an array of uint64 in host byte order.
#define RETURN_UNLESS(cond)
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_int64(const int64_t *x)
Generate query parameter for an int64_t in host byte order.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_uint16(const uint16_t *x)
Generate query parameter for an uint16_t in host byte order.
static int qconv_unblinded_sig(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_rsa_public_key(const struct GNUNET_CRYPTO_RsaPublicKey *x)
Generate query parameter for an RSA public key.
static int qconv_blinded_sig(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
static int qconv_null(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
static int qconv_blind_sign_pub(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_bool(unsigned int num, const bool *elements, struct GNUNET_PQ_Context *db)
Generate query parameter for an array of bool in host byte order.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_absolute_time_nbo(const struct GNUNET_TIME_AbsoluteNBO *x)
Generate query parameter for an absolute time value.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_string(unsigned int num, const char *elements[static num], struct GNUNET_PQ_Context *db)
Generate query parameter for an array of strings (pointers)
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_bytes(unsigned int num, const void *elements, const size_t *sizes, struct GNUNET_PQ_Context *db)
Generate query parameter for an array of buffers elements, each of corresponding size given in sizes.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_bool(bool b)
Pass a boolean into a query.
static void qconv_array_cls_cleanup(void *cls)
Callback to cleanup a qconv_array_cls to be used during GNUNET_PQ_cleanup_query_params_closures.
static int qconv_uint64(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
static int qconv_blind_sign_priv(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
static int qconv_uint32(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
static int qconv_array(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters for arrays.
static int qconv_abs_time(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_blind_sign_priv(const struct GNUNET_CRYPTO_BlindSignPrivateKey *priv)
Generate query parameter for a blind sign private key of variable size.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_blinded_sig(const struct GNUNET_CRYPTO_BlindedSignature *b_sig)
Generate query parameter for a blinded signature of variable size.
static int qconv_rsa_signature(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_timestamp(unsigned int num, const struct GNUNET_TIME_Timestamp *elements, struct GNUNET_PQ_Context *db)
Generate query parameter for an array of time stamps (continuous)
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_rel_time(unsigned int num, const struct GNUNET_TIME_Relative *elements, struct GNUNET_PQ_Context *db)
Generate query parameter for an array of relative time stamps (continuous)
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_uint16(unsigned int num, const uint16_t *elements, struct GNUNET_PQ_Context *db)
Generate query parameter for an array of uint16_t in host byte order.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_uint32(const uint32_t *x)
Generate query parameter for an uint32_t in host byte order.
static int qconv_uint16(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_timestamp(const struct GNUNET_TIME_Timestamp *x)
Generate query parameter for a timestamp.
static int qconv_rsa_public_key(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_timestamp_nbo(const struct GNUNET_TIME_TimestampNBO *x)
Generate query parameter for a timestamp in NBO.
static int qconv_int64(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
static struct GNUNET_PQ_QueryParam query_param_array_generic(unsigned int num, bool continuous, const void *elements, const size_t *sizes, size_t same_size, enum array_types typ, Oid oid)
Function to generate a typ specific query parameter and corresponding closure.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_bytes_same_size(unsigned int num, const void *elements[static num], size_t same_size, struct GNUNET_PQ_Context *db)
Generate query parameter for an array of pointers to buffers elements, each of the same size size.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_string(unsigned int num, const char *elements, struct GNUNET_PQ_Context *db)
Generate query parameter for an array of strings (continuous)
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_string(const char *ptr)
Generate query parameter for a string.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_bytes_same_size(unsigned int num, const void *elements, size_t same_size, struct GNUNET_PQ_Context *db)
Generate query parameter for an array of buffers elements, each of the same size size.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_rsa_signature(const struct GNUNET_CRYPTO_RsaSignature *x)
Generate query parameter for an RSA signature.
Type of private signing keys for blind signing.
struct GNUNET_CRYPTO_CsPrivateKey cs_private_key
If we use GNUNET_CRYPTO_BSA_CS in cipher.
struct GNUNET_CRYPTO_RsaPrivateKey * rsa_private_key
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the public key.
union GNUNET_CRYPTO_BlindSignPrivateKey::@17 details
Details, depending on cipher.
Type of public signing keys for blind signatures.
union GNUNET_CRYPTO_BlindSignPublicKey::@16 details
Details, depending on cipher.
struct GNUNET_CRYPTO_CsPublicKey cs_public_key
If we use GNUNET_CRYPTO_BSA_CS in cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the public key.
struct GNUNET_CRYPTO_RsaPublicKey * rsa_public_key
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
Type for blinded signatures.
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.
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.
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.
Handle to Postgres database.
Definition: pq.h:36
unsigned int num
Definition: pq.h:122
Description of a DB query parameter.
Definition: gnunet_pq_lib.h:83
size_t size
Size of data.
Time for absolute time used by GNUnet, in microseconds and in network byte order.
Time for absolute times used by GNUnet, in microseconds.
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.
Time for timestamps used by GNUnet, in microseconds rounded to seconds.
struct GNUNET_TIME_Absolute abs_time
The actual value.
the header for a postgresql array in binary format.
Definition: pq.h:161
Closure for the array type handlers.
const size_t * sizes
If not null, contains the array of sizes (the size of the array is the .size field in the ambient GNU...
enum array_types typ
Type of the array elements.
size_t same_size
If size and c_sizes are NULL, this field defines the same size for each element in the array.
Oid oid
Oid of the array elements.
bool continuous
If true, the array parameter to the data pointer to the qconv_array is a continuous byte array of dat...