diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-03-21 14:45:09 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-03-21 14:45:09 +0000 |
commit | 4616bf9d016bcfb319954e52b5d24fc93c3cf1b2 (patch) | |
tree | 985713a4c9ccb003771f04da808fed7d3a74fe93 /src/include | |
parent | 75c121f5ae37d3c7ccd95f4449aea33ccb4200f0 (diff) | |
download | gnunet-4616bf9d016bcfb319954e52b5d24fc93c3cf1b2.tar.gz gnunet-4616bf9d016bcfb319954e52b5d24fc93c3cf1b2.zip |
-idea for improved allocator
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_common.h | 9 | ||||
-rw-r--r-- | src/include/gnunet_pseudonym_lib.h | 17 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 470069419..29a5f7cfb 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -669,6 +669,15 @@ GNUNET_ntoh_double (double d); | |||
669 | #define GNUNET_MAX_MALLOC_CHECKED (1024 * 1024 * 40) | 669 | #define GNUNET_MAX_MALLOC_CHECKED (1024 * 1024 * 40) |
670 | 670 | ||
671 | /** | 671 | /** |
672 | * Allocate a struct or union of the given 'type'. | ||
673 | * Wrapper around GNUNET_malloc that returns a pointer | ||
674 | * to the newly created object of the correct type. | ||
675 | * | ||
676 | * @param type name of the struct or union, i.e. pass 'struct Foo'. | ||
677 | */ | ||
678 | #define GNUNET_new(type) (type *) GNUNET_malloc (sizeof (type)) | ||
679 | |||
680 | /** | ||
672 | * Wrapper around malloc. Allocates size bytes of memory. | 681 | * Wrapper around malloc. Allocates size bytes of memory. |
673 | * The memory will be zero'ed out. | 682 | * The memory will be zero'ed out. |
674 | * | 683 | * |
diff --git a/src/include/gnunet_pseudonym_lib.h b/src/include/gnunet_pseudonym_lib.h index 0b71cc1af..e0b36887b 100644 --- a/src/include/gnunet_pseudonym_lib.h +++ b/src/include/gnunet_pseudonym_lib.h | |||
@@ -47,15 +47,16 @@ extern "C" | |||
47 | struct GNUNET_PseudonymIdentifier | 47 | struct GNUNET_PseudonymIdentifier |
48 | { | 48 | { |
49 | /** | 49 | /** |
50 | * Q consists of an x- and a y-value, each mod p (256 bits); | 50 | * Q consists of an x- and a y-value, each mod p (256 bits), |
51 | * however, (to speed up calculations and/or represent infinity) | 51 | * given here in affine coordinates. |
52 | * libgcrypt uses projective coordinates, which add an extra | ||
53 | * dimension. Thus, the MPI value is typically one additional byte | ||
54 | * longer (512 bit + 8 bits). As we want a size that is a | ||
55 | * multiplicative of 8, we add 8 bytes (not 8 bits), which should | ||
56 | * always suffice to represent Q. | ||
57 | */ | 52 | */ |
58 | unsigned char q[(256 + 256 / 8) + 8]; | 53 | unsigned char q_x[256 / 8]; |
54 | |||
55 | /** | ||
56 | * Q consists of an x- and a y-value, each mod p (256 bits), | ||
57 | * given here in affine coordinates. | ||
58 | */ | ||
59 | unsigned char q_y[256 / 8]; | ||
59 | 60 | ||
60 | }; | 61 | }; |
61 | 62 | ||