diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-01 16:31:20 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-01 16:31:20 +0000 |
commit | c8ee017f28ce9c5f59bdae20bd2f9c0a6c4146a7 (patch) | |
tree | 485efac43580ff0ee16164697561b11cac5a1531 /src/namestore/test_namestore_api_lookup.c | |
parent | 9121b5fdbb38b5ee48695edf5c45bfca1eeb0a29 (diff) | |
download | gnunet-c8ee017f28ce9c5f59bdae20bd2f9c0a6c4146a7.tar.gz gnunet-c8ee017f28ce9c5f59bdae20bd2f9c0a6c4146a7.zip |
- change signing func
Diffstat (limited to 'src/namestore/test_namestore_api_lookup.c')
-rw-r--r-- | src/namestore/test_namestore_api_lookup.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/namestore/test_namestore_api_lookup.c b/src/namestore/test_namestore_api_lookup.c index b3328123a..f6e86ac8f 100644 --- a/src/namestore/test_namestore_api_lookup.c +++ b/src/namestore/test_namestore_api_lookup.c | |||
@@ -43,7 +43,7 @@ static struct GNUNET_OS_Process *arm; | |||
43 | 43 | ||
44 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | 44 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; |
45 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 45 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
46 | struct GNUNET_CRYPTO_RsaSignature s_signature; | 46 | struct GNUNET_CRYPTO_RsaSignature *s_signature; |
47 | static GNUNET_HashCode s_zone; | 47 | static GNUNET_HashCode s_zone; |
48 | struct GNUNET_NAMESTORE_RecordData *s_rd; | 48 | struct GNUNET_NAMESTORE_RecordData *s_rd; |
49 | static char *s_name; | 49 | static char *s_name; |
@@ -250,13 +250,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
250 | GNUNET_NAMESTORE_records_serialize(RECORDS, s_rd, rd_ser_len, rd_ser); | 250 | GNUNET_NAMESTORE_records_serialize(RECORDS, s_rd, rd_ser_len, rd_ser); |
251 | 251 | ||
252 | /* sign */ | 252 | /* sign */ |
253 | struct GNUNET_CRYPTO_RsaSignaturePurpose *sig_purpose = GNUNET_malloc(sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) + rd_ser_len); | 253 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_name, s_rd, RECORDS); |
254 | sig_purpose->size = htonl (sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose)+ rd_ser_len); | ||
255 | sig_purpose->purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); | ||
256 | memcpy (&sig_purpose[1], rd_ser, rd_ser_len); | ||
257 | GNUNET_CRYPTO_rsa_sign (privkey, sig_purpose, &s_signature); | ||
258 | |||
259 | GNUNET_free (sig_purpose); | ||
260 | 254 | ||
261 | /* create random zone hash */ | 255 | /* create random zone hash */ |
262 | GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); | 256 | GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); |
@@ -267,14 +261,14 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
267 | nsh = GNUNET_NAMESTORE_connect (cfg); | 261 | nsh = GNUNET_NAMESTORE_connect (cfg); |
268 | GNUNET_break (NULL != nsh); | 262 | GNUNET_break (NULL != nsh); |
269 | 263 | ||
270 | |||
271 | |||
272 | GNUNET_break (s_rd != NULL); | 264 | GNUNET_break (s_rd != NULL); |
273 | GNUNET_break (s_name != NULL); | 265 | GNUNET_break (s_name != NULL); |
274 | 266 | ||
275 | GNUNET_NAMESTORE_record_put (nsh, &pubkey, s_name, | 267 | GNUNET_NAMESTORE_record_put (nsh, &pubkey, s_name, |
276 | GNUNET_TIME_absolute_get_forever(), | 268 | GNUNET_TIME_absolute_get_forever(), |
277 | RECORDS, s_rd, &s_signature, put_cont, s_name); | 269 | RECORDS, s_rd, s_signature, put_cont, s_name); |
270 | |||
271 | GNUNET_free (s_signature); | ||
278 | 272 | ||
279 | } | 273 | } |
280 | 274 | ||