diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-03-21 13:41:12 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-03-21 13:41:12 +0000 |
commit | 1733de7305720882b8745e82b51b6ff47c10099e (patch) | |
tree | df9199b0e8670b089ead17186b191b80629bda8f | |
parent | 60de5f48cbfc3868570284e91415ca7e06c390e1 (diff) | |
download | gnunet-1733de7305720882b8745e82b51b6ff47c10099e.tar.gz gnunet-1733de7305720882b8745e82b51b6ff47c10099e.zip |
fixing symbol naming and coding convention issues
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 74 | ||||
-rw-r--r-- | src/include/gnunet_json_lib.h | 8 | ||||
-rw-r--r-- | src/include/gnunet_pq_lib.h | 8 | ||||
-rw-r--r-- | src/json/json_generator.c | 4 | ||||
-rw-r--r-- | src/json/json_helper.c | 12 | ||||
-rw-r--r-- | src/json/test_json.c | 10 | ||||
-rw-r--r-- | src/pq/pq_query_helper.c | 8 | ||||
-rw-r--r-- | src/pq/pq_result_helper.c | 12 | ||||
-rw-r--r-- | src/pq/test_pq.c | 10 | ||||
-rw-r--r-- | src/util/crypto_rsa.c | 198 | ||||
-rw-r--r-- | src/util/perf_crypto_rsa.c | 8 | ||||
-rw-r--r-- | src/util/test_crypto_rsa.c | 16 |
12 files changed, 189 insertions, 179 deletions
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 | |||
1779 | /** | 1779 | /** |
1780 | * The private information of an RSA key pair. | 1780 | * The private information of an RSA key pair. |
1781 | */ | 1781 | */ |
1782 | struct GNUNET_CRYPTO_rsa_PrivateKey; | 1782 | struct GNUNET_CRYPTO_RsaPrivateKey; |
1783 | 1783 | ||
1784 | /** | 1784 | /** |
1785 | * The public information of an RSA key pair. | 1785 | * The public information of an RSA key pair. |
1786 | */ | 1786 | */ |
1787 | struct GNUNET_CRYPTO_rsa_PublicKey; | 1787 | struct GNUNET_CRYPTO_RsaPublicKey; |
1788 | 1788 | ||
1789 | /** | 1789 | /** |
1790 | * Key used to blind a message | 1790 | * Key used to blind a message |
@@ -1794,7 +1794,7 @@ struct GNUNET_CRYPTO_rsa_BlindingKey; | |||
1794 | /** | 1794 | /** |
1795 | * @brief an RSA signature | 1795 | * @brief an RSA signature |
1796 | */ | 1796 | */ |
1797 | struct GNUNET_CRYPTO_rsa_Signature; | 1797 | struct GNUNET_CRYPTO_RsaSignature; |
1798 | 1798 | ||
1799 | 1799 | ||
1800 | /** | 1800 | /** |
@@ -1803,7 +1803,7 @@ struct GNUNET_CRYPTO_rsa_Signature; | |||
1803 | * @param len length of the key in bits (i.e. 2048) | 1803 | * @param len length of the key in bits (i.e. 2048) |
1804 | * @return fresh private key | 1804 | * @return fresh private key |
1805 | */ | 1805 | */ |
1806 | struct GNUNET_CRYPTO_rsa_PrivateKey * | 1806 | struct GNUNET_CRYPTO_RsaPrivateKey * |
1807 | GNUNET_CRYPTO_rsa_private_key_create (unsigned int len); | 1807 | GNUNET_CRYPTO_rsa_private_key_create (unsigned int len); |
1808 | 1808 | ||
1809 | 1809 | ||
@@ -1813,7 +1813,7 @@ GNUNET_CRYPTO_rsa_private_key_create (unsigned int len); | |||
1813 | * @param key pointer to the memory to free | 1813 | * @param key pointer to the memory to free |
1814 | */ | 1814 | */ |
1815 | void | 1815 | void |
1816 | GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_rsa_PrivateKey *key); | 1816 | GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key); |
1817 | 1817 | ||
1818 | 1818 | ||
1819 | /** | 1819 | /** |
@@ -1825,7 +1825,7 @@ GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_rsa_PrivateKey *key); | |||
1825 | * @return size of memory allocatedin @a buffer | 1825 | * @return size of memory allocatedin @a buffer |
1826 | */ | 1826 | */ |
1827 | size_t | 1827 | size_t |
1828 | GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, | 1828 | GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_RsaPrivateKey *key, |
1829 | char **buffer); | 1829 | char **buffer); |
1830 | 1830 | ||
1831 | 1831 | ||
@@ -1837,7 +1837,7 @@ GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_rsa_PrivateKey | |||
1837 | * @param len the length of the data in @a buf | 1837 | * @param len the length of the data in @a buf |
1838 | * @return NULL on error | 1838 | * @return NULL on error |
1839 | */ | 1839 | */ |
1840 | struct GNUNET_CRYPTO_rsa_PrivateKey * | 1840 | struct GNUNET_CRYPTO_RsaPrivateKey * |
1841 | GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, | 1841 | GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, |
1842 | size_t len); | 1842 | size_t len); |
1843 | 1843 | ||
@@ -1848,8 +1848,8 @@ GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, | |||
1848 | * @param key the private key to duplicate | 1848 | * @param key the private key to duplicate |
1849 | * @return the duplicate key; NULL upon error | 1849 | * @return the duplicate key; NULL upon error |
1850 | */ | 1850 | */ |
1851 | struct GNUNET_CRYPTO_rsa_PrivateKey * | 1851 | struct GNUNET_CRYPTO_RsaPrivateKey * |
1852 | GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_rsa_PrivateKey *key); | 1852 | GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_RsaPrivateKey *key); |
1853 | 1853 | ||
1854 | 1854 | ||
1855 | /** | 1855 | /** |
@@ -1858,8 +1858,8 @@ GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_rsa_PrivateKey *ke | |||
1858 | * @param priv the private key | 1858 | * @param priv the private key |
1859 | * @retur NULL on error, otherwise the public key | 1859 | * @retur NULL on error, otherwise the public key |
1860 | */ | 1860 | */ |
1861 | struct GNUNET_CRYPTO_rsa_PublicKey * | 1861 | struct GNUNET_CRYPTO_RsaPublicKey * |
1862 | GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_rsa_PrivateKey *priv); | 1862 | GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_RsaPrivateKey *priv); |
1863 | 1863 | ||
1864 | 1864 | ||
1865 | /** | 1865 | /** |
@@ -1869,7 +1869,7 @@ GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_rsa_Private | |||
1869 | * @param hc where to store the hash code | 1869 | * @param hc where to store the hash code |
1870 | */ | 1870 | */ |
1871 | void | 1871 | void |
1872 | GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_rsa_PublicKey *key, | 1872 | GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_RsaPublicKey *key, |
1873 | struct GNUNET_HashCode *hc); | 1873 | struct GNUNET_HashCode *hc); |
1874 | 1874 | ||
1875 | 1875 | ||
@@ -1880,7 +1880,7 @@ GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_rsa_PublicKey *key | |||
1880 | * @return length of the key in bits | 1880 | * @return length of the key in bits |
1881 | */ | 1881 | */ |
1882 | unsigned int | 1882 | unsigned int |
1883 | GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_rsa_PublicKey *key); | 1883 | GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_RsaPublicKey *key); |
1884 | 1884 | ||
1885 | 1885 | ||
1886 | /** | 1886 | /** |
@@ -1889,7 +1889,7 @@ GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_rsa_PublicKey *key) | |||
1889 | * @param key pointer to the memory to free | 1889 | * @param key pointer to the memory to free |
1890 | */ | 1890 | */ |
1891 | void | 1891 | void |
1892 | GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_rsa_PublicKey *key); | 1892 | GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_RsaPublicKey *key); |
1893 | 1893 | ||
1894 | 1894 | ||
1895 | /** | 1895 | /** |
@@ -1901,7 +1901,7 @@ GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_rsa_PublicKey *key); | |||
1901 | * @return size of memory allocated in @a buffer | 1901 | * @return size of memory allocated in @a buffer |
1902 | */ | 1902 | */ |
1903 | size_t | 1903 | size_t |
1904 | GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_rsa_PublicKey *key, | 1904 | GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_RsaPublicKey *key, |
1905 | char **buffer); | 1905 | char **buffer); |
1906 | 1906 | ||
1907 | 1907 | ||
@@ -1913,7 +1913,7 @@ GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_rsa_PublicKey *k | |||
1913 | * @param len the length of the data in @a buf | 1913 | * @param len the length of the data in @a buf |
1914 | * @return NULL on error | 1914 | * @return NULL on error |
1915 | */ | 1915 | */ |
1916 | struct GNUNET_CRYPTO_rsa_PublicKey * | 1916 | struct GNUNET_CRYPTO_RsaPublicKey * |
1917 | GNUNET_CRYPTO_rsa_public_key_decode (const char *buf, | 1917 | GNUNET_CRYPTO_rsa_public_key_decode (const char *buf, |
1918 | size_t len); | 1918 | size_t len); |
1919 | 1919 | ||
@@ -1924,8 +1924,8 @@ GNUNET_CRYPTO_rsa_public_key_decode (const char *buf, | |||
1924 | * @param key the public key to duplicate | 1924 | * @param key the public key to duplicate |
1925 | * @return the duplicate key; NULL upon error | 1925 | * @return the duplicate key; NULL upon error |
1926 | */ | 1926 | */ |
1927 | struct GNUNET_CRYPTO_rsa_PublicKey * | 1927 | struct GNUNET_CRYPTO_RsaPublicKey * |
1928 | GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_rsa_PublicKey *key); | 1928 | GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_RsaPublicKey *key); |
1929 | 1929 | ||
1930 | 1930 | ||
1931 | /** | 1931 | /** |
@@ -1958,8 +1958,8 @@ GNUNET_CRYPTO_rsa_blinding_key_cmp (struct GNUNET_CRYPTO_rsa_BlindingKey *b1, | |||
1958 | * @return 0 if the two are equal | 1958 | * @return 0 if the two are equal |
1959 | */ | 1959 | */ |
1960 | int | 1960 | int |
1961 | GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_rsa_Signature *s1, | 1961 | GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_RsaSignature *s1, |
1962 | struct GNUNET_CRYPTO_rsa_Signature *s2); | 1962 | struct GNUNET_CRYPTO_RsaSignature *s2); |
1963 | 1963 | ||
1964 | /** | 1964 | /** |
1965 | * Compare the values of two private keys. | 1965 | * Compare the values of two private keys. |
@@ -1969,8 +1969,8 @@ GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_rsa_Signature *s1, | |||
1969 | * @return 0 if the two are equal | 1969 | * @return 0 if the two are equal |
1970 | */ | 1970 | */ |
1971 | int | 1971 | int |
1972 | GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_rsa_PrivateKey *p1, | 1972 | GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_RsaPrivateKey *p1, |
1973 | struct GNUNET_CRYPTO_rsa_PrivateKey *p2); | 1973 | struct GNUNET_CRYPTO_RsaPrivateKey *p2); |
1974 | 1974 | ||
1975 | 1975 | ||
1976 | /** | 1976 | /** |
@@ -1981,8 +1981,8 @@ GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_rsa_PrivateKey *p1, | |||
1981 | * @return 0 if the two are equal | 1981 | * @return 0 if the two are equal |
1982 | */ | 1982 | */ |
1983 | int | 1983 | int |
1984 | GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_rsa_PublicKey *p1, | 1984 | GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_RsaPublicKey *p1, |
1985 | struct GNUNET_CRYPTO_rsa_PublicKey *p2); | 1985 | struct GNUNET_CRYPTO_RsaPublicKey *p2); |
1986 | 1986 | ||
1987 | 1987 | ||
1988 | /** | 1988 | /** |
@@ -2032,7 +2032,7 @@ GNUNET_CRYPTO_rsa_blinding_key_decode (const char *buf, | |||
2032 | size_t | 2032 | size_t |
2033 | GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, | 2033 | GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, |
2034 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey, | 2034 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey, |
2035 | struct GNUNET_CRYPTO_rsa_PublicKey *pkey, | 2035 | struct GNUNET_CRYPTO_RsaPublicKey *pkey, |
2036 | char **buffer); | 2036 | char **buffer); |
2037 | 2037 | ||
2038 | 2038 | ||
@@ -2044,8 +2044,8 @@ GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, | |||
2044 | * @param msg_len number of bytes in @a msg to sign | 2044 | * @param msg_len number of bytes in @a msg to sign |
2045 | * @return NULL on error, signature on success | 2045 | * @return NULL on error, signature on success |
2046 | */ | 2046 | */ |
2047 | struct GNUNET_CRYPTO_rsa_Signature * | 2047 | struct GNUNET_CRYPTO_RsaSignature * |
2048 | GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, | 2048 | GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_RsaPrivateKey *key, |
2049 | const void *msg, | 2049 | const void *msg, |
2050 | size_t msg_len); | 2050 | size_t msg_len); |
2051 | 2051 | ||
@@ -2056,7 +2056,7 @@ GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, | |||
2056 | * @param sig memory to free | 2056 | * @param sig memory to free |
2057 | */ | 2057 | */ |
2058 | void | 2058 | void |
2059 | GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_rsa_Signature *sig); | 2059 | GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_RsaSignature *sig); |
2060 | 2060 | ||
2061 | 2061 | ||
2062 | /** | 2062 | /** |
@@ -2067,7 +2067,7 @@ GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_rsa_Signature *sig); | |||
2067 | * @return size of memory allocated in @a buffer | 2067 | * @return size of memory allocated in @a buffer |
2068 | */ | 2068 | */ |
2069 | size_t | 2069 | size_t |
2070 | GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_rsa_Signature *sig, | 2070 | GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_RsaSignature *sig, |
2071 | char **buffer); | 2071 | char **buffer); |
2072 | 2072 | ||
2073 | 2073 | ||
@@ -2079,7 +2079,7 @@ GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_rsa_Signature *si | |||
2079 | * @param len the length of the data in @a buf | 2079 | * @param len the length of the data in @a buf |
2080 | * @return NULL on error | 2080 | * @return NULL on error |
2081 | */ | 2081 | */ |
2082 | struct GNUNET_CRYPTO_rsa_Signature * | 2082 | struct GNUNET_CRYPTO_RsaSignature * |
2083 | GNUNET_CRYPTO_rsa_signature_decode (const char *buf, | 2083 | GNUNET_CRYPTO_rsa_signature_decode (const char *buf, |
2084 | size_t len); | 2084 | size_t len); |
2085 | 2085 | ||
@@ -2090,8 +2090,8 @@ GNUNET_CRYPTO_rsa_signature_decode (const char *buf, | |||
2090 | * @param sig the signature to duplicate | 2090 | * @param sig the signature to duplicate |
2091 | * @return the duplicate key; NULL upon error | 2091 | * @return the duplicate key; NULL upon error |
2092 | */ | 2092 | */ |
2093 | struct GNUNET_CRYPTO_rsa_Signature * | 2093 | struct GNUNET_CRYPTO_RsaSignature * |
2094 | GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_rsa_Signature *sig); | 2094 | GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_RsaSignature *sig); |
2095 | 2095 | ||
2096 | 2096 | ||
2097 | /** | 2097 | /** |
@@ -2104,10 +2104,10 @@ GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_rsa_Signature *sig); | |||
2104 | * @param pkey the public key of the signer | 2104 | * @param pkey the public key of the signer |
2105 | * @return unblinded signature on success, NULL on error | 2105 | * @return unblinded signature on success, NULL on error |
2106 | */ | 2106 | */ |
2107 | struct GNUNET_CRYPTO_rsa_Signature * | 2107 | struct GNUNET_CRYPTO_RsaSignature * |
2108 | GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_rsa_Signature *sig, | 2108 | GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_RsaSignature *sig, |
2109 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey, | 2109 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey, |
2110 | struct GNUNET_CRYPTO_rsa_PublicKey *pkey); | 2110 | struct GNUNET_CRYPTO_RsaPublicKey *pkey); |
2111 | 2111 | ||
2112 | 2112 | ||
2113 | /** | 2113 | /** |
@@ -2121,8 +2121,8 @@ GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_rsa_Signature *sig, | |||
2121 | */ | 2121 | */ |
2122 | int | 2122 | int |
2123 | GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, | 2123 | GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, |
2124 | const struct GNUNET_CRYPTO_rsa_Signature *sig, | 2124 | const struct GNUNET_CRYPTO_RsaSignature *sig, |
2125 | const struct GNUNET_CRYPTO_rsa_PublicKey *public_key); | 2125 | const struct GNUNET_CRYPTO_RsaPublicKey *public_key); |
2126 | 2126 | ||
2127 | 2127 | ||
2128 | #if 0 /* keep Emacsens' auto-indent happy */ | 2128 | #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, | |||
281 | */ | 281 | */ |
282 | struct GNUNET_JSON_Specification | 282 | struct GNUNET_JSON_Specification |
283 | GNUNET_JSON_spec_rsa_public_key (const char *name, | 283 | GNUNET_JSON_spec_rsa_public_key (const char *name, |
284 | struct GNUNET_CRYPTO_rsa_PublicKey **pk); | 284 | struct GNUNET_CRYPTO_RsaPublicKey **pk); |
285 | 285 | ||
286 | 286 | ||
287 | /** | 287 | /** |
@@ -292,7 +292,7 @@ GNUNET_JSON_spec_rsa_public_key (const char *name, | |||
292 | */ | 292 | */ |
293 | struct GNUNET_JSON_Specification | 293 | struct GNUNET_JSON_Specification |
294 | GNUNET_JSON_spec_rsa_signature (const char *name, | 294 | GNUNET_JSON_spec_rsa_signature (const char *name, |
295 | struct GNUNET_CRYPTO_rsa_Signature **sig); | 295 | struct GNUNET_CRYPTO_RsaSignature **sig); |
296 | 296 | ||
297 | 297 | ||
298 | /* ****************** Generic generator interface ******************* */ | 298 | /* ****************** Generic generator interface ******************* */ |
@@ -338,7 +338,7 @@ GNUNET_JSON_from_time_rel (struct GNUNET_TIME_Relative stamp); | |||
338 | * @return corresponding JSON encoding | 338 | * @return corresponding JSON encoding |
339 | */ | 339 | */ |
340 | json_t * | 340 | json_t * |
341 | GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey *pk); | 341 | GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *pk); |
342 | 342 | ||
343 | 343 | ||
344 | /** | 344 | /** |
@@ -348,7 +348,7 @@ GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey *pk); | |||
348 | * @return corresponding JSON encoding | 348 | * @return corresponding JSON encoding |
349 | */ | 349 | */ |
350 | json_t * | 350 | json_t * |
351 | GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_rsa_Signature *sig); | 351 | GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig); |
352 | 352 | ||
353 | 353 | ||
354 | #endif | 354 | #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, | |||
118 | * @param x the query parameter to pass. | 118 | * @param x the query parameter to pass. |
119 | */ | 119 | */ |
120 | struct GNUNET_PQ_QueryParam | 120 | struct GNUNET_PQ_QueryParam |
121 | GNUNET_PQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey *x); | 121 | GNUNET_PQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *x); |
122 | 122 | ||
123 | 123 | ||
124 | /** | 124 | /** |
@@ -128,7 +128,7 @@ GNUNET_PQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey * | |||
128 | * @param x the query parameter to pass | 128 | * @param x the query parameter to pass |
129 | */ | 129 | */ |
130 | struct GNUNET_PQ_QueryParam | 130 | struct GNUNET_PQ_QueryParam |
131 | GNUNET_PQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_rsa_Signature *x); | 131 | GNUNET_PQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x); |
132 | 132 | ||
133 | 133 | ||
134 | /** | 134 | /** |
@@ -330,7 +330,7 @@ GNUNET_PQ_result_spec_variable_size (const char *name, | |||
330 | */ | 330 | */ |
331 | struct GNUNET_PQ_ResultSpec | 331 | struct GNUNET_PQ_ResultSpec |
332 | GNUNET_PQ_result_spec_rsa_public_key (const char *name, | 332 | GNUNET_PQ_result_spec_rsa_public_key (const char *name, |
333 | struct GNUNET_CRYPTO_rsa_PublicKey **rsa); | 333 | struct GNUNET_CRYPTO_RsaPublicKey **rsa); |
334 | 334 | ||
335 | 335 | ||
336 | /** | 336 | /** |
@@ -342,7 +342,7 @@ GNUNET_PQ_result_spec_rsa_public_key (const char *name, | |||
342 | */ | 342 | */ |
343 | struct GNUNET_PQ_ResultSpec | 343 | struct GNUNET_PQ_ResultSpec |
344 | GNUNET_PQ_result_spec_rsa_signature (const char *name, | 344 | GNUNET_PQ_result_spec_rsa_signature (const char *name, |
345 | struct GNUNET_CRYPTO_rsa_Signature **sig); | 345 | struct GNUNET_CRYPTO_RsaSignature **sig); |
346 | 346 | ||
347 | 347 | ||
348 | /** | 348 | /** |
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) | |||
106 | * @return corresponding JSON encoding | 106 | * @return corresponding JSON encoding |
107 | */ | 107 | */ |
108 | json_t * | 108 | json_t * |
109 | GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey *pk) | 109 | GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *pk) |
110 | { | 110 | { |
111 | char *buf; | 111 | char *buf; |
112 | size_t buf_len; | 112 | size_t buf_len; |
@@ -128,7 +128,7 @@ GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey *pk) | |||
128 | * @return corresponding JSON encoding | 128 | * @return corresponding JSON encoding |
129 | */ | 129 | */ |
130 | json_t * | 130 | json_t * |
131 | GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_rsa_Signature *sig) | 131 | GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig) |
132 | { | 132 | { |
133 | char *buf; | 133 | char *buf; |
134 | size_t buf_len; | 134 | 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, | |||
690 | json_t *root, | 690 | json_t *root, |
691 | struct GNUNET_JSON_Specification *spec) | 691 | struct GNUNET_JSON_Specification *spec) |
692 | { | 692 | { |
693 | struct GNUNET_CRYPTO_rsa_PublicKey **pk = spec->ptr; | 693 | struct GNUNET_CRYPTO_RsaPublicKey **pk = spec->ptr; |
694 | const char *enc; | 694 | const char *enc; |
695 | char *buf; | 695 | char *buf; |
696 | size_t len; | 696 | size_t len; |
@@ -736,7 +736,7 @@ static void | |||
736 | clean_rsa_public_key (void *cls, | 736 | clean_rsa_public_key (void *cls, |
737 | struct GNUNET_JSON_Specification *spec) | 737 | struct GNUNET_JSON_Specification *spec) |
738 | { | 738 | { |
739 | struct GNUNET_CRYPTO_rsa_PublicKey **pk = spec->ptr; | 739 | struct GNUNET_CRYPTO_RsaPublicKey **pk = spec->ptr; |
740 | 740 | ||
741 | if (NULL != *pk) | 741 | if (NULL != *pk) |
742 | { | 742 | { |
@@ -754,7 +754,7 @@ clean_rsa_public_key (void *cls, | |||
754 | */ | 754 | */ |
755 | struct GNUNET_JSON_Specification | 755 | struct GNUNET_JSON_Specification |
756 | GNUNET_JSON_spec_rsa_public_key (const char *name, | 756 | GNUNET_JSON_spec_rsa_public_key (const char *name, |
757 | struct GNUNET_CRYPTO_rsa_PublicKey **pk) | 757 | struct GNUNET_CRYPTO_RsaPublicKey **pk) |
758 | { | 758 | { |
759 | struct GNUNET_JSON_Specification ret = { | 759 | struct GNUNET_JSON_Specification ret = { |
760 | .parser = &parse_rsa_public_key, | 760 | .parser = &parse_rsa_public_key, |
@@ -782,7 +782,7 @@ parse_rsa_signature (void *cls, | |||
782 | json_t *root, | 782 | json_t *root, |
783 | struct GNUNET_JSON_Specification *spec) | 783 | struct GNUNET_JSON_Specification *spec) |
784 | { | 784 | { |
785 | struct GNUNET_CRYPTO_rsa_Signature **sig = spec->ptr; | 785 | struct GNUNET_CRYPTO_RsaSignature **sig = spec->ptr; |
786 | size_t size; | 786 | size_t size; |
787 | const char *str; | 787 | const char *str; |
788 | int res; | 788 | int res; |
@@ -828,7 +828,7 @@ static void | |||
828 | clean_rsa_signature (void *cls, | 828 | clean_rsa_signature (void *cls, |
829 | struct GNUNET_JSON_Specification *spec) | 829 | struct GNUNET_JSON_Specification *spec) |
830 | { | 830 | { |
831 | struct GNUNET_CRYPTO_rsa_Signature **sig = spec->ptr; | 831 | struct GNUNET_CRYPTO_RsaSignature **sig = spec->ptr; |
832 | 832 | ||
833 | if (NULL != *sig) | 833 | if (NULL != *sig) |
834 | { | 834 | { |
@@ -846,7 +846,7 @@ clean_rsa_signature (void *cls, | |||
846 | */ | 846 | */ |
847 | struct GNUNET_JSON_Specification | 847 | struct GNUNET_JSON_Specification |
848 | GNUNET_JSON_spec_rsa_signature (const char *name, | 848 | GNUNET_JSON_spec_rsa_signature (const char *name, |
849 | struct GNUNET_CRYPTO_rsa_Signature **sig) | 849 | struct GNUNET_CRYPTO_RsaSignature **sig) |
850 | { | 850 | { |
851 | struct GNUNET_JSON_Specification ret = { | 851 | struct GNUNET_JSON_Specification ret = { |
852 | .parser = &parse_rsa_signature, | 852 | .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 () | |||
150 | static int | 150 | static int |
151 | test_rsa () | 151 | test_rsa () |
152 | { | 152 | { |
153 | struct GNUNET_CRYPTO_rsa_PublicKey *pub; | 153 | struct GNUNET_CRYPTO_RsaPublicKey *pub; |
154 | struct GNUNET_CRYPTO_rsa_PublicKey *pub2; | 154 | struct GNUNET_CRYPTO_RsaPublicKey *pub2; |
155 | struct GNUNET_JSON_Specification pspec[] = { | 155 | struct GNUNET_JSON_Specification pspec[] = { |
156 | GNUNET_JSON_spec_rsa_public_key (NULL, &pub2), | 156 | GNUNET_JSON_spec_rsa_public_key (NULL, &pub2), |
157 | GNUNET_JSON_spec_end() | 157 | GNUNET_JSON_spec_end() |
158 | }; | 158 | }; |
159 | struct GNUNET_CRYPTO_rsa_Signature *sig; | 159 | struct GNUNET_CRYPTO_RsaSignature *sig; |
160 | struct GNUNET_CRYPTO_rsa_Signature *sig2; | 160 | struct GNUNET_CRYPTO_RsaSignature *sig2; |
161 | struct GNUNET_JSON_Specification sspec[] = { | 161 | struct GNUNET_JSON_Specification sspec[] = { |
162 | GNUNET_JSON_spec_rsa_signature (NULL, &sig2), | 162 | GNUNET_JSON_spec_rsa_signature (NULL, &sig2), |
163 | GNUNET_JSON_spec_end() | 163 | GNUNET_JSON_spec_end() |
164 | }; | 164 | }; |
165 | struct GNUNET_CRYPTO_rsa_PrivateKey *priv; | 165 | struct GNUNET_CRYPTO_RsaPrivateKey *priv; |
166 | char msg[] = "Hello"; | 166 | char msg[] = "Hello"; |
167 | json_t *jp; | 167 | json_t *jp; |
168 | json_t *js; | 168 | 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, | |||
265 | void *scratch[], | 265 | void *scratch[], |
266 | unsigned int scratch_length) | 266 | unsigned int scratch_length) |
267 | { | 267 | { |
268 | const struct GNUNET_CRYPTO_rsa_PublicKey *rsa = data; | 268 | const struct GNUNET_CRYPTO_RsaPublicKey *rsa = data; |
269 | char *buf; | 269 | char *buf; |
270 | size_t buf_size; | 270 | size_t buf_size; |
271 | 271 | ||
@@ -290,7 +290,7 @@ qconv_rsa_public_key (void *cls, | |||
290 | * @return array entry for the query parameters to use | 290 | * @return array entry for the query parameters to use |
291 | */ | 291 | */ |
292 | struct GNUNET_PQ_QueryParam | 292 | struct GNUNET_PQ_QueryParam |
293 | GNUNET_PQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_rsa_PublicKey *x) | 293 | GNUNET_PQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *x) |
294 | { | 294 | { |
295 | struct GNUNET_PQ_QueryParam res = | 295 | struct GNUNET_PQ_QueryParam res = |
296 | { &qconv_rsa_public_key, NULL, (x), 0, 1 }; | 296 | { &qconv_rsa_public_key, NULL, (x), 0, 1 }; |
@@ -323,7 +323,7 @@ qconv_rsa_signature (void *cls, | |||
323 | void *scratch[], | 323 | void *scratch[], |
324 | unsigned int scratch_length) | 324 | unsigned int scratch_length) |
325 | { | 325 | { |
326 | const struct GNUNET_CRYPTO_rsa_Signature *sig = data; | 326 | const struct GNUNET_CRYPTO_RsaSignature *sig = data; |
327 | char *buf; | 327 | char *buf; |
328 | size_t buf_size; | 328 | size_t buf_size; |
329 | 329 | ||
@@ -348,7 +348,7 @@ qconv_rsa_signature (void *cls, | |||
348 | * @return array entry for the query parameters to use | 348 | * @return array entry for the query parameters to use |
349 | */ | 349 | */ |
350 | struct GNUNET_PQ_QueryParam | 350 | struct GNUNET_PQ_QueryParam |
351 | GNUNET_PQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_rsa_Signature *x) | 351 | GNUNET_PQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x) |
352 | { | 352 | { |
353 | struct GNUNET_PQ_QueryParam res = | 353 | struct GNUNET_PQ_QueryParam res = |
354 | { &qconv_rsa_signature, NULL, (x), 0, 1 }; | 354 | { &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, | |||
233 | size_t *dst_size, | 233 | size_t *dst_size, |
234 | void *dst) | 234 | void *dst) |
235 | { | 235 | { |
236 | struct GNUNET_CRYPTO_rsa_PublicKey **pk = dst; | 236 | struct GNUNET_CRYPTO_RsaPublicKey **pk = dst; |
237 | size_t len; | 237 | size_t len; |
238 | const char *res; | 238 | const char *res; |
239 | int fnum; | 239 | int fnum; |
@@ -285,7 +285,7 @@ static void | |||
285 | clean_rsa_public_key (void *cls, | 285 | clean_rsa_public_key (void *cls, |
286 | void *rd) | 286 | void *rd) |
287 | { | 287 | { |
288 | struct GNUNET_CRYPTO_rsa_PublicKey **pk = rd; | 288 | struct GNUNET_CRYPTO_RsaPublicKey **pk = rd; |
289 | 289 | ||
290 | if (NULL != *pk) | 290 | if (NULL != *pk) |
291 | { | 291 | { |
@@ -304,7 +304,7 @@ clean_rsa_public_key (void *cls, | |||
304 | */ | 304 | */ |
305 | struct GNUNET_PQ_ResultSpec | 305 | struct GNUNET_PQ_ResultSpec |
306 | GNUNET_PQ_result_spec_rsa_public_key (const char *name, | 306 | GNUNET_PQ_result_spec_rsa_public_key (const char *name, |
307 | struct GNUNET_CRYPTO_rsa_PublicKey **rsa) | 307 | struct GNUNET_CRYPTO_RsaPublicKey **rsa) |
308 | { | 308 | { |
309 | struct GNUNET_PQ_ResultSpec res = | 309 | struct GNUNET_PQ_ResultSpec res = |
310 | { &extract_rsa_public_key, | 310 | { &extract_rsa_public_key, |
@@ -337,7 +337,7 @@ extract_rsa_signature (void *cls, | |||
337 | size_t *dst_size, | 337 | size_t *dst_size, |
338 | void *dst) | 338 | void *dst) |
339 | { | 339 | { |
340 | struct GNUNET_CRYPTO_rsa_Signature **sig = dst; | 340 | struct GNUNET_CRYPTO_RsaSignature **sig = dst; |
341 | size_t len; | 341 | size_t len; |
342 | const char *res; | 342 | const char *res; |
343 | int fnum; | 343 | int fnum; |
@@ -389,7 +389,7 @@ static void | |||
389 | clean_rsa_signature (void *cls, | 389 | clean_rsa_signature (void *cls, |
390 | void *rd) | 390 | void *rd) |
391 | { | 391 | { |
392 | struct GNUNET_CRYPTO_rsa_Signature **sig = rd; | 392 | struct GNUNET_CRYPTO_RsaSignature **sig = rd; |
393 | 393 | ||
394 | if (NULL != *sig) | 394 | if (NULL != *sig) |
395 | { | 395 | { |
@@ -408,7 +408,7 @@ clean_rsa_signature (void *cls, | |||
408 | */ | 408 | */ |
409 | struct GNUNET_PQ_ResultSpec | 409 | struct GNUNET_PQ_ResultSpec |
410 | GNUNET_PQ_result_spec_rsa_signature (const char *name, | 410 | GNUNET_PQ_result_spec_rsa_signature (const char *name, |
411 | struct GNUNET_CRYPTO_rsa_Signature **sig) | 411 | struct GNUNET_CRYPTO_RsaSignature **sig) |
412 | { | 412 | { |
413 | struct GNUNET_PQ_ResultSpec res = | 413 | struct GNUNET_PQ_ResultSpec res = |
414 | { &extract_rsa_signature, | 414 | { &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) | |||
89 | static int | 89 | static int |
90 | run_queries (PGconn *conn) | 90 | run_queries (PGconn *conn) |
91 | { | 91 | { |
92 | struct GNUNET_CRYPTO_rsa_PublicKey *pub; | 92 | struct GNUNET_CRYPTO_RsaPublicKey *pub; |
93 | struct GNUNET_CRYPTO_rsa_PublicKey *pub2 = NULL; | 93 | struct GNUNET_CRYPTO_RsaPublicKey *pub2 = NULL; |
94 | struct GNUNET_CRYPTO_rsa_Signature *sig; | 94 | struct GNUNET_CRYPTO_RsaSignature *sig; |
95 | struct GNUNET_CRYPTO_rsa_Signature *sig2 = NULL; | 95 | struct GNUNET_CRYPTO_RsaSignature *sig2 = NULL; |
96 | struct GNUNET_TIME_Absolute abs_time = GNUNET_TIME_absolute_get (); | 96 | struct GNUNET_TIME_Absolute abs_time = GNUNET_TIME_absolute_get (); |
97 | struct GNUNET_TIME_Absolute abs_time2; | 97 | struct GNUNET_TIME_Absolute abs_time2; |
98 | struct GNUNET_TIME_Absolute forever = GNUNET_TIME_UNIT_FOREVER_ABS; | 98 | struct GNUNET_TIME_Absolute forever = GNUNET_TIME_UNIT_FOREVER_ABS; |
@@ -101,7 +101,7 @@ run_queries (PGconn *conn) | |||
101 | struct GNUNET_HashCode hc2; | 101 | struct GNUNET_HashCode hc2; |
102 | PGresult *result; | 102 | PGresult *result; |
103 | int ret; | 103 | int ret; |
104 | struct GNUNET_CRYPTO_rsa_PrivateKey *priv; | 104 | struct GNUNET_CRYPTO_RsaPrivateKey *priv; |
105 | char msg[] = "Hello"; | 105 | char msg[] = "Hello"; |
106 | void *msg2; | 106 | void *msg2; |
107 | size_t msg2_len; | 107 | 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 @@ | |||
30 | /** | 30 | /** |
31 | * The private information of an RSA key pair. | 31 | * The private information of an RSA key pair. |
32 | */ | 32 | */ |
33 | struct GNUNET_CRYPTO_rsa_PrivateKey | 33 | struct GNUNET_CRYPTO_RsaPrivateKey |
34 | { | 34 | { |
35 | /** | 35 | /** |
36 | * Libgcrypt S-expression for the RSA private key. | 36 | * Libgcrypt S-expression for the RSA private key. |
@@ -42,7 +42,7 @@ struct GNUNET_CRYPTO_rsa_PrivateKey | |||
42 | /** | 42 | /** |
43 | * The public information of an RSA key pair. | 43 | * The public information of an RSA key pair. |
44 | */ | 44 | */ |
45 | struct GNUNET_CRYPTO_rsa_PublicKey | 45 | struct GNUNET_CRYPTO_RsaPublicKey |
46 | { | 46 | { |
47 | /** | 47 | /** |
48 | * Libgcrypt S-expression for the RSA public key. | 48 | * Libgcrypt S-expression for the RSA public key. |
@@ -54,7 +54,7 @@ struct GNUNET_CRYPTO_rsa_PublicKey | |||
54 | /** | 54 | /** |
55 | * @brief an RSA signature | 55 | * @brief an RSA signature |
56 | */ | 56 | */ |
57 | struct GNUNET_CRYPTO_rsa_Signature | 57 | struct GNUNET_CRYPTO_RsaSignature |
58 | { | 58 | { |
59 | /** | 59 | /** |
60 | * Libgcrypt S-expression for the RSA signature. | 60 | * Libgcrypt S-expression for the RSA signature. |
@@ -140,10 +140,10 @@ key_from_sexp (gcry_mpi_t *array, | |||
140 | * @param len length of the key in bits (i.e. 2048) | 140 | * @param len length of the key in bits (i.e. 2048) |
141 | * @return fresh private key | 141 | * @return fresh private key |
142 | */ | 142 | */ |
143 | struct GNUNET_CRYPTO_rsa_PrivateKey * | 143 | struct GNUNET_CRYPTO_RsaPrivateKey * |
144 | GNUNET_CRYPTO_rsa_private_key_create (unsigned int len) | 144 | GNUNET_CRYPTO_rsa_private_key_create (unsigned int len) |
145 | { | 145 | { |
146 | struct GNUNET_CRYPTO_rsa_PrivateKey *ret; | 146 | struct GNUNET_CRYPTO_RsaPrivateKey *ret; |
147 | gcry_sexp_t s_key; | 147 | gcry_sexp_t s_key; |
148 | gcry_sexp_t s_keyparam; | 148 | gcry_sexp_t s_keyparam; |
149 | 149 | ||
@@ -160,7 +160,7 @@ GNUNET_CRYPTO_rsa_private_key_create (unsigned int len) | |||
160 | GNUNET_assert (0 == | 160 | GNUNET_assert (0 == |
161 | gcry_pk_testkey (s_key)); | 161 | gcry_pk_testkey (s_key)); |
162 | #endif | 162 | #endif |
163 | ret = GNUNET_new (struct GNUNET_CRYPTO_rsa_PrivateKey); | 163 | ret = GNUNET_new (struct GNUNET_CRYPTO_RsaPrivateKey); |
164 | ret->sexp = s_key; | 164 | ret->sexp = s_key; |
165 | return ret; | 165 | return ret; |
166 | } | 166 | } |
@@ -172,7 +172,7 @@ GNUNET_CRYPTO_rsa_private_key_create (unsigned int len) | |||
172 | * @param key pointer to the memory to free | 172 | * @param key pointer to the memory to free |
173 | */ | 173 | */ |
174 | void | 174 | void |
175 | GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_rsa_PrivateKey *key) | 175 | GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key) |
176 | { | 176 | { |
177 | gcry_sexp_release (key->sexp); | 177 | gcry_sexp_release (key->sexp); |
178 | GNUNET_free (key); | 178 | GNUNET_free (key); |
@@ -188,7 +188,7 @@ GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_rsa_PrivateKey *key) | |||
188 | * @return size of memory allocated in @a buffer | 188 | * @return size of memory allocated in @a buffer |
189 | */ | 189 | */ |
190 | size_t | 190 | size_t |
191 | GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, | 191 | GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_RsaPrivateKey *key, |
192 | char **buffer) | 192 | char **buffer) |
193 | { | 193 | { |
194 | size_t n; | 194 | size_t n; |
@@ -217,12 +217,12 @@ GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_rsa_PrivateKey | |||
217 | * @param len the length of the data in @a buf | 217 | * @param len the length of the data in @a buf |
218 | * @return NULL on error | 218 | * @return NULL on error |
219 | */ | 219 | */ |
220 | struct GNUNET_CRYPTO_rsa_PrivateKey * | 220 | struct GNUNET_CRYPTO_RsaPrivateKey * |
221 | GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, | 221 | GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, |
222 | size_t len) | 222 | size_t len) |
223 | { | 223 | { |
224 | struct GNUNET_CRYPTO_rsa_PrivateKey *key; | 224 | struct GNUNET_CRYPTO_RsaPrivateKey *key; |
225 | key = GNUNET_new (struct GNUNET_CRYPTO_rsa_PrivateKey); | 225 | key = GNUNET_new (struct GNUNET_CRYPTO_RsaPrivateKey); |
226 | if (0 != | 226 | if (0 != |
227 | gcry_sexp_new (&key->sexp, | 227 | gcry_sexp_new (&key->sexp, |
228 | buf, | 228 | buf, |
@@ -251,10 +251,10 @@ GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, | |||
251 | * @param priv the private key | 251 | * @param priv the private key |
252 | * @retur NULL on error, otherwise the public key | 252 | * @retur NULL on error, otherwise the public key |
253 | */ | 253 | */ |
254 | struct GNUNET_CRYPTO_rsa_PublicKey * | 254 | struct GNUNET_CRYPTO_RsaPublicKey * |
255 | GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_rsa_PrivateKey *priv) | 255 | GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_RsaPrivateKey *priv) |
256 | { | 256 | { |
257 | struct GNUNET_CRYPTO_rsa_PublicKey *pub; | 257 | struct GNUNET_CRYPTO_RsaPublicKey *pub; |
258 | gcry_mpi_t ne[2]; | 258 | gcry_mpi_t ne[2]; |
259 | int rc; | 259 | int rc; |
260 | gcry_sexp_t result; | 260 | gcry_sexp_t result; |
@@ -276,7 +276,7 @@ GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_rsa_Private | |||
276 | ne[1]); | 276 | ne[1]); |
277 | gcry_mpi_release (ne[0]); | 277 | gcry_mpi_release (ne[0]); |
278 | gcry_mpi_release (ne[1]); | 278 | gcry_mpi_release (ne[1]); |
279 | pub = GNUNET_new (struct GNUNET_CRYPTO_rsa_PublicKey); | 279 | pub = GNUNET_new (struct GNUNET_CRYPTO_RsaPublicKey); |
280 | pub->sexp = result; | 280 | pub->sexp = result; |
281 | return pub; | 281 | return pub; |
282 | } | 282 | } |
@@ -288,7 +288,7 @@ GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_rsa_Private | |||
288 | * @param key pointer to the memory to free | 288 | * @param key pointer to the memory to free |
289 | */ | 289 | */ |
290 | void | 290 | void |
291 | GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_rsa_PublicKey *key) | 291 | GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_RsaPublicKey *key) |
292 | { | 292 | { |
293 | gcry_sexp_release (key->sexp); | 293 | gcry_sexp_release (key->sexp); |
294 | GNUNET_free (key); | 294 | GNUNET_free (key); |
@@ -304,7 +304,7 @@ GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_rsa_PublicKey *key) | |||
304 | * @return size of memory allocated in @a buffer | 304 | * @return size of memory allocated in @a buffer |
305 | */ | 305 | */ |
306 | size_t | 306 | size_t |
307 | GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_rsa_PublicKey *key, | 307 | GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_RsaPublicKey *key, |
308 | char **buffer) | 308 | char **buffer) |
309 | { | 309 | { |
310 | size_t n; | 310 | size_t n; |
@@ -332,7 +332,7 @@ GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_rsa_PublicKey *k | |||
332 | * @param hc where to store the hash code | 332 | * @param hc where to store the hash code |
333 | */ | 333 | */ |
334 | void | 334 | void |
335 | GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_rsa_PublicKey *key, | 335 | GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_RsaPublicKey *key, |
336 | struct GNUNET_HashCode *hc) | 336 | struct GNUNET_HashCode *hc) |
337 | { | 337 | { |
338 | char *buf; | 338 | char *buf; |
@@ -355,15 +355,15 @@ GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_rsa_PublicKey *key | |||
355 | * @param len the length of the data in @a buf | 355 | * @param len the length of the data in @a buf |
356 | * @return NULL on error | 356 | * @return NULL on error |
357 | */ | 357 | */ |
358 | struct GNUNET_CRYPTO_rsa_PublicKey * | 358 | struct GNUNET_CRYPTO_RsaPublicKey * |
359 | GNUNET_CRYPTO_rsa_public_key_decode (const char *buf, | 359 | GNUNET_CRYPTO_rsa_public_key_decode (const char *buf, |
360 | size_t len) | 360 | size_t len) |
361 | { | 361 | { |
362 | struct GNUNET_CRYPTO_rsa_PublicKey *key; | 362 | struct GNUNET_CRYPTO_RsaPublicKey *key; |
363 | gcry_mpi_t n; | 363 | gcry_mpi_t n; |
364 | int ret; | 364 | int ret; |
365 | 365 | ||
366 | key = GNUNET_new (struct GNUNET_CRYPTO_rsa_PublicKey); | 366 | key = GNUNET_new (struct GNUNET_CRYPTO_RsaPublicKey); |
367 | if (0 != | 367 | if (0 != |
368 | gcry_sexp_new (&key->sexp, | 368 | gcry_sexp_new (&key->sexp, |
369 | buf, | 369 | buf, |
@@ -435,8 +435,8 @@ GNUNET_CRYPTO_rsa_blinding_key_cmp (struct GNUNET_CRYPTO_rsa_BlindingKey *b1, | |||
435 | * @return 0 if the two are equal | 435 | * @return 0 if the two are equal |
436 | */ | 436 | */ |
437 | int | 437 | int |
438 | GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_rsa_Signature *s1, | 438 | GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_RsaSignature *s1, |
439 | struct GNUNET_CRYPTO_rsa_Signature *s2) | 439 | struct GNUNET_CRYPTO_RsaSignature *s2) |
440 | { | 440 | { |
441 | char *b1; | 441 | char *b1; |
442 | char *b2; | 442 | char *b2; |
@@ -468,8 +468,8 @@ GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_rsa_Signature *s1, | |||
468 | * @return 0 if the two are equal | 468 | * @return 0 if the two are equal |
469 | */ | 469 | */ |
470 | int | 470 | int |
471 | GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_rsa_PublicKey *p1, | 471 | GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_RsaPublicKey *p1, |
472 | struct GNUNET_CRYPTO_rsa_PublicKey *p2) | 472 | struct GNUNET_CRYPTO_RsaPublicKey *p2) |
473 | { | 473 | { |
474 | char *b1; | 474 | char *b1; |
475 | char *b2; | 475 | char *b2; |
@@ -501,8 +501,8 @@ GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_rsa_PublicKey *p1, | |||
501 | * @return 0 if the two are equal | 501 | * @return 0 if the two are equal |
502 | */ | 502 | */ |
503 | int | 503 | int |
504 | GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_rsa_PrivateKey *p1, | 504 | GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_RsaPrivateKey *p1, |
505 | struct GNUNET_CRYPTO_rsa_PrivateKey *p2) | 505 | struct GNUNET_CRYPTO_RsaPrivateKey *p2) |
506 | { | 506 | { |
507 | char *b1; | 507 | char *b1; |
508 | char *b2; | 508 | char *b2; |
@@ -533,7 +533,7 @@ GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_rsa_PrivateKey *p1, | |||
533 | * @return length of the key in bits | 533 | * @return length of the key in bits |
534 | */ | 534 | */ |
535 | unsigned int | 535 | unsigned int |
536 | GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_rsa_PublicKey *key) | 536 | GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_RsaPublicKey *key) |
537 | { | 537 | { |
538 | gcry_mpi_t n; | 538 | gcry_mpi_t n; |
539 | int ret; | 539 | int ret; |
@@ -645,27 +645,32 @@ GNUNET_CRYPTO_rsa_blinding_key_decode (const char *buf, | |||
645 | 645 | ||
646 | 646 | ||
647 | /** | 647 | /** |
648 | * Computes a full domain hash seeded by the given public key. | 648 | * Computes a full domain hash seeded by the given public key. |
649 | * This gives a measure of provable security to the Taler exchange | 649 | * This gives a measure of provable security to the Taler exchange |
650 | * against one-more forgery attacks. See: | 650 | * against one-more forgery attacks. See: |
651 | * https://eprint.iacr.org/2001/002.pdf | 651 | * https://eprint.iacr.org/2001/002.pdf |
652 | * http://www.di.ens.fr/~pointche/Documents/Papers/2001_fcA.pdf | 652 | * http://www.di.ens.fr/~pointche/Documents/Papers/2001_fcA.pdf |
653 | * | 653 | * |
654 | * @param[out] r MPI value set to the FDH | ||
654 | * @param hash initial hash of the message to sign | 655 | * @param hash initial hash of the message to sign |
655 | * @param pkey the public key of the signer | 656 | * @param pkey the public key of the signer |
657 | * @param rsize FIXME JEFF | ||
656 | * @return libgcrypt error that to represent an allocation failure | 658 | * @return libgcrypt error that to represent an allocation failure |
657 | */ | 659 | */ |
658 | gcry_error_t | 660 | gcry_error_t |
659 | rsa_full_domain_hash (gcry_mpi_t *r, | 661 | rsa_full_domain_hash (gcry_mpi_t *r, |
660 | const struct GNUNET_HashCode *hash, | 662 | const struct GNUNET_HashCode *hash, |
661 | const struct GNUNET_CRYPTO_rsa_PublicKey *pkey, | 663 | const struct GNUNET_CRYPTO_RsaPublicKey *pkey, |
662 | size_t *rsize) | 664 | size_t *rsize) |
663 | { | 665 | { |
664 | int i,nbits,nhashes; | 666 | unsigned int i; |
667 | unsigned int nbits; | ||
668 | unsigned int nhashes; | ||
665 | gcry_error_t rc; | 669 | gcry_error_t rc; |
666 | char *buf; | 670 | char *buf; |
667 | size_t buf_len; | 671 | size_t buf_len; |
668 | gcry_md_hd_t h,h0; | 672 | gcry_md_hd_t h; |
673 | gcry_md_hd_t h0; | ||
669 | struct GNUNET_HashCode *hs; | 674 | struct GNUNET_HashCode *hs; |
670 | 675 | ||
671 | /* Uncomment the following to debug without using the full domain hash */ | 676 | /* Uncomment the following to debug without using the full domain hash */ |
@@ -675,60 +680,64 @@ rsa_full_domain_hash (gcry_mpi_t *r, | |||
675 | (const unsigned char *)hash, | 680 | (const unsigned char *)hash, |
676 | sizeof(struct GNUNET_HashCode), | 681 | sizeof(struct GNUNET_HashCode), |
677 | rsize); | 682 | rsize); |
678 | return rc; | 683 | return rc; |
679 | */ | 684 | */ |
680 | 685 | ||
681 | nbits = GNUNET_CRYPTO_rsa_public_key_len (pkey); | 686 | nbits = GNUNET_CRYPTO_rsa_public_key_len (pkey); |
682 | // calls gcry_mpi_get_nbits(.. pkey->sexp ..) | ||
683 | if (nbits < 512) | 687 | if (nbits < 512) |
684 | nbits = 512; | 688 | nbits = 512; |
685 | 689 | ||
686 | // Already almost an HMAC since we consume a hash, so no GCRY_MD_FLAG_HMAC. | 690 | /* Already almost an HMAC since we consume a hash, so no GCRY_MD_FLAG_HMAC. */ |
687 | rc = gcry_md_open (&h,GCRY_MD_SHA512,0); | 691 | rc = gcry_md_open (&h, GCRY_MD_SHA512, 0); |
688 | if (0 != rc) return rc; | 692 | if (0 != rc) |
693 | return rc; | ||
689 | 694 | ||
690 | // We seed with the public denomination key as a homage to RSA-PSS by | 695 | // We seed with the public denomination key as a homage to RSA-PSS by |
691 | // Mihir Bellare and Phillip Rogaway. Doing this lowers the degree | 696 | // Mihir Bellare and Phillip Rogaway. Doing this lowers the degree |
692 | // of the hypothetical polyomial-time attack on RSA-KTI created by a | 697 | // of the hypothetical polyomial-time attack on RSA-KTI created by a |
693 | // polynomial-time one-more forgary attack. Yey seeding! | 698 | // polynomial-time one-more forgary attack. Yey seeding! |
694 | buf_len = GNUNET_CRYPTO_rsa_public_key_encode (pkey, &buf); | 699 | buf_len = GNUNET_CRYPTO_rsa_public_key_encode (pkey, &buf); |
695 | gcry_md_write (h, buf,buf_len); | 700 | gcry_md_write (h, buf, buf_len); |
696 | GNUNET_free (buf); | 701 | GNUNET_free (buf); |
697 | 702 | ||
698 | nhashes = (nbits-1) / (8 * sizeof(struct GNUNET_HashCode)) + 1; | 703 | nhashes = (nbits-1) / (8 * sizeof(struct GNUNET_HashCode)) + 1; |
699 | hs = (struct GNUNET_HashCode *)GNUNET_malloc (nhashes * sizeof(struct GNUNET_HashCode)); | 704 | hs = GNUNET_new_array (nhashes, |
700 | for (i=0; i<nhashes; i++) | 705 | struct GNUNET_HashCode); |
706 | for (i=0; i<nhashes; i++) | ||
701 | { | 707 | { |
702 | gcry_md_write (h, hash, sizeof(struct GNUNET_HashCode)); | 708 | gcry_md_write (h, hash, sizeof(struct GNUNET_HashCode)); |
703 | rc = gcry_md_copy (&h0, h); | 709 | rc = gcry_md_copy (&h0, h); |
704 | if (0 != rc) break; | 710 | if (0 != rc) |
711 | { | ||
712 | gcry_md_close (h0); | ||
713 | break; | ||
714 | } | ||
705 | gcry_md_putc (h0, i % 256); | 715 | gcry_md_putc (h0, i % 256); |
706 | // gcry_md_final (&h0); | 716 | memcpy (&hs[i], |
707 | memcpy (&hs[i], | 717 | gcry_md_read (h0, GCRY_MD_SHA512), |
708 | gcry_md_read (h0,GCRY_MD_SHA512), | ||
709 | sizeof(struct GNUNET_HashCode)); | 718 | sizeof(struct GNUNET_HashCode)); |
710 | gcry_md_close (h0); | 719 | gcry_md_close (h0); |
711 | } | 720 | } |
712 | gcry_md_close (h); | 721 | gcry_md_close (h); |
713 | if (0 != rc) { | 722 | if (0 != rc) |
723 | { | ||
714 | GNUNET_free (hs); | 724 | GNUNET_free (hs); |
715 | return rc; | 725 | return rc; |
716 | } | 726 | } |
717 | 727 | ||
718 | rc = gcry_mpi_scan (r, | 728 | rc = gcry_mpi_scan (r, |
719 | GCRYMPI_FMT_USG, | 729 | GCRYMPI_FMT_USG, |
720 | (const unsigned char *)hs, | 730 | (const unsigned char *) hs, |
721 | nhashes * sizeof(struct GNUNET_HashCode), | 731 | nhashes * sizeof(struct GNUNET_HashCode), |
722 | rsize); | 732 | rsize); |
723 | GNUNET_free (hs); | 733 | GNUNET_free (hs); |
724 | if (0 != rc) return rc; | 734 | if (0 != rc) |
735 | return rc; | ||
725 | 736 | ||
726 | // Do not allow *r to exceed n or signatures fail to verify unpredictably. | 737 | // Do not allow *r to exceed n or signatures fail to verify unpredictably. |
727 | // This happening with gcry_mpi_clear_highbit (*r, nbits-1) so maybe | 738 | // This happening with gcry_mpi_clear_highbit (*r, nbits-1) so maybe |
728 | // gcry_mpi_clear_highbit is broken, but setting the highbit sounds good. | 739 | // gcry_mpi_clear_highbit is broken, but setting the highbit sounds good. |
729 | // (void) fprintf (stderr, "%d %d %d",nbits,nhashes, gcry_mpi_get_nbits(*r)); | ||
730 | gcry_mpi_set_highbit (*r, nbits-2); | 740 | gcry_mpi_set_highbit (*r, nbits-2); |
731 | // (void) fprintf (stderr, " %d\n",gcry_mpi_get_nbits(*r)); | ||
732 | return rc; | 741 | return rc; |
733 | } | 742 | } |
734 | 743 | ||
@@ -745,7 +754,7 @@ rsa_full_domain_hash (gcry_mpi_t *r, | |||
745 | size_t | 754 | size_t |
746 | GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, | 755 | GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, |
747 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey, | 756 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey, |
748 | struct GNUNET_CRYPTO_rsa_PublicKey *pkey, | 757 | struct GNUNET_CRYPTO_RsaPublicKey *pkey, |
749 | char **buffer) | 758 | char **buffer) |
750 | { | 759 | { |
751 | gcry_mpi_t data; | 760 | gcry_mpi_t data; |
@@ -767,7 +776,7 @@ GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, | |||
767 | return 0; | 776 | return 0; |
768 | } | 777 | } |
769 | 778 | ||
770 | rc = rsa_full_domain_hash(&data, hash, pkey, &rsize); | 779 | rc = rsa_full_domain_hash (&data, hash, pkey, &rsize); |
771 | if (0 != rc) // Allocation error in libgcrypt | 780 | if (0 != rc) // Allocation error in libgcrypt |
772 | { | 781 | { |
773 | GNUNET_break (0); | 782 | GNUNET_break (0); |
@@ -824,13 +833,14 @@ mpi_to_sexp (gcry_mpi_t value) | |||
824 | * @param value the MPI to sign | 833 | * @param value the MPI to sign |
825 | * @return NULL on error, signature on success | 834 | * @return NULL on error, signature on success |
826 | */ | 835 | */ |
827 | struct GNUNET_CRYPTO_rsa_Signature * | 836 | static struct GNUNET_CRYPTO_RsaSignature * |
828 | rsa_sign_mpi (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, | 837 | rsa_sign_mpi (const struct GNUNET_CRYPTO_RsaPrivateKey *key, |
829 | gcry_mpi_t value) | 838 | gcry_mpi_t value) |
830 | { | 839 | { |
831 | struct GNUNET_CRYPTO_rsa_Signature *sig; | 840 | struct GNUNET_CRYPTO_RsaSignature *sig; |
832 | struct GNUNET_CRYPTO_rsa_PublicKey *public_key; | 841 | struct GNUNET_CRYPTO_RsaPublicKey *public_key; |
833 | gcry_sexp_t data,result; | 842 | gcry_sexp_t data; |
843 | gcry_sexp_t result; | ||
834 | 844 | ||
835 | data = mpi_to_sexp (value); | 845 | data = mpi_to_sexp (value); |
836 | gcry_mpi_release (value); | 846 | gcry_mpi_release (value); |
@@ -851,7 +861,7 @@ rsa_sign_mpi (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, | |||
851 | data, | 861 | data, |
852 | public_key->sexp)) | 862 | public_key->sexp)) |
853 | { | 863 | { |
854 | GNUNET_break (0); | 864 | GNUNET_break (0); |
855 | GNUNET_CRYPTO_rsa_public_key_free (public_key); | 865 | GNUNET_CRYPTO_rsa_public_key_free (public_key); |
856 | gcry_sexp_release (data); | 866 | gcry_sexp_release (data); |
857 | gcry_sexp_release (result); | 867 | gcry_sexp_release (result); |
@@ -861,7 +871,7 @@ rsa_sign_mpi (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, | |||
861 | 871 | ||
862 | /* return signature */ | 872 | /* return signature */ |
863 | gcry_sexp_release (data); | 873 | gcry_sexp_release (data); |
864 | sig = GNUNET_new (struct GNUNET_CRYPTO_rsa_Signature); | 874 | sig = GNUNET_new (struct GNUNET_CRYPTO_RsaSignature); |
865 | sig->sexp = result; | 875 | sig->sexp = result; |
866 | return sig; | 876 | return sig; |
867 | } | 877 | } |
@@ -875,21 +885,21 @@ rsa_sign_mpi (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, | |||
875 | * @param msg_len number of bytes in @a msg to sign | 885 | * @param msg_len number of bytes in @a msg to sign |
876 | * @return NULL on error, signature on success | 886 | * @return NULL on error, signature on success |
877 | */ | 887 | */ |
878 | struct GNUNET_CRYPTO_rsa_Signature * | 888 | struct GNUNET_CRYPTO_RsaSignature * |
879 | GNUNET_CRYPTO_rsa_sign_blinded (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, | 889 | GNUNET_CRYPTO_rsa_sign_blinded (const struct GNUNET_CRYPTO_RsaPrivateKey *key, |
880 | const void *msg, | 890 | const void *msg, |
881 | size_t msg_len) | 891 | size_t msg_len) |
882 | { | 892 | { |
883 | gcry_mpi_t v = NULL; | 893 | gcry_mpi_t v = NULL; |
884 | 894 | ||
885 | GNUNET_assert (0 == | 895 | GNUNET_assert (0 == |
886 | gcry_mpi_scan (&v, | 896 | gcry_mpi_scan (&v, |
887 | GCRYMPI_FMT_USG, | 897 | GCRYMPI_FMT_USG, |
888 | msg, | 898 | msg, |
889 | msg_len, | 899 | msg_len, |
890 | NULL)); | 900 | NULL)); |
891 | 901 | ||
892 | return rsa_sign_mpi (key,v); | 902 | return rsa_sign_mpi (key, v); |
893 | } | 903 | } |
894 | 904 | ||
895 | 905 | ||
@@ -900,11 +910,11 @@ GNUNET_CRYPTO_rsa_sign_blinded (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, | |||
900 | * @param hash the hash of the message to sign | 910 | * @param hash the hash of the message to sign |
901 | * @return NULL on error, signature on success | 911 | * @return NULL on error, signature on success |
902 | */ | 912 | */ |
903 | struct GNUNET_CRYPTO_rsa_Signature * | 913 | struct GNUNET_CRYPTO_RsaSignature * |
904 | GNUNET_CRYPTO_rsa_sign_fdh (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, | 914 | GNUNET_CRYPTO_rsa_sign_fdh (const struct GNUNET_CRYPTO_RsaPrivateKey *key, |
905 | const struct GNUNET_HashCode *hash) | 915 | const struct GNUNET_HashCode *hash) |
906 | { | 916 | { |
907 | struct GNUNET_CRYPTO_rsa_PublicKey *pkey; | 917 | struct GNUNET_CRYPTO_RsaPublicKey *pkey; |
908 | gcry_mpi_t v = NULL; | 918 | gcry_mpi_t v = NULL; |
909 | gcry_error_t rc; | 919 | gcry_error_t rc; |
910 | 920 | ||
@@ -923,7 +933,7 @@ GNUNET_CRYPTO_rsa_sign_fdh (const struct GNUNET_CRYPTO_rsa_PrivateKey *key, | |||
923 | * @param sig memory to freee | 933 | * @param sig memory to freee |
924 | */ | 934 | */ |
925 | void | 935 | void |
926 | GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_rsa_Signature *sig) | 936 | GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_RsaSignature *sig) |
927 | { | 937 | { |
928 | gcry_sexp_release (sig->sexp); | 938 | gcry_sexp_release (sig->sexp); |
929 | GNUNET_free (sig); | 939 | GNUNET_free (sig); |
@@ -938,7 +948,7 @@ GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_rsa_Signature *sig) | |||
938 | * @return size of memory allocated in @a buffer | 948 | * @return size of memory allocated in @a buffer |
939 | */ | 949 | */ |
940 | size_t | 950 | size_t |
941 | GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_rsa_Signature *sig, | 951 | GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_RsaSignature *sig, |
942 | char **buffer) | 952 | char **buffer) |
943 | { | 953 | { |
944 | size_t n; | 954 | size_t n; |
@@ -967,15 +977,15 @@ GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_rsa_Signature *si | |||
967 | * @param len the length of the data in @a buf | 977 | * @param len the length of the data in @a buf |
968 | * @return NULL on error | 978 | * @return NULL on error |
969 | */ | 979 | */ |
970 | struct GNUNET_CRYPTO_rsa_Signature * | 980 | struct GNUNET_CRYPTO_RsaSignature * |
971 | GNUNET_CRYPTO_rsa_signature_decode (const char *buf, | 981 | GNUNET_CRYPTO_rsa_signature_decode (const char *buf, |
972 | size_t len) | 982 | size_t len) |
973 | { | 983 | { |
974 | struct GNUNET_CRYPTO_rsa_Signature *sig; | 984 | struct GNUNET_CRYPTO_RsaSignature *sig; |
975 | int ret; | 985 | int ret; |
976 | gcry_mpi_t s; | 986 | gcry_mpi_t s; |
977 | 987 | ||
978 | sig = GNUNET_new (struct GNUNET_CRYPTO_rsa_Signature); | 988 | sig = GNUNET_new (struct GNUNET_CRYPTO_RsaSignature); |
979 | if (0 != | 989 | if (0 != |
980 | gcry_sexp_new (&sig->sexp, | 990 | gcry_sexp_new (&sig->sexp, |
981 | buf, | 991 | buf, |
@@ -1009,10 +1019,10 @@ GNUNET_CRYPTO_rsa_signature_decode (const char *buf, | |||
1009 | * @param key the public key to duplicate | 1019 | * @param key the public key to duplicate |
1010 | * @return the duplicate key; NULL upon error | 1020 | * @return the duplicate key; NULL upon error |
1011 | */ | 1021 | */ |
1012 | struct GNUNET_CRYPTO_rsa_PublicKey * | 1022 | struct GNUNET_CRYPTO_RsaPublicKey * |
1013 | GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_rsa_PublicKey *key) | 1023 | GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_RsaPublicKey *key) |
1014 | { | 1024 | { |
1015 | struct GNUNET_CRYPTO_rsa_PublicKey *dup; | 1025 | struct GNUNET_CRYPTO_RsaPublicKey *dup; |
1016 | gcry_sexp_t dup_sexp; | 1026 | gcry_sexp_t dup_sexp; |
1017 | size_t erroff; | 1027 | size_t erroff; |
1018 | 1028 | ||
@@ -1022,7 +1032,7 @@ GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_rsa_PublicKey *key) | |||
1022 | gcry_sexp_release (dup_sexp); | 1032 | gcry_sexp_release (dup_sexp); |
1023 | /* copy the sexp */ | 1033 | /* copy the sexp */ |
1024 | GNUNET_assert (0 == gcry_sexp_build (&dup_sexp, &erroff, "%S", key->sexp)); | 1034 | GNUNET_assert (0 == gcry_sexp_build (&dup_sexp, &erroff, "%S", key->sexp)); |
1025 | dup = GNUNET_new (struct GNUNET_CRYPTO_rsa_PublicKey); | 1035 | dup = GNUNET_new (struct GNUNET_CRYPTO_RsaPublicKey); |
1026 | dup->sexp = dup_sexp; | 1036 | dup->sexp = dup_sexp; |
1027 | return dup; | 1037 | return dup; |
1028 | } | 1038 | } |
@@ -1038,17 +1048,17 @@ GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_rsa_PublicKey *key) | |||
1038 | * @param pkey the public key of the signer | 1048 | * @param pkey the public key of the signer |
1039 | * @return unblinded signature on success, NULL on error | 1049 | * @return unblinded signature on success, NULL on error |
1040 | */ | 1050 | */ |
1041 | struct GNUNET_CRYPTO_rsa_Signature * | 1051 | struct GNUNET_CRYPTO_RsaSignature * |
1042 | GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_rsa_Signature *sig, | 1052 | GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_RsaSignature *sig, |
1043 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey, | 1053 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey, |
1044 | struct GNUNET_CRYPTO_rsa_PublicKey *pkey) | 1054 | struct GNUNET_CRYPTO_RsaPublicKey *pkey) |
1045 | { | 1055 | { |
1046 | gcry_mpi_t n; | 1056 | gcry_mpi_t n; |
1047 | gcry_mpi_t s; | 1057 | gcry_mpi_t s; |
1048 | gcry_mpi_t r_inv; | 1058 | gcry_mpi_t r_inv; |
1049 | gcry_mpi_t ubsig; | 1059 | gcry_mpi_t ubsig; |
1050 | int ret; | 1060 | int ret; |
1051 | struct GNUNET_CRYPTO_rsa_Signature *sret; | 1061 | struct GNUNET_CRYPTO_RsaSignature *sret; |
1052 | 1062 | ||
1053 | ret = key_from_sexp (&n, pkey->sexp, "public-key", "n"); | 1063 | ret = key_from_sexp (&n, pkey->sexp, "public-key", "n"); |
1054 | if (0 != ret) | 1064 | if (0 != ret) |
@@ -1085,7 +1095,7 @@ GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_rsa_Signature *sig, | |||
1085 | gcry_mpi_release (r_inv); | 1095 | gcry_mpi_release (r_inv); |
1086 | gcry_mpi_release (s); | 1096 | gcry_mpi_release (s); |
1087 | 1097 | ||
1088 | sret = GNUNET_new (struct GNUNET_CRYPTO_rsa_Signature); | 1098 | sret = GNUNET_new (struct GNUNET_CRYPTO_RsaSignature); |
1089 | GNUNET_assert (0 == | 1099 | GNUNET_assert (0 == |
1090 | gcry_sexp_build (&sret->sexp, | 1100 | gcry_sexp_build (&sret->sexp, |
1091 | NULL, | 1101 | NULL, |
@@ -1107,8 +1117,8 @@ GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_rsa_Signature *sig, | |||
1107 | */ | 1117 | */ |
1108 | int | 1118 | int |
1109 | GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, | 1119 | GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, |
1110 | const struct GNUNET_CRYPTO_rsa_Signature *sig, | 1120 | const struct GNUNET_CRYPTO_RsaSignature *sig, |
1111 | const struct GNUNET_CRYPTO_rsa_PublicKey *pkey) | 1121 | const struct GNUNET_CRYPTO_RsaPublicKey *pkey) |
1112 | { | 1122 | { |
1113 | gcry_sexp_t data; | 1123 | gcry_sexp_t data; |
1114 | gcry_mpi_t r; | 1124 | gcry_mpi_t r; |
@@ -1142,10 +1152,10 @@ GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, | |||
1142 | * @param key the private key to duplicate | 1152 | * @param key the private key to duplicate |
1143 | * @return the duplicate key; NULL upon error | 1153 | * @return the duplicate key; NULL upon error |
1144 | */ | 1154 | */ |
1145 | struct GNUNET_CRYPTO_rsa_PrivateKey * | 1155 | struct GNUNET_CRYPTO_RsaPrivateKey * |
1146 | GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_rsa_PrivateKey *key) | 1156 | GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_RsaPrivateKey *key) |
1147 | { | 1157 | { |
1148 | struct GNUNET_CRYPTO_rsa_PrivateKey *dup; | 1158 | struct GNUNET_CRYPTO_RsaPrivateKey *dup; |
1149 | gcry_sexp_t dup_sexp; | 1159 | gcry_sexp_t dup_sexp; |
1150 | size_t erroff; | 1160 | size_t erroff; |
1151 | 1161 | ||
@@ -1155,7 +1165,7 @@ GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_rsa_PrivateKey *ke | |||
1155 | gcry_sexp_release (dup_sexp); | 1165 | gcry_sexp_release (dup_sexp); |
1156 | /* copy the sexp */ | 1166 | /* copy the sexp */ |
1157 | GNUNET_assert (0 == gcry_sexp_build (&dup_sexp, &erroff, "%S", key->sexp)); | 1167 | GNUNET_assert (0 == gcry_sexp_build (&dup_sexp, &erroff, "%S", key->sexp)); |
1158 | dup = GNUNET_new (struct GNUNET_CRYPTO_rsa_PrivateKey); | 1168 | dup = GNUNET_new (struct GNUNET_CRYPTO_RsaPrivateKey); |
1159 | dup->sexp = dup_sexp; | 1169 | dup->sexp = dup_sexp; |
1160 | return dup; | 1170 | return dup; |
1161 | } | 1171 | } |
@@ -1167,10 +1177,10 @@ GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_rsa_PrivateKey *ke | |||
1167 | * @param key the private key to duplicate | 1177 | * @param key the private key to duplicate |
1168 | * @return the duplicate key; NULL upon error | 1178 | * @return the duplicate key; NULL upon error |
1169 | */ | 1179 | */ |
1170 | struct GNUNET_CRYPTO_rsa_Signature * | 1180 | struct GNUNET_CRYPTO_RsaSignature * |
1171 | GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_rsa_Signature *sig) | 1181 | GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_RsaSignature *sig) |
1172 | { | 1182 | { |
1173 | struct GNUNET_CRYPTO_rsa_Signature *dup; | 1183 | struct GNUNET_CRYPTO_RsaSignature *dup; |
1174 | gcry_sexp_t dup_sexp; | 1184 | gcry_sexp_t dup_sexp; |
1175 | size_t erroff; | 1185 | size_t erroff; |
1176 | gcry_mpi_t s; | 1186 | gcry_mpi_t s; |
@@ -1184,7 +1194,7 @@ GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_rsa_Signature *sig) | |||
1184 | gcry_mpi_release (s); | 1194 | gcry_mpi_release (s); |
1185 | /* copy the sexp */ | 1195 | /* copy the sexp */ |
1186 | GNUNET_assert (0 == gcry_sexp_build (&dup_sexp, &erroff, "%S", sig->sexp)); | 1196 | GNUNET_assert (0 == gcry_sexp_build (&dup_sexp, &erroff, "%S", sig->sexp)); |
1187 | dup = GNUNET_new (struct GNUNET_CRYPTO_rsa_Signature); | 1197 | dup = GNUNET_new (struct GNUNET_CRYPTO_RsaSignature); |
1188 | dup->sexp = dup_sexp; | 1198 | dup->sexp = dup_sexp; |
1189 | return dup; | 1199 | return dup; |
1190 | } | 1200 | } |
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 | |||
37 | eval (unsigned int len) | 37 | eval (unsigned int len) |
38 | { | 38 | { |
39 | struct GNUNET_TIME_Absolute start; | 39 | struct GNUNET_TIME_Absolute start; |
40 | struct GNUNET_CRYPTO_rsa_Signature *sig; | 40 | struct GNUNET_CRYPTO_RsaSignature *sig; |
41 | struct GNUNET_CRYPTO_rsa_Signature *rsig; | 41 | struct GNUNET_CRYPTO_RsaSignature *rsig; |
42 | struct GNUNET_CRYPTO_rsa_PublicKey *public_key; | 42 | struct GNUNET_CRYPTO_RsaPublicKey *public_key; |
43 | struct GNUNET_CRYPTO_rsa_PrivateKey *private_key; | 43 | struct GNUNET_CRYPTO_RsaPrivateKey *private_key; |
44 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey; | 44 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey; |
45 | unsigned int i; | 45 | unsigned int i; |
46 | char sbuf[128]; | 46 | 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 @@ | |||
29 | gcry_error_t | 29 | gcry_error_t |
30 | rsa_full_domain_hash (gcry_mpi_t *r, | 30 | rsa_full_domain_hash (gcry_mpi_t *r, |
31 | const struct GNUNET_HashCode *hash, | 31 | const struct GNUNET_HashCode *hash, |
32 | const struct GNUNET_CRYPTO_rsa_PublicKey *pkey, | 32 | const struct GNUNET_CRYPTO_RsaPublicKey *pkey, |
33 | size_t *rsize); | 33 | size_t *rsize); |
34 | 34 | ||
35 | 35 | ||
@@ -39,14 +39,14 @@ main (int argc, | |||
39 | { | 39 | { |
40 | #define RND_BLK_SIZE 4096 | 40 | #define RND_BLK_SIZE 4096 |
41 | unsigned char rnd_blk[RND_BLK_SIZE]; | 41 | unsigned char rnd_blk[RND_BLK_SIZE]; |
42 | struct GNUNET_CRYPTO_rsa_PrivateKey *priv; | 42 | struct GNUNET_CRYPTO_RsaPrivateKey *priv; |
43 | struct GNUNET_CRYPTO_rsa_PrivateKey *priv_copy; | 43 | struct GNUNET_CRYPTO_RsaPrivateKey *priv_copy; |
44 | struct GNUNET_CRYPTO_rsa_PublicKey *pub; | 44 | struct GNUNET_CRYPTO_RsaPublicKey *pub; |
45 | struct GNUNET_CRYPTO_rsa_PublicKey *pub_copy; | 45 | struct GNUNET_CRYPTO_RsaPublicKey *pub_copy; |
46 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey; | 46 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey; |
47 | struct GNUNET_CRYPTO_rsa_Signature *sig; | 47 | struct GNUNET_CRYPTO_RsaSignature *sig; |
48 | struct GNUNET_CRYPTO_rsa_Signature *sig_copy; | 48 | struct GNUNET_CRYPTO_RsaSignature *sig_copy; |
49 | struct GNUNET_CRYPTO_rsa_Signature *bsig; | 49 | struct GNUNET_CRYPTO_RsaSignature *bsig; |
50 | struct GNUNET_HashCode hash; | 50 | struct GNUNET_HashCode hash; |
51 | char *blind_buf; | 51 | char *blind_buf; |
52 | size_t bsize; | 52 | size_t bsize; |