diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-05-29 08:18:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-05-29 08:18:55 +0000 |
commit | 022002438e4047d235a688cfd9da7b63ab990103 (patch) | |
tree | 8d0cb444a3ab376b5a8f614fb87bdeb31e7b3327 /src/namestore/test_namestore_api_zone_to_name.c | |
parent | b62eb443ee3af84f87030fad9fd11a948b1a2503 (diff) | |
download | gnunet-022002438e4047d235a688cfd9da7b63ab990103.tar.gz gnunet-022002438e4047d235a688cfd9da7b63ab990103.zip |
-switching GNS from RSA to ECC
Diffstat (limited to 'src/namestore/test_namestore_api_zone_to_name.c')
-rw-r--r-- | src/namestore/test_namestore_api_zone_to_name.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index 85620719d..2734ebae8 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c | |||
@@ -43,9 +43,9 @@ static struct GNUNET_NAMESTORE_Handle * nsh; | |||
43 | 43 | ||
44 | static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; | 44 | static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; |
45 | 45 | ||
46 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | 46 | static struct GNUNET_CRYPTO_EccPrivateKey * privkey; |
47 | 47 | ||
48 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 48 | static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey; |
49 | 49 | ||
50 | static struct GNUNET_TIME_Absolute expire; | 50 | static struct GNUNET_TIME_Absolute expire; |
51 | 51 | ||
@@ -55,7 +55,7 @@ static struct GNUNET_CRYPTO_ShortHashCode s_zone_value; | |||
55 | 55 | ||
56 | static char * s_name; | 56 | static char * s_name; |
57 | 57 | ||
58 | static struct GNUNET_CRYPTO_RsaSignature *s_signature; | 58 | static struct GNUNET_CRYPTO_EccSignature *s_signature; |
59 | 59 | ||
60 | static int res; | 60 | static int res; |
61 | 61 | ||
@@ -73,7 +73,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
73 | GNUNET_NAMESTORE_disconnect (nsh); | 73 | GNUNET_NAMESTORE_disconnect (nsh); |
74 | nsh = NULL; | 74 | nsh = NULL; |
75 | if (privkey != NULL) | 75 | if (privkey != NULL) |
76 | GNUNET_CRYPTO_rsa_key_free (privkey); | 76 | GNUNET_CRYPTO_ecc_key_free (privkey); |
77 | privkey = NULL; | 77 | privkey = NULL; |
78 | res = 1; | 78 | res = 1; |
79 | } | 79 | } |
@@ -88,7 +88,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
88 | endbadly_task = GNUNET_SCHEDULER_NO_TASK; | 88 | endbadly_task = GNUNET_SCHEDULER_NO_TASK; |
89 | } | 89 | } |
90 | if (privkey != NULL) | 90 | if (privkey != NULL) |
91 | GNUNET_CRYPTO_rsa_key_free (privkey); | 91 | GNUNET_CRYPTO_ecc_key_free (privkey); |
92 | privkey = NULL; | 92 | privkey = NULL; |
93 | if (nsh != NULL) | 93 | if (nsh != NULL) |
94 | GNUNET_NAMESTORE_disconnect (nsh); | 94 | GNUNET_NAMESTORE_disconnect (nsh); |
@@ -98,12 +98,12 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
98 | 98 | ||
99 | static void | 99 | static void |
100 | zone_to_name_proc (void *cls, | 100 | zone_to_name_proc (void *cls, |
101 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 101 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
102 | struct GNUNET_TIME_Absolute expire, | 102 | struct GNUNET_TIME_Absolute expire, |
103 | const char *n, | 103 | const char *n, |
104 | unsigned int rd_count, | 104 | unsigned int rd_count, |
105 | const struct GNUNET_NAMESTORE_RecordData *rd, | 105 | const struct GNUNET_NAMESTORE_RecordData *rd, |
106 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 106 | const struct GNUNET_CRYPTO_EccSignature *signature) |
107 | { | 107 | { |
108 | int fail = GNUNET_NO; | 108 | int fail = GNUNET_NO; |
109 | 109 | ||
@@ -125,7 +125,7 @@ zone_to_name_proc (void *cls, | |||
125 | fail = GNUNET_YES; | 125 | fail = GNUNET_YES; |
126 | GNUNET_break (0); | 126 | GNUNET_break (0); |
127 | } | 127 | } |
128 | if ((zone_key == NULL) || (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)))) | 128 | if ((zone_key == NULL) || (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded)))) |
129 | { | 129 | { |
130 | fail = GNUNET_YES; | 130 | fail = GNUNET_YES; |
131 | GNUNET_break (0); | 131 | GNUNET_break (0); |
@@ -175,14 +175,14 @@ run (void *cls, | |||
175 | GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, | 175 | GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, |
176 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); | 176 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); |
177 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); | 177 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); |
178 | privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file); | 178 | privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); |
179 | GNUNET_free (hostkey_file); | 179 | GNUNET_free (hostkey_file); |
180 | GNUNET_assert (privkey != NULL); | 180 | GNUNET_assert (privkey != NULL); |
181 | /* get public key */ | 181 | /* get public key */ |
182 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); | 182 | GNUNET_CRYPTO_ecc_key_get_public(privkey, &pubkey); |
183 | 183 | ||
184 | /* zone hash */ | 184 | /* zone hash */ |
185 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); | 185 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), &s_zone); |
186 | GNUNET_CRYPTO_short_hash (s_name, strlen (s_name) + 1, &s_zone_value); | 186 | GNUNET_CRYPTO_short_hash (s_name, strlen (s_name) + 1, &s_zone_value); |
187 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using PKEY `%s' \n", GNUNET_short_h2s (&s_zone_value)); | 187 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using PKEY `%s' \n", GNUNET_short_h2s (&s_zone_value)); |
188 | 188 | ||