aboutsummaryrefslogtreecommitdiff
path: root/src/gnsrecord/gnsrecord_crypto.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-16 20:21:27 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-16 20:21:27 +0000
commitaccfd6bd85274da2f19e7230c8da6b273cfb2ece (patch)
tree60966194963795ff07b4da94f4efb6c46d6a23cf /src/gnsrecord/gnsrecord_crypto.c
parent3d670727232e79b7e49a1df7ba9260db4e5798a0 (diff)
downloadgnunet-accfd6bd85274da2f19e7230c8da6b273cfb2ece.tar.gz
gnunet-accfd6bd85274da2f19e7230c8da6b273cfb2ece.zip
-another renaming fest for GNUNET_NAMESTORE_ to GNUNET_GNSRECORD_ symbols that were moved
Diffstat (limited to 'src/gnsrecord/gnsrecord_crypto.c')
-rw-r--r--src/gnsrecord/gnsrecord_crypto.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c
index 823ffcae3..99a97dcdd 100644
--- a/src/gnsrecord/gnsrecord_crypto.c
+++ b/src/gnsrecord/gnsrecord_crypto.c
@@ -78,30 +78,30 @@ derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
78 * @param rd_count number of records 78 * @param rd_count number of records
79 * @return NULL on error (block too large) 79 * @return NULL on error (block too large)
80 */ 80 */
81struct GNUNET_NAMESTORE_Block * 81struct GNUNET_GNSRECORD_Block *
82GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 82GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
83 struct GNUNET_TIME_Absolute expire, 83 struct GNUNET_TIME_Absolute expire,
84 const char *label, 84 const char *label,
85 const struct GNUNET_NAMESTORE_RecordData *rd, 85 const struct GNUNET_GNSRECORD_Data *rd,
86 unsigned int rd_count) 86 unsigned int rd_count)
87{ 87{
88 size_t payload_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); 88 size_t payload_len = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
89 char payload[sizeof (uint32_t) + payload_len]; 89 char payload[sizeof (uint32_t) + payload_len];
90 struct GNUNET_NAMESTORE_Block *block; 90 struct GNUNET_GNSRECORD_Block *block;
91 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 91 struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
92 struct GNUNET_CRYPTO_EcdsaPrivateKey *dkey; 92 struct GNUNET_CRYPTO_EcdsaPrivateKey *dkey;
93 struct GNUNET_CRYPTO_SymmetricInitializationVector iv; 93 struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
94 struct GNUNET_CRYPTO_SymmetricSessionKey skey; 94 struct GNUNET_CRYPTO_SymmetricSessionKey skey;
95 uint32_t rd_count_nbo; 95 uint32_t rd_count_nbo;
96 96
97 if (payload_len > GNUNET_NAMESTORE_MAX_VALUE_SIZE) 97 if (payload_len > GNUNET_GNSRECORD_MAX_BLOCK_SIZE)
98 return NULL; 98 return NULL;
99 rd_count_nbo = htonl (rd_count); 99 rd_count_nbo = htonl (rd_count);
100 memcpy (payload, &rd_count_nbo, sizeof (uint32_t)); 100 memcpy (payload, &rd_count_nbo, sizeof (uint32_t));
101 GNUNET_assert (payload_len == 101 GNUNET_assert (payload_len ==
102 GNUNET_NAMESTORE_records_serialize (rd_count, rd, 102 GNUNET_GNSRECORD_records_serialize (rd_count, rd,
103 payload_len, &payload[sizeof (uint32_t)])); 103 payload_len, &payload[sizeof (uint32_t)]));
104 block = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_Block) + 104 block = GNUNET_malloc (sizeof (struct GNUNET_GNSRECORD_Block) +
105 sizeof (uint32_t) + payload_len); 105 sizeof (uint32_t) + payload_len);
106 block->purpose.size = htonl (sizeof (uint32_t) + payload_len + 106 block->purpose.size = htonl (sizeof (uint32_t) + payload_len +
107 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + 107 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
@@ -143,7 +143,7 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
143 * @return #GNUNET_OK if the signature is valid 143 * @return #GNUNET_OK if the signature is valid
144 */ 144 */
145int 145int
146GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) 146GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block)
147{ 147{
148 return GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, 148 return GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN,
149 &block->purpose, 149 &block->purpose,
@@ -164,10 +164,10 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block)
164 * not well-formed 164 * not well-formed
165 */ 165 */
166int 166int
167GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, 167GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
168 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, 168 const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key,
169 const char *label, 169 const char *label,
170 GNUNET_NAMESTORE_RecordCallback proc, 170 GNUNET_GNSRECORD_RecordCallback proc,
171 void *proc_cls) 171 void *proc_cls)
172{ 172{
173 size_t payload_len = ntohl (block->purpose.size) - 173 size_t payload_len = ntohl (block->purpose.size) -
@@ -203,10 +203,10 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
203 return GNUNET_SYSERR; 203 return GNUNET_SYSERR;
204 } 204 }
205 { 205 {
206 struct GNUNET_NAMESTORE_RecordData rd[rd_count]; 206 struct GNUNET_GNSRECORD_Data rd[rd_count];
207 207
208 if (GNUNET_OK != 208 if (GNUNET_OK !=
209 GNUNET_NAMESTORE_records_deserialize (payload_len - sizeof (uint32_t), 209 GNUNET_GNSRECORD_records_deserialize (payload_len - sizeof (uint32_t),
210 &payload[sizeof (uint32_t)], 210 &payload[sizeof (uint32_t)],
211 rd_count, 211 rd_count,
212 rd)) 212 rd))
@@ -230,14 +230,14 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
230 * @param query hash to use for the query 230 * @param query hash to use for the query
231 */ 231 */
232void 232void
233GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 233GNUNET_GNSRECORD_query_from_private_key (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
234 const char *label, 234 const char *label,
235 struct GNUNET_HashCode *query) 235 struct GNUNET_HashCode *query)
236{ 236{
237 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 237 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
238 238
239 GNUNET_CRYPTO_ecdsa_key_get_public (zone, &pub); 239 GNUNET_CRYPTO_ecdsa_key_get_public (zone, &pub);
240 GNUNET_NAMESTORE_query_from_public_key (&pub, label, query); 240 GNUNET_GNSRECORD_query_from_public_key (&pub, label, query);
241} 241}
242 242
243 243
@@ -249,7 +249,7 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EcdsaPrivate
249 * @param query hash to use for the query 249 * @param query hash to use for the query
250 */ 250 */
251void 251void
252GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, 252GNUNET_GNSRECORD_query_from_public_key (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
253 const char *label, 253 const char *label,
254 struct GNUNET_HashCode *query) 254 struct GNUNET_HashCode *query)
255{ 255{