GNUnet 0.24.1-15-gab6ed22f1
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_int16 (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 int16_t *u_hbo = data;
351 int16_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 (int16_t);
359 scratch[0] = u_nbo;
360 *u_nbo = GNUNET_htobe16 (*u_hbo);
361 param_values[0] = (void *) u_nbo;
362 param_lengths[0] = sizeof(int16_t);
363 param_formats[0] = 1;
364 return 1;
365}
366
367
370{
371 struct GNUNET_PQ_QueryParam res = {
372 .conv = &qconv_int16,
373 .data = x,
374 .size = sizeof(*x),
375 .num_params = 1
376 };
377
378 return res;
379}
380
381
396static int
397qconv_int64 (void *cls,
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 int64_t *u_hbo = data;
408 int64_t *u_nbo;
409
410 (void) scratch;
411 (void) scratch_length;
412 GNUNET_break (NULL == cls);
413 if (1 != param_length)
414 return -1;
415 u_nbo = GNUNET_new (int64_t);
416 scratch[0] = u_nbo;
417 *u_nbo = GNUNET_htonll (*u_hbo);
418 param_values[0] = (void *) u_nbo;
419 param_lengths[0] = sizeof(int64_t);
420 param_formats[0] = 1;
421 return 1;
422}
423
424
427{
428 struct GNUNET_PQ_QueryParam res = {
429 .conv = &qconv_int64,
430 .data = x,
431 .size = sizeof(*x),
432 .num_params = 1
433 };
434
435 return res;
436}
437
438
453static int
455 const void *data,
456 size_t data_len,
457 void *param_values[],
458 int param_lengths[],
459 int param_formats[],
460 unsigned int param_length,
461 void *scratch[],
462 unsigned int scratch_length)
463{
464 const struct GNUNET_CRYPTO_RsaPublicKey *rsa = data;
465 void *buf;
466 size_t buf_size;
467
468 GNUNET_break (NULL == cls);
469 if (1 != param_length)
470 return -1;
472 &buf);
473 scratch[0] = buf;
474 param_values[0] = (void *) buf;
475 param_lengths[0] = buf_size;
476 param_formats[0] = 1;
477 return 1;
478}
479
480
483 const struct GNUNET_CRYPTO_RsaPublicKey *x)
484{
485 struct GNUNET_PQ_QueryParam res = {
486 .conv = &qconv_rsa_public_key,
487 .data = x,
488 .num_params = 1
489 };
490
491 return res;
492}
493
494
509static int
511 const void *data,
512 size_t data_len,
513 void *param_values[],
514 int param_lengths[],
515 int param_formats[],
516 unsigned int param_length,
517 void *scratch[],
518 unsigned int scratch_length)
519{
520 const struct GNUNET_CRYPTO_RsaSignature *sig = data;
521 void *buf;
522 size_t buf_size;
523
524 GNUNET_break (NULL == cls);
525 if (1 != param_length)
526 return -1;
528 &buf);
529 scratch[0] = buf;
530 param_values[0] = (void *) buf;
531 param_lengths[0] = buf_size;
532 param_formats[0] = 1;
533 return 1;
534}
535
536
539{
540 struct GNUNET_PQ_QueryParam res = {
541 .conv = &qconv_rsa_signature,
542 .data = x,
543 .num_params = 1
544 };
545
546 return res;
547}
548
549
564static int
565qconv_rel_time (void *cls,
566 const void *data,
567 size_t data_len,
568 void *param_values[],
569 int param_lengths[],
570 int param_formats[],
571 unsigned int param_length,
572 void *scratch[],
573 unsigned int scratch_length)
574{
575 const struct GNUNET_TIME_Relative *u = data;
576 struct GNUNET_TIME_Relative rel;
577 uint64_t *u_nbo;
578
579 GNUNET_break (NULL == cls);
580 if (1 != param_length)
581 return -1;
582 rel = *u;
583 if (rel.rel_value_us > INT64_MAX)
584 rel.rel_value_us = INT64_MAX;
585 u_nbo = GNUNET_new (uint64_t);
586 scratch[0] = u_nbo;
587 *u_nbo = GNUNET_htonll (rel.rel_value_us);
588 param_values[0] = (void *) u_nbo;
589 param_lengths[0] = sizeof(uint64_t);
590 param_formats[0] = 1;
591 return 1;
592}
593
594
597{
598 struct GNUNET_PQ_QueryParam res = {
599 .conv = &qconv_rel_time,
600 .data = x,
601 .size = sizeof(*x),
602 .num_params = 1
603 };
604
605 return res;
606}
607
608
623static int
624qconv_abs_time (void *cls,
625 const void *data,
626 size_t data_len,
627 void *param_values[],
628 int param_lengths[],
629 int param_formats[],
630 unsigned int param_length,
631 void *scratch[],
632 unsigned int scratch_length)
633{
634 const struct GNUNET_TIME_Absolute *u = data;
635 struct GNUNET_TIME_Absolute abs;
636 uint64_t *u_nbo;
637
638 GNUNET_break (NULL == cls);
639 if (1 != param_length)
640 return -1;
641 abs = *u;
642 if (abs.abs_value_us > INT64_MAX)
643 abs.abs_value_us = INT64_MAX;
644 u_nbo = GNUNET_new (uint64_t);
645 scratch[0] = u_nbo;
646 *u_nbo = GNUNET_htonll (abs.abs_value_us);
647 param_values[0] = (void *) u_nbo;
648 param_lengths[0] = sizeof(uint64_t);
649 param_formats[0] = 1;
650 return 1;
651}
652
653
656{
657 struct GNUNET_PQ_QueryParam res = {
658 .conv = &qconv_abs_time,
659 .data = x,
660 .size = sizeof(*x),
661 .num_params = 1
662 };
663
664 return res;
665}
666
667
670 const struct GNUNET_TIME_AbsoluteNBO *x)
671{
672 return GNUNET_PQ_query_param_auto_from_type (&x->abs_value_us__);
673}
674
675
678{
679 return GNUNET_PQ_query_param_absolute_time (&x->abs_time);
680}
681
682
685 const struct GNUNET_TIME_TimestampNBO *x)
686{
687 return GNUNET_PQ_query_param_absolute_time_nbo (&x->abs_time_nbo);
688}
689
690
698{
705 const size_t *sizes;
706
711 size_t same_size;
712
719
724
728 Oid oid;
729};
730
735static void
737{
738 GNUNET_free (cls);
739}
740
741
760static int
762 void *cls,
763 const void *data,
764 size_t data_len,
765 void *param_values[],
766 int param_lengths[],
767 int param_formats[],
768 unsigned int param_length,
769 void *scratch[],
770 unsigned int scratch_length)
771{
772 struct qconv_array_cls *meta = cls;
773 size_t num = data_len;
774 size_t total_size;
775 const size_t *sizes;
776 bool same_sized;
777 size_t *string_lengths = NULL;
778 void *elements = NULL;
779 bool noerror = true;
780
781 (void) (param_length);
782 (void) (scratch_length);
783
784 GNUNET_assert (NULL != meta);
785 GNUNET_assert (num < INT_MAX);
786
787 sizes = meta->sizes;
788 same_sized = (0 != meta->same_size);
789
790#define RETURN_UNLESS(cond) \
791 do { \
792 if (! (cond)) \
793 { \
794 GNUNET_break ((cond)); \
795 noerror = false; \
796 goto DONE; \
797 } \
798 } while (0)
799
800 /* Calculate sizes and check bounds */
801 {
802 /* num * length-field */
803 size_t x = sizeof(uint32_t);
804 size_t y = x * num;
805 RETURN_UNLESS ((0 == num) || (y / num == x));
806
807 /* size of header */
808 total_size = x = sizeof(struct pq_array_header);
809 total_size += y;
810 RETURN_UNLESS (total_size >= x);
811
812 /* sizes of elements */
813 if (same_sized)
814 {
815 x = num * meta->same_size;
816 RETURN_UNLESS ((0 == num) || (x / num == meta->same_size));
817
818 y = total_size;
819 total_size += x;
820 RETURN_UNLESS (total_size >= y);
821 }
822 else /* sizes are different per element */
823 {
824 /* for an array of strings we need to get their length's first */
825 if (array_of_string == meta->typ)
826 {
827 string_lengths = GNUNET_new_array (num, size_t);
828
829 if (meta->continuous)
830 {
831 const char *ptr = data;
832 for (unsigned int i = 0; i < num; i++)
833 {
834 size_t len = strlen (ptr);
835 string_lengths[i] = len;
836 ptr += len + 1;
837 }
838 }
839 else
840 {
841 const char **str = (const char **) data;
842 for (unsigned int i = 0; i < num; i++)
843 string_lengths[i] = strlen (str[i]);
844 }
845
846 sizes = string_lengths;
847 }
848
849 for (unsigned int i = 0; i < num; i++)
850 {
851 x = total_size;
852 total_size += sizes[i];
853 RETURN_UNLESS (total_size >= x);
854 }
855 }
856
857 RETURN_UNLESS (total_size < INT_MAX);
858
859 elements = GNUNET_malloc (total_size);
860 }
861
862 /* Write data */
863 {
864 char *in = (char *) data;
865 char *out = elements;
866 size_t nullbyte = (array_of_string == meta->typ) ? 1 : 0;
867 struct pq_array_header h = {
868 .ndim = htonl (1), /* We only support one-dimensional arrays */
869 .has_null = htonl (0), /* We do not support NULL entries in arrays */
870 .lbound = htonl (1), /* Default start index value */
871 .dim = htonl (num),
872 .oid = htonl (meta->oid),
873 };
874
875 /* Write header */
876 GNUNET_memcpy (out, &h, sizeof(h));
877 out += sizeof(h);
878
879
880 /* Write elements */
881 for (unsigned int i = 0; i < num; i++)
882 {
883 size_t sz = same_sized ? meta->same_size : sizes[i];
884 uint32_t hsz = htonl (sz);
885
886 GNUNET_memcpy (out,
887 &hsz,
888 sizeof(hsz));
889 out += sizeof(uint32_t);
890
891 switch (meta->typ)
892 {
893 case array_of_bool:
894 {
895 GNUNET_assert (sizeof(bool) == sz);
896 *(bool *) out = (*(bool *) in);
897 in += sz;
898 break;
899 }
900 case array_of_uint16:
901 {
902 GNUNET_assert (sizeof(uint16_t) == sz);
903 *(uint16_t *) out = htons (*(uint16_t *) in);
904 in += sz;
905 break;
906 }
907 case array_of_uint32:
908 {
909 uint32_t v;
910 GNUNET_assert (sizeof(uint32_t) == sz);
911
912 v = htonl (*(uint32_t *) in);
913 GNUNET_memcpy (out,
914 &v,
915 sizeof(v));
916 in += sz;
917 break;
918 }
919 case array_of_uint64:
920 {
921 uint64_t tmp;
922 GNUNET_assert (sizeof(uint64_t) == sz);
923
924 tmp = GNUNET_htonll (*(uint64_t *) in);
925 GNUNET_memcpy (out,
926 &tmp,
927 sizeof(tmp));
928 in += sz;
929 break;
930 }
931 case array_of_byte:
932 case array_of_string:
933 {
934 const void *ptr;
935
936 if (meta->continuous)
937 {
938 ptr = in;
939 in += sz + nullbyte;
940 }
941 else
942 ptr = ((const void **) data)[i];
943
944 GNUNET_memcpy (out,
945 ptr,
946 sz);
947 break;
948 }
952 {
953 uint64_t val;
954
955 switch (meta->typ)
956 {
958 {
959 const struct GNUNET_TIME_Absolute *abs =
960 (const struct GNUNET_TIME_Absolute *) in;
961
962 GNUNET_assert (sizeof(struct GNUNET_TIME_Absolute) == sz);
963
964 if (! meta->continuous)
965 abs = ((const struct GNUNET_TIME_Absolute **) data)[i];
966
967 val = abs->abs_value_us;
968 break;
969 }
971 {
972 const struct GNUNET_TIME_Relative *rel =
973 (const struct GNUNET_TIME_Relative *) in;
974
975 GNUNET_assert (sizeof(struct GNUNET_TIME_Relative) == sz);
976
977 if (! meta->continuous)
978 rel = ((const struct GNUNET_TIME_Relative **) data)[i];
979
980 val = rel->rel_value_us;
981 break;
982 }
984 {
985 const struct GNUNET_TIME_Timestamp *ts =
986 (const struct GNUNET_TIME_Timestamp *) in;
987
988 GNUNET_assert (sizeof(struct GNUNET_TIME_Timestamp) == sz);
989
990 if (! meta->continuous)
991 ts = ((const struct GNUNET_TIME_Timestamp **) data)[i];
992
993 val = ts->abs_time.abs_value_us;
994 break;
995 }
996 default:
997 {
998 GNUNET_assert (0);
999 }
1000 }
1001
1002 if (val > INT64_MAX)
1003 val = INT64_MAX;
1004
1005 val = GNUNET_htonll (val);
1006 GNUNET_memcpy (out,
1007 &val,
1008 sizeof(val));
1009
1010 if (meta->continuous)
1011 in += sz;
1012
1013 break;
1014 }
1015 default:
1016 {
1017 GNUNET_assert (0);
1018 break;
1019 }
1020 }
1021 out += sz;
1022 }
1023 }
1024
1025 param_values[0] = elements;
1026 param_lengths[0] = total_size;
1027 param_formats[0] = 1;
1028 scratch[0] = elements;
1029
1030DONE:
1031 GNUNET_free (string_lengths);
1032
1033 if (noerror)
1034 return 1;
1035
1036 return -1;
1037}
1038
1039
1052static struct GNUNET_PQ_QueryParam
1054 unsigned int num,
1055 bool continuous,
1056 const void *elements,
1057 const size_t *sizes,
1058 size_t same_size,
1059 enum array_types typ,
1060 Oid oid)
1061{
1063
1064 meta->typ = typ;
1065 meta->oid = oid;
1066 meta->sizes = sizes;
1067 meta->same_size = same_size;
1068 meta->continuous = continuous;
1069
1070 {
1071 struct GNUNET_PQ_QueryParam res = {
1072 .conv = qconv_array,
1073 .conv_cls = meta,
1074 .conv_cls_cleanup = &qconv_array_cls_cleanup,
1075 .data = elements,
1076 .size = num,
1077 .num_params = 1,
1078 };
1079
1080 return res;
1081 }
1082}
1083
1084
1087 unsigned int num,
1088 const bool *elements,
1089 struct GNUNET_PQ_Context *db)
1090{
1091 Oid oid;
1092
1095 "bool",
1096 &oid));
1098 true,
1099 elements,
1100 NULL,
1101 sizeof(bool),
1103 oid);
1104}
1105
1106
1109 unsigned int num,
1110 const uint16_t *elements,
1111 struct GNUNET_PQ_Context *db)
1112{
1113 Oid oid;
1114
1117 "int2",
1118 &oid));
1120 true,
1121 elements,
1122 NULL,
1123 sizeof(uint16_t),
1125 oid);
1126}
1127
1128
1131 unsigned int num,
1132 const uint32_t *elements,
1133 struct GNUNET_PQ_Context *db)
1134{
1135 Oid oid;
1136
1139 "int4",
1140 &oid));
1142 true,
1143 elements,
1144 NULL,
1145 sizeof(uint32_t),
1147 oid);
1148}
1149
1150
1153 unsigned int num,
1154 const uint64_t *elements,
1155 struct GNUNET_PQ_Context *db)
1156{
1157 Oid oid;
1158
1161 "int8",
1162 &oid));
1164 true,
1165 elements,
1166 NULL,
1167 sizeof(uint64_t),
1169 oid);
1170}
1171
1172
1175 unsigned int num,
1176 const void *elements,
1177 const size_t *sizes,
1178 struct GNUNET_PQ_Context *db)
1179{
1180 Oid oid;
1181
1184 "bytea",
1185 &oid));
1187 true,
1188 elements,
1189 sizes,
1190 0,
1192 oid);
1193}
1194
1195
1198 unsigned int num,
1199 const void *elements[static num],
1200 const size_t *sizes,
1201 struct GNUNET_PQ_Context *db)
1202{
1203 Oid oid;
1204
1207 "bytea",
1208 &oid));
1210 false,
1211 elements,
1212 sizes,
1213 0,
1215 oid);
1216}
1217
1218
1221 unsigned int num,
1222 const void *elements,
1223 size_t same_size,
1224 struct GNUNET_PQ_Context *db)
1225{
1226 Oid oid;
1227
1230 "bytea",
1231 &oid));
1233 true,
1234 elements,
1235 NULL,
1236 same_size,
1238 oid);
1239}
1240
1241
1244 unsigned int num,
1245 const void *elements[static num],
1246 size_t same_size,
1247 struct GNUNET_PQ_Context *db)
1248{
1249 Oid oid;
1250
1253 "bytea",
1254 &oid));
1256 false,
1257 elements,
1258 NULL,
1259 same_size,
1261 oid);
1262}
1263
1264
1267 unsigned int num,
1268 const char *elements,
1269 struct GNUNET_PQ_Context *db)
1270{
1271 Oid oid;
1272
1275 "text",
1276 &oid));
1278 true,
1279 elements,
1280 NULL,
1281 0,
1283 oid);
1284}
1285
1286
1289 unsigned int num,
1290 const char *elements[static num],
1291 struct GNUNET_PQ_Context *db)
1292{
1293 Oid oid;
1294
1297 "text",
1298 &oid));
1300 false,
1301 elements,
1302 NULL,
1303 0,
1305 oid);
1306}
1307
1308
1311 unsigned int num,
1312 const struct GNUNET_TIME_Absolute *elements,
1313 struct GNUNET_PQ_Context *db)
1314{
1315 Oid oid;
1316
1319 "int8",
1320 &oid));
1322 true,
1323 elements,
1324 NULL,
1325 sizeof(struct GNUNET_TIME_Absolute),
1327 oid);
1328}
1329
1330
1333 unsigned int num,
1334 const struct GNUNET_TIME_Absolute *elements[],
1335 struct GNUNET_PQ_Context *db)
1336{
1337 Oid oid;
1338
1341 "int8",
1342 &oid));
1344 false,
1345 elements,
1346 NULL,
1347 sizeof(struct GNUNET_TIME_Absolute),
1349 oid);
1350}
1351
1352
1355 unsigned int num,
1356 const struct GNUNET_TIME_Relative *elements,
1357 struct GNUNET_PQ_Context *db)
1358{
1359 Oid oid;
1360
1363 "int8",
1364 &oid));
1366 true,
1367 elements,
1368 NULL,
1369 sizeof(struct GNUNET_TIME_Relative),
1371 oid);
1372}
1373
1374
1377 unsigned int num,
1378 const struct GNUNET_TIME_Relative *elements[],
1379 struct GNUNET_PQ_Context *db)
1380{
1381 Oid oid;
1382
1385 "int8",
1386 &oid));
1388 false,
1389 elements,
1390 NULL,
1391 sizeof(struct GNUNET_TIME_Relative),
1393 oid);
1394}
1395
1396
1399 unsigned int num,
1400 const struct GNUNET_TIME_Timestamp *elements,
1401 struct GNUNET_PQ_Context *db)
1402{
1403 Oid oid;
1404
1407 "int8",
1408 &oid));
1410 true,
1411 elements,
1412 NULL,
1413 sizeof(struct GNUNET_TIME_Timestamp),
1415 oid);
1416}
1417
1418
1421 unsigned int num,
1422 const struct GNUNET_TIME_Timestamp *elements[],
1423 struct GNUNET_PQ_Context *db)
1424{
1425 Oid oid;
1426
1429 "int8",
1430 &oid));
1432 false,
1433 elements,
1434 NULL,
1435 sizeof(struct GNUNET_TIME_Timestamp),
1437 oid);
1438}
1439
1440
1455static int
1457 const void *data,
1458 size_t data_len,
1459 void *param_values[],
1460 int param_lengths[],
1461 int param_formats[],
1462 unsigned int param_length,
1463 void *scratch[],
1464 unsigned int scratch_length)
1465{
1466 const struct GNUNET_CRYPTO_BlindSignPublicKey *public_key = data;
1467 size_t tlen;
1468 size_t len;
1469 uint32_t be;
1470 char *buf;
1471 void *tbuf;
1472
1473 (void) cls;
1474 (void) data_len;
1475 GNUNET_assert (1 == param_length);
1476 GNUNET_assert (scratch_length > 0);
1477 GNUNET_break (NULL == cls);
1478 be = htonl ((uint32_t) public_key->cipher);
1479 switch (public_key->cipher)
1480 {
1483 public_key->details.rsa_public_key,
1484 &tbuf);
1485 break;
1487 tlen = sizeof (public_key->details.cs_public_key);
1488 break;
1489 default:
1490 GNUNET_assert (0);
1491 }
1492 len = tlen + sizeof (be);
1493 buf = GNUNET_malloc (len);
1494 GNUNET_memcpy (buf,
1495 &be,
1496 sizeof (be));
1497 switch (public_key->cipher)
1498 {
1500 GNUNET_memcpy (&buf[sizeof (be)],
1501 tbuf,
1502 tlen);
1503 GNUNET_free (tbuf);
1504 break;
1506 GNUNET_memcpy (&buf[sizeof (be)],
1507 &public_key->details.cs_public_key,
1508 tlen);
1509 break;
1510 default:
1511 GNUNET_assert (0);
1512 }
1513
1514 scratch[0] = buf;
1515 param_values[0] = (void *) buf;
1516 param_lengths[0] = len;
1517 param_formats[0] = 1;
1518 return 1;
1519}
1520
1521
1530{
1531 struct GNUNET_PQ_QueryParam res = {
1532 .conv = &qconv_blind_sign_pub,
1533 .data = pub,
1534 .num_params = 1
1535 };
1536
1537 return res;
1538}
1539
1540
1555static int
1557 const void *data,
1558 size_t data_len,
1559 void *param_values[],
1560 int param_lengths[],
1561 int param_formats[],
1562 unsigned int param_length,
1563 void *scratch[],
1564 unsigned int scratch_length)
1565{
1566 const struct GNUNET_CRYPTO_BlindSignPrivateKey *private_key = data;
1567 size_t tlen;
1568 size_t len;
1569 uint32_t be;
1570 char *buf;
1571 void *tbuf;
1572
1573 (void) cls;
1574 (void) data_len;
1575 GNUNET_assert (1 == param_length);
1576 GNUNET_assert (scratch_length > 0);
1577 GNUNET_break (NULL == cls);
1578 be = htonl ((uint32_t) private_key->cipher);
1579 switch (private_key->cipher)
1580 {
1583 private_key->details.rsa_private_key,
1584 &tbuf);
1585 break;
1587 tlen = sizeof (private_key->details.cs_private_key);
1588 break;
1589 default:
1590 GNUNET_assert (0);
1591 }
1592 len = tlen + sizeof (be);
1593 buf = GNUNET_malloc (len);
1594 GNUNET_memcpy (buf,
1595 &be,
1596 sizeof (be));
1597 switch (private_key->cipher)
1598 {
1600 GNUNET_memcpy (&buf[sizeof (be)],
1601 tbuf,
1602 tlen);
1603 GNUNET_free (tbuf);
1604 break;
1606 GNUNET_memcpy (&buf[sizeof (be)],
1607 &private_key->details.cs_private_key,
1608 tlen);
1609 break;
1610 default:
1611 GNUNET_assert (0);
1612 }
1613
1614 scratch[0] = buf;
1615 param_values[0] = (void *) buf;
1616 param_lengths[0] = len;
1617 param_formats[0] = 1;
1618 return 1;
1619}
1620
1621
1629 const struct GNUNET_CRYPTO_BlindSignPrivateKey *priv)
1630{
1631 struct GNUNET_PQ_QueryParam res = {
1632 .conv = &qconv_blind_sign_priv,
1633 .data = priv,
1634 .num_params = 1
1635 };
1636
1637 return res;
1638}
1639
1640
1655static int
1657 const void *data,
1658 size_t data_len,
1659 void *param_values[],
1660 int param_lengths[],
1661 int param_formats[],
1662 unsigned int param_length,
1663 void *scratch[],
1664 unsigned int scratch_length)
1665{
1666 const struct GNUNET_CRYPTO_UnblindedSignature *ubs = data;
1667 size_t tlen;
1668 size_t len;
1669 uint32_t be[2];
1670 char *buf;
1671 void *tbuf;
1672
1673 (void) cls;
1674 (void) data_len;
1675 GNUNET_assert (1 == param_length);
1676 GNUNET_assert (scratch_length > 0);
1677 GNUNET_break (NULL == cls);
1678 be[0] = htonl ((uint32_t) ubs->cipher);
1679 be[1] = htonl (0x00); /* magic marker: unblinded */
1680 switch (ubs->cipher)
1681 {
1685 &tbuf);
1686 break;
1688 tlen = sizeof (ubs->details.cs_signature);
1689 break;
1690 default:
1691 GNUNET_assert (0);
1692 }
1693 len = tlen + sizeof (be);
1694 buf = GNUNET_malloc (len);
1695 GNUNET_memcpy (buf,
1696 &be,
1697 sizeof (be));
1698 switch (ubs->cipher)
1699 {
1701 GNUNET_memcpy (&buf[sizeof (be)],
1702 tbuf,
1703 tlen);
1704 GNUNET_free (tbuf);
1705 break;
1707 GNUNET_memcpy (&buf[sizeof (be)],
1708 &ubs->details.cs_signature,
1709 tlen);
1710 break;
1711 default:
1712 GNUNET_assert (0);
1713 }
1714
1715 scratch[0] = buf;
1716 param_values[0] = (void *) buf;
1717 param_lengths[0] = len;
1718 param_formats[0] = 1;
1719 return 1;
1720}
1721
1722
1730 const struct GNUNET_CRYPTO_UnblindedSignature *sig)
1731{
1732 struct GNUNET_PQ_QueryParam res = {
1733 .conv = &qconv_unblinded_sig,
1734 .data = sig,
1735 .num_params = 1
1736 };
1737
1738 return res;
1739}
1740
1741
1756static int
1758 const void *data,
1759 size_t data_len,
1760 void *param_values[],
1761 int param_lengths[],
1762 int param_formats[],
1763 unsigned int param_length,
1764 void *scratch[],
1765 unsigned int scratch_length)
1766{
1767 const struct GNUNET_CRYPTO_BlindedSignature *bs = data;
1768 size_t tlen;
1769 size_t len;
1770 uint32_t be[2];
1771 char *buf;
1772 void *tbuf;
1773
1774 (void) cls;
1775 (void) data_len;
1776 GNUNET_assert (1 == param_length);
1777 GNUNET_assert (scratch_length > 0);
1778 GNUNET_break (NULL == cls);
1779 be[0] = htonl ((uint32_t) bs->cipher);
1780 be[1] = htonl (0x01); /* magic marker: blinded */
1781 switch (bs->cipher)
1782 {
1786 &tbuf);
1787 break;
1789 tlen = sizeof (bs->details.blinded_cs_answer);
1790 break;
1791 default:
1792 GNUNET_assert (0);
1793 }
1794 len = tlen + sizeof (be);
1795 buf = GNUNET_malloc (len);
1796 GNUNET_memcpy (buf,
1797 &be,
1798 sizeof (be));
1799 switch (bs->cipher)
1800 {
1802 GNUNET_memcpy (&buf[sizeof (be)],
1803 tbuf,
1804 tlen);
1805 GNUNET_free (tbuf);
1806 break;
1808 GNUNET_memcpy (&buf[sizeof (be)],
1810 tlen);
1811 break;
1812 default:
1813 GNUNET_assert (0);
1814 }
1815
1816 scratch[0] = buf;
1817 param_values[0] = (void *) buf;
1818 param_lengths[0] = len;
1819 param_formats[0] = 1;
1820 return 1;
1821}
1822
1823
1831 const struct GNUNET_CRYPTO_BlindedSignature *b_sig)
1832{
1833 struct GNUNET_PQ_QueryParam res = {
1834 .conv = &qconv_blinded_sig,
1835 .data = b_sig,
1836 .num_params = 1
1837 };
1838
1839 return res;
1840}
1841
1842
1843/* 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_htobe16(x)
#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:148
@ array_of_byte
Definition: pq.h:153
@ array_of_uint32
Definition: pq.h:151
@ array_of_string
Definition: pq.h:154
@ array_of_rel_time
Definition: pq.h:156
@ array_of_uint16
Definition: pq.h:150
@ array_of_uint64
Definition: pq.h:152
@ array_of_abs_time
Definition: pq.h:155
@ array_of_timestamp
Definition: pq.h:157
@ array_of_bool
Definition: pq.h:149
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_int16(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.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_int16(const int16_t *x)
Generate query parameter for an int16_t in host byte order.
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:128
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:167
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...