From 1733de7305720882b8745e82b51b6ff47c10099e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 21 Mar 2016 13:41:12 +0000 Subject: fixing symbol naming and coding convention issues --- src/include/gnunet_crypto_lib.h | 74 +++++++-------- src/include/gnunet_json_lib.h | 8 +- src/include/gnunet_pq_lib.h | 8 +- src/json/json_generator.c | 4 +- src/json/json_helper.c | 12 +-- src/json/test_json.c | 10 +- src/pq/pq_query_helper.c | 8 +- src/pq/pq_result_helper.c | 12 +-- src/pq/test_pq.c | 10 +- src/util/crypto_rsa.c | 198 +++++++++++++++++++++------------------- src/util/perf_crypto_rsa.c | 8 +- src/util/test_crypto_rsa.c | 16 ++-- 12 files changed, 189 insertions(+), 179 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 93ee09cab..d104318e3 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h @@ -1779,12 +1779,12 @@ GNUNET_CRYPTO_paillier_hom_get_remaining (const struct GNUNET_CRYPTO_PaillierCip /** * The private information of an RSA key pair. */ -struct GNUNET_CRYPTO_rsa_PrivateKey; +struct GNUNET_CRYPTO_RsaPrivateKey; /** * The public information of an RSA key pair. */ -struct GNUNET_CRYPTO_rsa_PublicKey; +struct GNUNET_CRYPTO_RsaPublicKey; /** * Key used to blind a message @@ -1794,7 +1794,7 @@ struct GNUNET_CRYPTO_rsa_BlindingKey; /** * @brief an RSA signature */ -struct GNUNET_CRYPTO_rsa_Signature; +struct GNUNET_CRYPTO_RsaSignature; /** @@ -1803,7 +1803,7 @@ struct GNUNET_CRYPTO_rsa_Signature; * @param len length of the key in bits (i.e. 2048) * @return fresh private key */ -struct GNUNET_CRYPTO_rsa_PrivateKey * +struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_create (unsigned int len); @@ -1813,7 +1813,7 @@ GNUNET_CRYPTO_rsa_private_key_create (unsigned int len); * @param key pointer to the memory to free */ void -GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_rsa_PrivateKey *key); +GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key); /** @@ -1825,7 +1825,7 @@ GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_rsa_PrivateKey *key); * @return size of memory allocatedin @a buffer */ size_t -GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, +GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_RsaPrivateKey *key, char **buffer); @@ -1837,7 +1837,7 @@ GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_rsa_PrivateKey * @param len the length of the data in @a buf * @return NULL on error */ -struct GNUNET_CRYPTO_rsa_PrivateKey * +struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, size_t len); @@ -1848,8 +1848,8 @@ GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, * @param key the private key to duplicate * @return the duplicate key; NULL upon error */ -struct GNUNET_CRYPTO_rsa_PrivateKey * -GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_rsa_PrivateKey *key); +struct GNUNET_CRYPTO_RsaPrivateKey * +GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_RsaPrivateKey *key); /** @@ -1858,8 +1858,8 @@ GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_rsa_PrivateKey *ke * @param priv the private key * @retur NULL on error, otherwise the public key */ -struct GNUNET_CRYPTO_rsa_PublicKey * -GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_rsa_PrivateKey *priv); +struct GNUNET_CRYPTO_RsaPublicKey * +GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_RsaPrivateKey *priv); /** @@ -1869,7 +1869,7 @@ GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_rsa_Private * @param hc where to store the hash code */ void -GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_rsa_PublicKey *key, +GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_RsaPublicKey *key, struct GNUNET_HashCode *hc); @@ -1880,7 +1880,7 @@ GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_rsa_PublicKey *key * @return length of the key in bits */ unsigned int -GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_rsa_PublicKey *key); +GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_RsaPublicKey *key); /** @@ -1889,7 +1889,7 @@ GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_rsa_PublicKey *key) * @param key pointer to the memory to free */ void -GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_rsa_PublicKey *key); +GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_RsaPublicKey *key); /** @@ -1901,7 +1901,7 @@ GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_rsa_PublicKey *key); * @return size of memory allocated in @a buffer */ size_t -GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_rsa_PublicKey *key, +GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_RsaPublicKey *key, char **buffer); @@ -1913,7 +1913,7 @@ GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_rsa_PublicKey *k * @param len the length of the data in @a buf * @return NULL on error */ -struct GNUNET_CRYPTO_rsa_PublicKey * +struct GNUNET_CRYPTO_RsaPublicKey * GNUNET_CRYPTO_rsa_public_key_decode (const char *buf, size_t len); @@ -1924,8 +1924,8 @@ GNUNET_CRYPTO_rsa_public_key_decode (const char *buf, * @param key the public key to duplicate * @return the duplicate key; NULL upon error */ -struct GNUNET_CRYPTO_rsa_PublicKey * -GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_rsa_PublicKey *key); +struct GNUNET_CRYPTO_RsaPublicKey * +GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_RsaPublicKey *key); /** @@ -1958,8 +1958,8 @@ GNUNET_CRYPTO_rsa_blinding_key_cmp (struct GNUNET_CRYPTO_rsa_BlindingKey *b1, * @return 0 if the two are equal */ int -GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_rsa_Signature *s1, - struct GNUNET_CRYPTO_rsa_Signature *s2); +GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_RsaSignature *s1, + struct GNUNET_CRYPTO_RsaSignature *s2); /** * Compare the values of two private keys. @@ -1969,8 +1969,8 @@ GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_rsa_Signature *s1, * @return 0 if the two are equal */ int -GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_rsa_PrivateKey *p1, - struct GNUNET_CRYPTO_rsa_PrivateKey *p2); +GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_RsaPrivateKey *p1, + struct GNUNET_CRYPTO_RsaPrivateKey *p2); /** @@ -1981,8 +1981,8 @@ GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_rsa_PrivateKey *p1, * @return 0 if the two are equal */ int -GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_rsa_PublicKey *p1, - struct GNUNET_CRYPTO_rsa_PublicKey *p2); +GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_RsaPublicKey *p1, + struct GNUNET_CRYPTO_RsaPublicKey *p2); /** @@ -2032,7 +2032,7 @@ GNUNET_CRYPTO_rsa_blinding_key_decode (const char *buf, size_t GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, struct GNUNET_CRYPTO_rsa_BlindingKey *bkey, - struct GNUNET_CRYPTO_rsa_PublicKey *pkey, + struct GNUNET_CRYPTO_RsaPublicKey *pkey, char **buffer); @@ -2044,8 +2044,8 @@ GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, * @param msg_len number of bytes in @a msg to sign * @return NULL on error, signature on success */ -struct GNUNET_CRYPTO_rsa_Signature * -GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, +struct GNUNET_CRYPTO_RsaSignature * +GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_RsaPrivateKey *key, const void *msg, size_t msg_len); @@ -2056,7 +2056,7 @@ GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, * @param sig memory to free */ void -GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_rsa_Signature *sig); +GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_RsaSignature *sig); /** @@ -2067,7 +2067,7 @@ GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_rsa_Signature *sig); * @return size of memory allocated in @a buffer */ size_t -GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_rsa_Signature *sig, +GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_RsaSignature *sig, char **buffer); @@ -2079,7 +2079,7 @@ GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_rsa_Signature *si * @param len the length of the data in @a buf * @return NULL on error */ -struct GNUNET_CRYPTO_rsa_Signature * +struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_signature_decode (const char *buf, size_t len); @@ -2090,8 +2090,8 @@ GNUNET_CRYPTO_rsa_signature_decode (const char *buf, * @param sig the signature to duplicate * @return the duplicate key; NULL upon error */ -struct GNUNET_CRYPTO_rsa_Signature * -GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_rsa_Signature *sig); +struct GNUNET_CRYPTO_RsaSignature * +GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_RsaSignature *sig); /** @@ -2104,10 +2104,10 @@ GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_rsa_Signature *sig); * @param pkey the public key of the signer * @return unblinded signature on success, NULL on error */ -struct GNUNET_CRYPTO_rsa_Signature * -GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_rsa_Signature *sig, +struct GNUNET_CRYPTO_RsaSignature * +GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_RsaSignature *sig, struct GNUNET_CRYPTO_rsa_BlindingKey *bkey, - struct GNUNET_CRYPTO_rsa_PublicKey *pkey); + struct GNUNET_CRYPTO_RsaPublicKey *pkey); /** @@ -2121,8 +2121,8 @@ GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_rsa_Signature *sig, */ int GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, - const struct GNUNET_CRYPTO_rsa_Signature *sig, - const struct GNUNET_CRYPTO_rsa_PublicKey *public_key); + const struct GNUNET_CRYPTO_RsaSignature *sig, + const struct GNUNET_CRYPTO_RsaPublicKey *public_key); #if 0 /* keep Emacsens' auto-indent happy */ diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h index a0a4209d2..15e85c411 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h @@ -281,7 +281,7 @@ GNUNET_JSON_spec_relative_time (const char *name, */ struct GNUNET_JSON_Specification GNUNET_JSON_spec_rsa_public_key (const char *name, - struct GNUNET_CRYPTO_rsa_PublicKey **pk); + struct GNUNET_CRYPTO_RsaPublicKey **pk); /** @@ -292,7 +292,7 @@ GNUNET_JSON_spec_rsa_public_key (const char *name, */ struct GNUNET_JSON_Specification GNUNET_JSON_spec_rsa_signature (const char *name, - struct GNUNET_CRYPTO_rsa_Signature **sig); + struct GNUNET_CRYPTO_RsaSignature **sig); /* ****************** Generic generator interface ******************* */ @@ -338,7 +338,7 @@ GNUNET_JSON_from_time_rel (struct GNUNET_TIME_Relative stamp); * @return corresponding JSON encoding */ json_t * -GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey *pk); +GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *pk); /** @@ -348,7 +348,7 @@ GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey *pk); * @return corresponding JSON encoding */ json_t * -GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_rsa_Signature *sig); +GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig); #endif diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h index a7525df7e..39c288f5a 100644 --- a/src/include/gnunet_pq_lib.h +++ b/src/include/gnunet_pq_lib.h @@ -118,7 +118,7 @@ GNUNET_PQ_query_param_fixed_size (const void *ptr, * @param x the query parameter to pass. */ struct GNUNET_PQ_QueryParam -GNUNET_PQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey *x); +GNUNET_PQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *x); /** @@ -128,7 +128,7 @@ GNUNET_PQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey * * @param x the query parameter to pass */ struct GNUNET_PQ_QueryParam -GNUNET_PQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_rsa_Signature *x); +GNUNET_PQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x); /** @@ -330,7 +330,7 @@ GNUNET_PQ_result_spec_variable_size (const char *name, */ struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_rsa_public_key (const char *name, - struct GNUNET_CRYPTO_rsa_PublicKey **rsa); + struct GNUNET_CRYPTO_RsaPublicKey **rsa); /** @@ -342,7 +342,7 @@ GNUNET_PQ_result_spec_rsa_public_key (const char *name, */ struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_rsa_signature (const char *name, - struct GNUNET_CRYPTO_rsa_Signature **sig); + struct GNUNET_CRYPTO_RsaSignature **sig); /** diff --git a/src/json/json_generator.c b/src/json/json_generator.c index 4b1ac31b1..e660e10c5 100644 --- a/src/json/json_generator.c +++ b/src/json/json_generator.c @@ -106,7 +106,7 @@ GNUNET_JSON_from_time_rel (struct GNUNET_TIME_Relative stamp) * @return corresponding JSON encoding */ json_t * -GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey *pk) +GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *pk) { char *buf; size_t buf_len; @@ -128,7 +128,7 @@ GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey *pk) * @return corresponding JSON encoding */ json_t * -GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_rsa_Signature *sig) +GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig) { char *buf; size_t buf_len; diff --git a/src/json/json_helper.c b/src/json/json_helper.c index cf84ae997..7265dfa66 100644 --- a/src/json/json_helper.c +++ b/src/json/json_helper.c @@ -690,7 +690,7 @@ parse_rsa_public_key (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) { - struct GNUNET_CRYPTO_rsa_PublicKey **pk = spec->ptr; + struct GNUNET_CRYPTO_RsaPublicKey **pk = spec->ptr; const char *enc; char *buf; size_t len; @@ -736,7 +736,7 @@ static void clean_rsa_public_key (void *cls, struct GNUNET_JSON_Specification *spec) { - struct GNUNET_CRYPTO_rsa_PublicKey **pk = spec->ptr; + struct GNUNET_CRYPTO_RsaPublicKey **pk = spec->ptr; if (NULL != *pk) { @@ -754,7 +754,7 @@ clean_rsa_public_key (void *cls, */ struct GNUNET_JSON_Specification GNUNET_JSON_spec_rsa_public_key (const char *name, - struct GNUNET_CRYPTO_rsa_PublicKey **pk) + struct GNUNET_CRYPTO_RsaPublicKey **pk) { struct GNUNET_JSON_Specification ret = { .parser = &parse_rsa_public_key, @@ -782,7 +782,7 @@ parse_rsa_signature (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) { - struct GNUNET_CRYPTO_rsa_Signature **sig = spec->ptr; + struct GNUNET_CRYPTO_RsaSignature **sig = spec->ptr; size_t size; const char *str; int res; @@ -828,7 +828,7 @@ static void clean_rsa_signature (void *cls, struct GNUNET_JSON_Specification *spec) { - struct GNUNET_CRYPTO_rsa_Signature **sig = spec->ptr; + struct GNUNET_CRYPTO_RsaSignature **sig = spec->ptr; if (NULL != *sig) { @@ -846,7 +846,7 @@ clean_rsa_signature (void *cls, */ struct GNUNET_JSON_Specification GNUNET_JSON_spec_rsa_signature (const char *name, - struct GNUNET_CRYPTO_rsa_Signature **sig) + struct GNUNET_CRYPTO_RsaSignature **sig) { struct GNUNET_JSON_Specification ret = { .parser = &parse_rsa_signature, diff --git a/src/json/test_json.c b/src/json/test_json.c index a334bf599..6f1ca565a 100644 --- a/src/json/test_json.c +++ b/src/json/test_json.c @@ -150,19 +150,19 @@ test_raw () static int test_rsa () { - struct GNUNET_CRYPTO_rsa_PublicKey *pub; - struct GNUNET_CRYPTO_rsa_PublicKey *pub2; + struct GNUNET_CRYPTO_RsaPublicKey *pub; + struct GNUNET_CRYPTO_RsaPublicKey *pub2; struct GNUNET_JSON_Specification pspec[] = { GNUNET_JSON_spec_rsa_public_key (NULL, &pub2), GNUNET_JSON_spec_end() }; - struct GNUNET_CRYPTO_rsa_Signature *sig; - struct GNUNET_CRYPTO_rsa_Signature *sig2; + struct GNUNET_CRYPTO_RsaSignature *sig; + struct GNUNET_CRYPTO_RsaSignature *sig2; struct GNUNET_JSON_Specification sspec[] = { GNUNET_JSON_spec_rsa_signature (NULL, &sig2), GNUNET_JSON_spec_end() }; - struct GNUNET_CRYPTO_rsa_PrivateKey *priv; + struct GNUNET_CRYPTO_RsaPrivateKey *priv; char msg[] = "Hello"; json_t *jp; json_t *js; diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c index 13c71446c..d284822c2 100644 --- a/src/pq/pq_query_helper.c +++ b/src/pq/pq_query_helper.c @@ -265,7 +265,7 @@ qconv_rsa_public_key (void *cls, void *scratch[], unsigned int scratch_length) { - const struct GNUNET_CRYPTO_rsa_PublicKey *rsa = data; + const struct GNUNET_CRYPTO_RsaPublicKey *rsa = data; char *buf; size_t buf_size; @@ -290,7 +290,7 @@ qconv_rsa_public_key (void *cls, * @return array entry for the query parameters to use */ struct GNUNET_PQ_QueryParam -GNUNET_PQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey *x) +GNUNET_PQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *x) { struct GNUNET_PQ_QueryParam res = { &qconv_rsa_public_key, NULL, (x), 0, 1 }; @@ -323,7 +323,7 @@ qconv_rsa_signature (void *cls, void *scratch[], unsigned int scratch_length) { - const struct GNUNET_CRYPTO_rsa_Signature *sig = data; + const struct GNUNET_CRYPTO_RsaSignature *sig = data; char *buf; size_t buf_size; @@ -348,7 +348,7 @@ qconv_rsa_signature (void *cls, * @return array entry for the query parameters to use */ struct GNUNET_PQ_QueryParam -GNUNET_PQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_rsa_Signature *x) +GNUNET_PQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x) { struct GNUNET_PQ_QueryParam res = { &qconv_rsa_signature, NULL, (x), 0, 1 }; diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c index 48f073cda..8baf0b00f 100644 --- a/src/pq/pq_result_helper.c +++ b/src/pq/pq_result_helper.c @@ -233,7 +233,7 @@ extract_rsa_public_key (void *cls, size_t *dst_size, void *dst) { - struct GNUNET_CRYPTO_rsa_PublicKey **pk = dst; + struct GNUNET_CRYPTO_RsaPublicKey **pk = dst; size_t len; const char *res; int fnum; @@ -285,7 +285,7 @@ static void clean_rsa_public_key (void *cls, void *rd) { - struct GNUNET_CRYPTO_rsa_PublicKey **pk = rd; + struct GNUNET_CRYPTO_RsaPublicKey **pk = rd; if (NULL != *pk) { @@ -304,7 +304,7 @@ clean_rsa_public_key (void *cls, */ struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_rsa_public_key (const char *name, - struct GNUNET_CRYPTO_rsa_PublicKey **rsa) + struct GNUNET_CRYPTO_RsaPublicKey **rsa) { struct GNUNET_PQ_ResultSpec res = { &extract_rsa_public_key, @@ -337,7 +337,7 @@ extract_rsa_signature (void *cls, size_t *dst_size, void *dst) { - struct GNUNET_CRYPTO_rsa_Signature **sig = dst; + struct GNUNET_CRYPTO_RsaSignature **sig = dst; size_t len; const char *res; int fnum; @@ -389,7 +389,7 @@ static void clean_rsa_signature (void *cls, void *rd) { - struct GNUNET_CRYPTO_rsa_Signature **sig = rd; + struct GNUNET_CRYPTO_RsaSignature **sig = rd; if (NULL != *sig) { @@ -408,7 +408,7 @@ clean_rsa_signature (void *cls, */ struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_rsa_signature (const char *name, - struct GNUNET_CRYPTO_rsa_Signature **sig) + struct GNUNET_CRYPTO_RsaSignature **sig) { struct GNUNET_PQ_ResultSpec res = { &extract_rsa_signature, diff --git a/src/pq/test_pq.c b/src/pq/test_pq.c index b9bf1be76..b8ffc6403 100644 --- a/src/pq/test_pq.c +++ b/src/pq/test_pq.c @@ -89,10 +89,10 @@ postgres_prepare (PGconn *db_conn) static int run_queries (PGconn *conn) { - struct GNUNET_CRYPTO_rsa_PublicKey *pub; - struct GNUNET_CRYPTO_rsa_PublicKey *pub2 = NULL; - struct GNUNET_CRYPTO_rsa_Signature *sig; - struct GNUNET_CRYPTO_rsa_Signature *sig2 = NULL; + struct GNUNET_CRYPTO_RsaPublicKey *pub; + struct GNUNET_CRYPTO_RsaPublicKey *pub2 = NULL; + struct GNUNET_CRYPTO_RsaSignature *sig; + struct GNUNET_CRYPTO_RsaSignature *sig2 = NULL; struct GNUNET_TIME_Absolute abs_time = GNUNET_TIME_absolute_get (); struct GNUNET_TIME_Absolute abs_time2; struct GNUNET_TIME_Absolute forever = GNUNET_TIME_UNIT_FOREVER_ABS; @@ -101,7 +101,7 @@ run_queries (PGconn *conn) struct GNUNET_HashCode hc2; PGresult *result; int ret; - struct GNUNET_CRYPTO_rsa_PrivateKey *priv; + struct GNUNET_CRYPTO_RsaPrivateKey *priv; char msg[] = "Hello"; void *msg2; size_t msg2_len; diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index a14eff407..b19634ab8 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c @@ -30,7 +30,7 @@ /** * The private information of an RSA key pair. */ -struct GNUNET_CRYPTO_rsa_PrivateKey +struct GNUNET_CRYPTO_RsaPrivateKey { /** * Libgcrypt S-expression for the RSA private key. @@ -42,7 +42,7 @@ struct GNUNET_CRYPTO_rsa_PrivateKey /** * The public information of an RSA key pair. */ -struct GNUNET_CRYPTO_rsa_PublicKey +struct GNUNET_CRYPTO_RsaPublicKey { /** * Libgcrypt S-expression for the RSA public key. @@ -54,7 +54,7 @@ struct GNUNET_CRYPTO_rsa_PublicKey /** * @brief an RSA signature */ -struct GNUNET_CRYPTO_rsa_Signature +struct GNUNET_CRYPTO_RsaSignature { /** * Libgcrypt S-expression for the RSA signature. @@ -140,10 +140,10 @@ key_from_sexp (gcry_mpi_t *array, * @param len length of the key in bits (i.e. 2048) * @return fresh private key */ -struct GNUNET_CRYPTO_rsa_PrivateKey * +struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_create (unsigned int len) { - struct GNUNET_CRYPTO_rsa_PrivateKey *ret; + struct GNUNET_CRYPTO_RsaPrivateKey *ret; gcry_sexp_t s_key; gcry_sexp_t s_keyparam; @@ -160,7 +160,7 @@ GNUNET_CRYPTO_rsa_private_key_create (unsigned int len) GNUNET_assert (0 == gcry_pk_testkey (s_key)); #endif - ret = GNUNET_new (struct GNUNET_CRYPTO_rsa_PrivateKey); + ret = GNUNET_new (struct GNUNET_CRYPTO_RsaPrivateKey); ret->sexp = s_key; return ret; } @@ -172,7 +172,7 @@ GNUNET_CRYPTO_rsa_private_key_create (unsigned int len) * @param key pointer to the memory to free */ void -GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_rsa_PrivateKey *key) +GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key) { gcry_sexp_release (key->sexp); GNUNET_free (key); @@ -188,7 +188,7 @@ GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_rsa_PrivateKey *key) * @return size of memory allocated in @a buffer */ size_t -GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, +GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_RsaPrivateKey *key, char **buffer) { size_t n; @@ -217,12 +217,12 @@ GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_rsa_PrivateKey * @param len the length of the data in @a buf * @return NULL on error */ -struct GNUNET_CRYPTO_rsa_PrivateKey * +struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, size_t len) { - struct GNUNET_CRYPTO_rsa_PrivateKey *key; - key = GNUNET_new (struct GNUNET_CRYPTO_rsa_PrivateKey); + struct GNUNET_CRYPTO_RsaPrivateKey *key; + key = GNUNET_new (struct GNUNET_CRYPTO_RsaPrivateKey); if (0 != gcry_sexp_new (&key->sexp, buf, @@ -251,10 +251,10 @@ GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, * @param priv the private key * @retur NULL on error, otherwise the public key */ -struct GNUNET_CRYPTO_rsa_PublicKey * -GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_rsa_PrivateKey *priv) +struct GNUNET_CRYPTO_RsaPublicKey * +GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_RsaPrivateKey *priv) { - struct GNUNET_CRYPTO_rsa_PublicKey *pub; + struct GNUNET_CRYPTO_RsaPublicKey *pub; gcry_mpi_t ne[2]; int rc; gcry_sexp_t result; @@ -276,7 +276,7 @@ GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_rsa_Private ne[1]); gcry_mpi_release (ne[0]); gcry_mpi_release (ne[1]); - pub = GNUNET_new (struct GNUNET_CRYPTO_rsa_PublicKey); + pub = GNUNET_new (struct GNUNET_CRYPTO_RsaPublicKey); pub->sexp = result; return pub; } @@ -288,7 +288,7 @@ GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_rsa_Private * @param key pointer to the memory to free */ void -GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_rsa_PublicKey *key) +GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_RsaPublicKey *key) { gcry_sexp_release (key->sexp); GNUNET_free (key); @@ -304,7 +304,7 @@ GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_rsa_PublicKey *key) * @return size of memory allocated in @a buffer */ size_t -GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_rsa_PublicKey *key, +GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_RsaPublicKey *key, char **buffer) { size_t n; @@ -332,7 +332,7 @@ GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_rsa_PublicKey *k * @param hc where to store the hash code */ void -GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_rsa_PublicKey *key, +GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_RsaPublicKey *key, struct GNUNET_HashCode *hc) { char *buf; @@ -355,15 +355,15 @@ GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_rsa_PublicKey *key * @param len the length of the data in @a buf * @return NULL on error */ -struct GNUNET_CRYPTO_rsa_PublicKey * +struct GNUNET_CRYPTO_RsaPublicKey * GNUNET_CRYPTO_rsa_public_key_decode (const char *buf, size_t len) { - struct GNUNET_CRYPTO_rsa_PublicKey *key; + struct GNUNET_CRYPTO_RsaPublicKey *key; gcry_mpi_t n; int ret; - key = GNUNET_new (struct GNUNET_CRYPTO_rsa_PublicKey); + key = GNUNET_new (struct GNUNET_CRYPTO_RsaPublicKey); if (0 != gcry_sexp_new (&key->sexp, buf, @@ -435,8 +435,8 @@ GNUNET_CRYPTO_rsa_blinding_key_cmp (struct GNUNET_CRYPTO_rsa_BlindingKey *b1, * @return 0 if the two are equal */ int -GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_rsa_Signature *s1, - struct GNUNET_CRYPTO_rsa_Signature *s2) +GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_RsaSignature *s1, + struct GNUNET_CRYPTO_RsaSignature *s2) { char *b1; char *b2; @@ -468,8 +468,8 @@ GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_rsa_Signature *s1, * @return 0 if the two are equal */ int -GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_rsa_PublicKey *p1, - struct GNUNET_CRYPTO_rsa_PublicKey *p2) +GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_RsaPublicKey *p1, + struct GNUNET_CRYPTO_RsaPublicKey *p2) { char *b1; char *b2; @@ -501,8 +501,8 @@ GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_rsa_PublicKey *p1, * @return 0 if the two are equal */ int -GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_rsa_PrivateKey *p1, - struct GNUNET_CRYPTO_rsa_PrivateKey *p2) +GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_RsaPrivateKey *p1, + struct GNUNET_CRYPTO_RsaPrivateKey *p2) { char *b1; char *b2; @@ -533,7 +533,7 @@ GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_rsa_PrivateKey *p1, * @return length of the key in bits */ unsigned int -GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_rsa_PublicKey *key) +GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_RsaPublicKey *key) { gcry_mpi_t n; int ret; @@ -645,27 +645,32 @@ GNUNET_CRYPTO_rsa_blinding_key_decode (const char *buf, /** - * Computes a full domain hash seeded by the given public key. + * Computes a full domain hash seeded by the given public key. * This gives a measure of provable security to the Taler exchange * against one-more forgery attacks. See: * https://eprint.iacr.org/2001/002.pdf * http://www.di.ens.fr/~pointche/Documents/Papers/2001_fcA.pdf * + * @param[out] r MPI value set to the FDH * @param hash initial hash of the message to sign * @param pkey the public key of the signer + * @param rsize FIXME JEFF * @return libgcrypt error that to represent an allocation failure */ gcry_error_t rsa_full_domain_hash (gcry_mpi_t *r, const struct GNUNET_HashCode *hash, - const struct GNUNET_CRYPTO_rsa_PublicKey *pkey, + const struct GNUNET_CRYPTO_RsaPublicKey *pkey, size_t *rsize) { - int i,nbits,nhashes; + unsigned int i; + unsigned int nbits; + unsigned int nhashes; gcry_error_t rc; char *buf; size_t buf_len; - gcry_md_hd_t h,h0; + gcry_md_hd_t h; + gcry_md_hd_t h0; struct GNUNET_HashCode *hs; /* Uncomment the following to debug without using the full domain hash */ @@ -675,60 +680,64 @@ rsa_full_domain_hash (gcry_mpi_t *r, (const unsigned char *)hash, sizeof(struct GNUNET_HashCode), rsize); - return rc; + return rc; */ nbits = GNUNET_CRYPTO_rsa_public_key_len (pkey); - // calls gcry_mpi_get_nbits(.. pkey->sexp ..) if (nbits < 512) nbits = 512; - // Already almost an HMAC since we consume a hash, so no GCRY_MD_FLAG_HMAC. - rc = gcry_md_open (&h,GCRY_MD_SHA512,0); - if (0 != rc) return rc; + /* Already almost an HMAC since we consume a hash, so no GCRY_MD_FLAG_HMAC. */ + rc = gcry_md_open (&h, GCRY_MD_SHA512, 0); + if (0 != rc) + return rc; - // We seed with the public denomination key as a homage to RSA-PSS by + // We seed with the public denomination key as a homage to RSA-PSS by // Mihir Bellare and Phillip Rogaway. Doing this lowers the degree - // of the hypothetical polyomial-time attack on RSA-KTI created by a + // of the hypothetical polyomial-time attack on RSA-KTI created by a // polynomial-time one-more forgary attack. Yey seeding! buf_len = GNUNET_CRYPTO_rsa_public_key_encode (pkey, &buf); - gcry_md_write (h, buf,buf_len); + gcry_md_write (h, buf, buf_len); GNUNET_free (buf); nhashes = (nbits-1) / (8 * sizeof(struct GNUNET_HashCode)) + 1; - hs = (struct GNUNET_HashCode *)GNUNET_malloc (nhashes * sizeof(struct GNUNET_HashCode)); - for (i=0; isexp)) { - GNUNET_break (0); + GNUNET_break (0); GNUNET_CRYPTO_rsa_public_key_free (public_key); gcry_sexp_release (data); gcry_sexp_release (result); @@ -861,7 +871,7 @@ rsa_sign_mpi (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, /* return signature */ gcry_sexp_release (data); - sig = GNUNET_new (struct GNUNET_CRYPTO_rsa_Signature); + sig = GNUNET_new (struct GNUNET_CRYPTO_RsaSignature); sig->sexp = result; return sig; } @@ -875,21 +885,21 @@ rsa_sign_mpi (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, * @param msg_len number of bytes in @a msg to sign * @return NULL on error, signature on success */ -struct GNUNET_CRYPTO_rsa_Signature * -GNUNET_CRYPTO_rsa_sign_blinded (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, +struct GNUNET_CRYPTO_RsaSignature * +GNUNET_CRYPTO_rsa_sign_blinded (const struct GNUNET_CRYPTO_RsaPrivateKey *key, const void *msg, size_t msg_len) { gcry_mpi_t v = NULL; - GNUNET_assert (0 == + GNUNET_assert (0 == gcry_mpi_scan (&v, GCRYMPI_FMT_USG, msg, msg_len, NULL)); - return rsa_sign_mpi (key,v); + return rsa_sign_mpi (key, v); } @@ -900,11 +910,11 @@ GNUNET_CRYPTO_rsa_sign_blinded (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, * @param hash the hash of the message to sign * @return NULL on error, signature on success */ -struct GNUNET_CRYPTO_rsa_Signature * -GNUNET_CRYPTO_rsa_sign_fdh (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, +struct GNUNET_CRYPTO_RsaSignature * +GNUNET_CRYPTO_rsa_sign_fdh (const struct GNUNET_CRYPTO_RsaPrivateKey *key, const struct GNUNET_HashCode *hash) { - struct GNUNET_CRYPTO_rsa_PublicKey *pkey; + struct GNUNET_CRYPTO_RsaPublicKey *pkey; gcry_mpi_t v = NULL; gcry_error_t rc; @@ -923,7 +933,7 @@ GNUNET_CRYPTO_rsa_sign_fdh (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, * @param sig memory to freee */ void -GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_rsa_Signature *sig) +GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_RsaSignature *sig) { gcry_sexp_release (sig->sexp); GNUNET_free (sig); @@ -938,7 +948,7 @@ GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_rsa_Signature *sig) * @return size of memory allocated in @a buffer */ size_t -GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_rsa_Signature *sig, +GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_RsaSignature *sig, char **buffer) { size_t n; @@ -967,15 +977,15 @@ GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_rsa_Signature *si * @param len the length of the data in @a buf * @return NULL on error */ -struct GNUNET_CRYPTO_rsa_Signature * +struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_signature_decode (const char *buf, size_t len) { - struct GNUNET_CRYPTO_rsa_Signature *sig; + struct GNUNET_CRYPTO_RsaSignature *sig; int ret; gcry_mpi_t s; - sig = GNUNET_new (struct GNUNET_CRYPTO_rsa_Signature); + sig = GNUNET_new (struct GNUNET_CRYPTO_RsaSignature); if (0 != gcry_sexp_new (&sig->sexp, buf, @@ -1009,10 +1019,10 @@ GNUNET_CRYPTO_rsa_signature_decode (const char *buf, * @param key the public key to duplicate * @return the duplicate key; NULL upon error */ -struct GNUNET_CRYPTO_rsa_PublicKey * -GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_rsa_PublicKey *key) +struct GNUNET_CRYPTO_RsaPublicKey * +GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_RsaPublicKey *key) { - struct GNUNET_CRYPTO_rsa_PublicKey *dup; + struct GNUNET_CRYPTO_RsaPublicKey *dup; gcry_sexp_t dup_sexp; size_t erroff; @@ -1022,7 +1032,7 @@ GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_rsa_PublicKey *key) gcry_sexp_release (dup_sexp); /* copy the sexp */ GNUNET_assert (0 == gcry_sexp_build (&dup_sexp, &erroff, "%S", key->sexp)); - dup = GNUNET_new (struct GNUNET_CRYPTO_rsa_PublicKey); + dup = GNUNET_new (struct GNUNET_CRYPTO_RsaPublicKey); dup->sexp = dup_sexp; return dup; } @@ -1038,17 +1048,17 @@ GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_rsa_PublicKey *key) * @param pkey the public key of the signer * @return unblinded signature on success, NULL on error */ -struct GNUNET_CRYPTO_rsa_Signature * -GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_rsa_Signature *sig, +struct GNUNET_CRYPTO_RsaSignature * +GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_RsaSignature *sig, struct GNUNET_CRYPTO_rsa_BlindingKey *bkey, - struct GNUNET_CRYPTO_rsa_PublicKey *pkey) + struct GNUNET_CRYPTO_RsaPublicKey *pkey) { gcry_mpi_t n; gcry_mpi_t s; gcry_mpi_t r_inv; gcry_mpi_t ubsig; int ret; - struct GNUNET_CRYPTO_rsa_Signature *sret; + struct GNUNET_CRYPTO_RsaSignature *sret; ret = key_from_sexp (&n, pkey->sexp, "public-key", "n"); if (0 != ret) @@ -1085,7 +1095,7 @@ GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_rsa_Signature *sig, gcry_mpi_release (r_inv); gcry_mpi_release (s); - sret = GNUNET_new (struct GNUNET_CRYPTO_rsa_Signature); + sret = GNUNET_new (struct GNUNET_CRYPTO_RsaSignature); GNUNET_assert (0 == gcry_sexp_build (&sret->sexp, NULL, @@ -1107,8 +1117,8 @@ GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_rsa_Signature *sig, */ int GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, - const struct GNUNET_CRYPTO_rsa_Signature *sig, - const struct GNUNET_CRYPTO_rsa_PublicKey *pkey) + const struct GNUNET_CRYPTO_RsaSignature *sig, + const struct GNUNET_CRYPTO_RsaPublicKey *pkey) { gcry_sexp_t data; gcry_mpi_t r; @@ -1142,10 +1152,10 @@ GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, * @param key the private key to duplicate * @return the duplicate key; NULL upon error */ -struct GNUNET_CRYPTO_rsa_PrivateKey * -GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_rsa_PrivateKey *key) +struct GNUNET_CRYPTO_RsaPrivateKey * +GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_RsaPrivateKey *key) { - struct GNUNET_CRYPTO_rsa_PrivateKey *dup; + struct GNUNET_CRYPTO_RsaPrivateKey *dup; gcry_sexp_t dup_sexp; size_t erroff; @@ -1155,7 +1165,7 @@ GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_rsa_PrivateKey *ke gcry_sexp_release (dup_sexp); /* copy the sexp */ GNUNET_assert (0 == gcry_sexp_build (&dup_sexp, &erroff, "%S", key->sexp)); - dup = GNUNET_new (struct GNUNET_CRYPTO_rsa_PrivateKey); + dup = GNUNET_new (struct GNUNET_CRYPTO_RsaPrivateKey); dup->sexp = dup_sexp; return dup; } @@ -1167,10 +1177,10 @@ GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_rsa_PrivateKey *ke * @param key the private key to duplicate * @return the duplicate key; NULL upon error */ -struct GNUNET_CRYPTO_rsa_Signature * -GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_rsa_Signature *sig) +struct GNUNET_CRYPTO_RsaSignature * +GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_RsaSignature *sig) { - struct GNUNET_CRYPTO_rsa_Signature *dup; + struct GNUNET_CRYPTO_RsaSignature *dup; gcry_sexp_t dup_sexp; size_t erroff; gcry_mpi_t s; @@ -1184,7 +1194,7 @@ GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_rsa_Signature *sig) gcry_mpi_release (s); /* copy the sexp */ GNUNET_assert (0 == gcry_sexp_build (&dup_sexp, &erroff, "%S", sig->sexp)); - dup = GNUNET_new (struct GNUNET_CRYPTO_rsa_Signature); + dup = GNUNET_new (struct GNUNET_CRYPTO_RsaSignature); dup->sexp = dup_sexp; return dup; } diff --git a/src/util/perf_crypto_rsa.c b/src/util/perf_crypto_rsa.c index ed184481f..70cd785b5 100644 --- a/src/util/perf_crypto_rsa.c +++ b/src/util/perf_crypto_rsa.c @@ -37,10 +37,10 @@ static void eval (unsigned int len) { struct GNUNET_TIME_Absolute start; - struct GNUNET_CRYPTO_rsa_Signature *sig; - struct GNUNET_CRYPTO_rsa_Signature *rsig; - struct GNUNET_CRYPTO_rsa_PublicKey *public_key; - struct GNUNET_CRYPTO_rsa_PrivateKey *private_key; + struct GNUNET_CRYPTO_RsaSignature *sig; + struct GNUNET_CRYPTO_RsaSignature *rsig; + struct GNUNET_CRYPTO_RsaPublicKey *public_key; + struct GNUNET_CRYPTO_RsaPrivateKey *private_key; struct GNUNET_CRYPTO_rsa_BlindingKey *bkey; unsigned int i; char sbuf[128]; diff --git a/src/util/test_crypto_rsa.c b/src/util/test_crypto_rsa.c index 9bd2e6ae5..04134ea2a 100644 --- a/src/util/test_crypto_rsa.c +++ b/src/util/test_crypto_rsa.c @@ -29,7 +29,7 @@ gcry_error_t rsa_full_domain_hash (gcry_mpi_t *r, const struct GNUNET_HashCode *hash, - const struct GNUNET_CRYPTO_rsa_PublicKey *pkey, + const struct GNUNET_CRYPTO_RsaPublicKey *pkey, size_t *rsize); @@ -39,14 +39,14 @@ main (int argc, { #define RND_BLK_SIZE 4096 unsigned char rnd_blk[RND_BLK_SIZE]; - struct GNUNET_CRYPTO_rsa_PrivateKey *priv; - struct GNUNET_CRYPTO_rsa_PrivateKey *priv_copy; - struct GNUNET_CRYPTO_rsa_PublicKey *pub; - struct GNUNET_CRYPTO_rsa_PublicKey *pub_copy; + struct GNUNET_CRYPTO_RsaPrivateKey *priv; + struct GNUNET_CRYPTO_RsaPrivateKey *priv_copy; + struct GNUNET_CRYPTO_RsaPublicKey *pub; + struct GNUNET_CRYPTO_RsaPublicKey *pub_copy; struct GNUNET_CRYPTO_rsa_BlindingKey *bkey; - struct GNUNET_CRYPTO_rsa_Signature *sig; - struct GNUNET_CRYPTO_rsa_Signature *sig_copy; - struct GNUNET_CRYPTO_rsa_Signature *bsig; + struct GNUNET_CRYPTO_RsaSignature *sig; + struct GNUNET_CRYPTO_RsaSignature *sig_copy; + struct GNUNET_CRYPTO_RsaSignature *bsig; struct GNUNET_HashCode hash; char *blind_buf; size_t bsize; -- cgit v1.2.3