diff --git a/aes-internal.h b/aes-internal.h index e79c8b9bc9a3d3e9785fe7465b92f1d15b2b415e..2b7f06f7711e34ee20ea58a03d70d740d974d601 100644 --- a/aes-internal.h +++ b/aes-internal.h @@ -39,6 +39,19 @@ # define AES_TABLE_SIZE 4 #endif +/* Name mangling */ +#define _aes_crypt _nettle_aes_crypt + +/* Assembler code using the table should get link errors if linked + * against a small table. */ +#if AES_SMALL +# define _aes_encrypt_table _nettle_aes_encrypt_table_small +# define _aes_decrypt_table _nettle_aes_decrypt_table_small +#else +# define _aes_encrypt_table _nettle_aes_encrypt_table +# define _aes_decrypt_table _nettle_aes_decrypt_table +#endif + struct aes_table { uint8_t sbox[0x100]; @@ -70,13 +83,6 @@ _aes_crypt(const struct aes_ctx *ctx, ((box)[(((x) >> 16) & 0xff)] << 16) | \ ((box)[(((x) >> 24) & 0xff)] << 24)) -/* Assembler code using the table should get link errors when compiled - * against a small table. */ -#if AES_SMALL -# define _aes_encrypt_table _aes_encrypt_table_small -# define _aes_decrypt_table _aes_decrypt_table_small -#endif - /* Internal tables */ extern const struct aes_table _aes_encrypt_table; extern const struct aes_table _aes_decrypt_table; diff --git a/aes.h b/aes.h index b505b0e752d53875fec80e2e4b800ef8239ac821..87464cf48022ecaaebd8b938d71351bf180c3a8a 100644 --- a/aes.h +++ b/aes.h @@ -28,6 +28,12 @@ #include <inttypes.h> +/* Name mangling */ +#define aes_set_encrypt_key nettle_aes_set_encrypt_key +#define aes_set_decrypt_key nettle_aes_set_decrypt_key +#define aes_encrypt nettle_aes_encrypt +#define aes_decrypt nettle_aes_decrypt + #define AES_BLOCK_SIZE 16 /* Variable key size between 128 and 256 bits. But the only valid diff --git a/arcfour.h b/arcfour.h index 54aee4790d4dbe181b361f418b0c8f3db3429cf3..9499e981305cff1d5ead7d040ec79d6148b79643 100644 --- a/arcfour.h +++ b/arcfour.h @@ -28,6 +28,11 @@ #include <inttypes.h> +/* Name mangling */ +#define arcfour_set_key nettle_arcfour_set_key +#define arcfour_crypt nettle_arcfour_crypt +#define arcfour_stream nettle_arcfour_stream + /* Minimum and maximum keysizes, and a reasonable default. In * octets.*/ #define ARCFOUR_MIN_KEY_SIZE 1 diff --git a/base16.h b/base16.h index b00bc86930f57f74cbeabe5e5e052981acfac038..2701725b659691baf8b15e22770632d88b0e97fb 100644 --- a/base16.h +++ b/base16.h @@ -29,6 +29,13 @@ #include <inttypes.h> +/* Name mangling */ +#define base16_encode_single nettle_base16_encode_single +#define base16_encode_update nettle_base16_encode_update +#define base16_decode_init nettle_base16_decode_init +#define base16_decode_single nettle_base16_decode_single +#define base16_decode_update nettle_base16_decode_update +#define base16_decode_final nettle_base16_decode_final /* Base16 encoding */ diff --git a/base64.h b/base64.h index 9532e54fd0897a3c172ee704e4d6a0cba0e72a47..1e1c7ed52e3523dcd294c2fafbfffbf7ea8ef5bf 100644 --- a/base64.h +++ b/base64.h @@ -28,6 +28,17 @@ #include <inttypes.h> +/* Name mangling */ +#define base64_encode_init nettle_base64_encode_init +#define base64_encode_single nettle_base64_encode_single +#define base64_encode_update nettle_base64_encode_update +#define base64_encode_final nettle_base64_encode_final +#define base64_encode_raw nettle_base64_encode_raw +#define base64_encode_group nettle_base64_encode_group +#define base64_decode_init nettle_base64_decode_init +#define base64_decode_single nettle_base64_decode_single +#define base64_decode_update nettle_base64_decode_update +#define base64_decode_final nettle_base64_decode_final #define BASE64_BINARY_BLOCK_SIZE 3 #define BASE64_TEXT_BLOCK_SIZE 4 diff --git a/blowfish.h b/blowfish.h index 72934da5a54756c0a9c7bd99247e99412207c1a3..7f7ddcd67246318efc323b93d7d9e3528102d203 100644 --- a/blowfish.h +++ b/blowfish.h @@ -28,6 +28,11 @@ #include <inttypes.h> +/* Name mangling */ +#define blowfish_set_key nettle_blowfish_set_key +#define blowfish_encrypt nettle_blowfish_encrypt +#define blowfish_decrypt nettle_blowfish_decrypt + #define BLOWFISH_BLOCK_SIZE 8 /* Variable key size between 64 and 448 bits. */ diff --git a/cast128.h b/cast128.h index 0d1e044e41f48de071a374fe1f4d90073d80ae67..39102cbcaf057bce2797b82ddda61df09bf9373a 100644 --- a/cast128.h +++ b/cast128.h @@ -34,6 +34,11 @@ #include <inttypes.h> +/* Name mangling */ +#define cast128_set_key nettle_cast128_set_key +#define cast128_encrypt nettle_cast128_encrypt +#define cast128_decrypt nettle_cast128_decrypt + #define CAST128_BLOCK_SIZE 8 /* Variable key size between 40 and 128. */ diff --git a/cbc.h b/cbc.h index dba52fdd8d36e925f80bbd1756c8d16c2afb3493..9428aa554f7102655f5b88a5ed85c7e58e654acf 100644 --- a/cbc.h +++ b/cbc.h @@ -28,6 +28,10 @@ #include <inttypes.h> +/* Name mangling */ +#define cbc_encrypt nettle_cbc_encrypt +#define cbc_decrypt nettle_cbc_decrypt + /* Uses a void * for cipher contexts. */ void diff --git a/des.h b/des.h index 9f674736a5a9b9297322881727b8f648d1922946..25168d11a5d5e4653c667642f44560efe4a46cfb 100644 --- a/des.h +++ b/des.h @@ -35,15 +35,16 @@ #ifndef NETTLE_DES_H_INCLUDED #define NETTLE_DES_H_INCLUDED -/* Namespace mangling. - * - * FIXME: In the long run, all nettle symbols should probably have the - * prefix nettle_, with the appropriate header file defining - * shorthands. */ +#include <inttypes.h> +/* Namespace mangling */ #define des_set_key nettle_des_set_key - -#include <inttypes.h> +#define des_encrypt nettle_des_encrypt +#define des_decrypt nettle_des_decrypt +#define des_fix_parity nettle_des_fix_parity +#define des3_set_key nettle_des3_set_key +#define des3_encrypt nettle_des3_encrypt +#define des3_decrypt nettle_des3_decrypt #define DES_KEY_SIZE 8 #define DES_BLOCK_SIZE 8 diff --git a/dsa.h b/dsa.h index 5214c36a67e44b1ed61be55debaee2fee3a9ee6e..15de1e1af65574aa242192d5afb4b2e7fb36fd1d 100644 --- a/dsa.h +++ b/dsa.h @@ -34,6 +34,22 @@ /* For nettle_random_func */ #include "nettle-meta.h" +/* Name mangling */ +#define dsa_public_key_init nettle_dsa_public_key_init +#define dsa_public_key_clear nettle_dsa_public_key_clear +#define dsa_private_key_init nettle_dsa_private_key_init +#define dsa_private_key_clear nettle_dsa_private_key_clear +#define dsa_signature_init nettle_dsa_signature_init +#define dsa_signature_clear nettle_dsa_signature_clear +#define dsa_sign nettle_dsa_sign +#define dsa_verify nettle_dsa_verify +#define dsa_sign_digest nettle_dsa_sign_digest +#define dsa_verify_digest nettle_dsa_verify_digest +#define dsa_generate_keypair nettle_dsa_generate_keypair +#define dsa_signature_from_sexp nettle_dsa_signature_from_sexp +#define dsa_keypair_from_sexp_alist nettle_dsa_keypair_from_sexp_alist +#define dsa_keypair_from_sexp nettle_dsa_keypair_from_sexp + #define DSA_MIN_P_BITS 512 #define DSA_Q_OCTETS 20 #define DSA_Q_BITS 160 diff --git a/hmac.h b/hmac.h index cc425ae4f7a999b444f16a819068a423c8c1008e..a89fb2ee6f84355de789fb0d497fc5847574edc5 100644 --- a/hmac.h +++ b/hmac.h @@ -31,7 +31,19 @@ #include "md5.h" #include "sha.h" -#include <inttypes.h> +/* Namespace mangling */ +#define hmac_set_key nettle_hmac_set_key +#define hmac_update nettle_hmac_update +#define hmac_digest nettle_hmac_digest +#define hmac_md5_set_key nettle_hmac_md5_set_key +#define hmac_md5_update nettle_hmac_md5_update +#define hmac_md5_digest nettle_hmac_md5_digest +#define hmac_sha1_set_key nettle_hmac_sha1_set_key +#define hmac_sha1_update nettle_hmac_sha1_update +#define hmac_sha1_digest nettle_hmac_sha1_digest +#define hmac_sha256_set_key nettle_hmac_sha256_set_key +#define hmac_sha256_update nettle_hmac_sha256_update +#define hmac_sha256_digest nettle_hmac_sha256_digest void hmac_set_key(void *outer, void *inner, void *state, diff --git a/knuth-lfib.h b/knuth-lfib.h index 8ca45a71b8a008546e4a742d8a14f70d8232cdf6..c8a1f93aac45a2b6740d4e84af32b1695d582df1 100644 --- a/knuth-lfib.h +++ b/knuth-lfib.h @@ -33,6 +33,12 @@ #include <inttypes.h> +/* Namespace mangling */ +#define knuth_lfib_init nettle_knuth_lfib_init +#define knuth_lfib_get nettle_knuth_lfib_get +#define knuth_lfib_get_array nettle_knuth_lfib_get_array +#define knuth_lfib_random nettle_knuth_lfib_random + #define _KNUTH_LFIB_KK 100 struct knuth_lfib_ctx diff --git a/md5-compat.h b/md5-compat.h index bb2e768edc519a116a1897ac48a3b06d8ad99948..32925d09be5ec971159fd7a442c8b7ee6a284556 100644 --- a/md5-compat.h +++ b/md5-compat.h @@ -28,6 +28,11 @@ #include "md5.h" +/* Name mangling */ +#define MD5Init nettle_MD5Init +#define MD5Update nettle_MD5Update +#define MD5Final nettle_MD5Final + typedef struct md5_ctx MD5_CTX; void MD5Init(MD5_CTX *ctx); diff --git a/md5.h b/md5.h index 0859cb3ec75db7fb394a84a97fd8bc9b3ef82f56..95e42c62b4a832de1a6adc1a6e6e3a2dab67beec 100644 --- a/md5.h +++ b/md5.h @@ -28,6 +28,11 @@ #include <inttypes.h> +/* Name mangling */ +#define md5_init nettle_md5_init +#define md5_update nettle_md5_update +#define md5_digest nettle_md5_digest + #define MD5_DIGEST_SIZE 16 #define MD5_DATA_SIZE 64 diff --git a/pgp.h b/pgp.h index b13bafe421e58cfd8dd23772a99ada87d33e0aeb..54a02406b8e29c0aa845664e676561c7154bbf10 100644 --- a/pgp.h +++ b/pgp.h @@ -28,6 +28,21 @@ #include "bignum.h" +/* Name mangling */ +#define pgp_put_uint32 nettle_pgp_put_uint32 +#define pgp_put_uint16 nettle_pgp_put_uint16 +#define pgp_put_mpi nettle_pgp_put_mpi +#define pgp_put_string nettle_pgp_put_string +#define pgp_put_length nettle_pgp_put_length +#define pgp_put_header nettle_pgp_put_header +#define pgp_put_header_length nettle_pgp_put_header_length +#define pgp_sub_packet_start nettle_pgp_sub_packet_start +#define pgp_put_sub_packet nettle_pgp_put_sub_packet +#define pgp_sub_packet_end nettle_pgp_sub_packet_end +#define pgp_put_userid nettle_pgp_put_userid +#define pgp_crc24 nettle_pgp_crc24 +#define pgp_armor nettle_pgp_armor + struct nettle_buffer; int diff --git a/pkcs1.h b/pkcs1.h index 3671f8018c3ea259beb51dbb3efab55c6f3d0403..0db9121f032fe5d46a9ff5f9e95060ca29a9d226 100644 --- a/pkcs1.h +++ b/pkcs1.h @@ -29,6 +29,13 @@ #include <inttypes.h> #include <gmp.h> +/* Name mangling */ +#define pkcs1_signature_prefix nettle_pkcs1_signature_prefix +#define pkcs1_rsa_md5_encode nettle_pkcs1_rsa_md5_encode +#define pkcs1_rsa_md5_encode_digest nettle_pkcs1_rsa_md5_encode_digest +#define pkcs1_rsa_sha1_encode nettle_pkcs1_rsa_sha1_encode +#define pkcs1_rsa_sha1_encode_digest nettle_pkcs1_rsa_sha1_encode_digest + struct md5_ctx; struct sha1_ctx; diff --git a/rsa-compat.h b/rsa-compat.h index ad5c27577bd92025b12959d27fa3c8324fb42c9b..7b40f3cf37c3477ab8264444afc5d84a50b7f5de 100644 --- a/rsa-compat.h +++ b/rsa-compat.h @@ -28,6 +28,14 @@ #include "rsa.h" +/* Name mangling */ +#define R_SignInit nettle_R_SignInit +#define R_SignUpdate nettle_R_SignUpdate +#define R_SignFinal nettle_R_SignFinal +#define R_VerifyInit nettle_R_VerifyInit +#define R_VerifyUpdate nettle_R_VerifyUpdate +#define R_VerifyFinal nettle_R_VerifyFinal + /* 256 octets or 2048 bits */ #define MAX_RSA_MODULUS_LEN 256 diff --git a/rsa.h b/rsa.h index dd5005571629bf7712f9950c9a900acb7d2f5f6e..a924fb2be4c08d835e5bf9369689440e202631da 100644 --- a/rsa.h +++ b/rsa.h @@ -35,6 +35,31 @@ /* For nettle_random_func */ #include "nettle-meta.h" +/* Name mangling */ +#define rsa_public_key_init nettle_rsa_public_key_init +#define rsa_public_key_clear nettle_rsa_public_key_clear +#define rsa_public_key_prepare nettle_rsa_public_key_prepare +#define rsa_private_key_init nettle_rsa_private_key_init +#define rsa_private_key_clear nettle_rsa_private_key_clear +#define rsa_private_key_prepare nettle_rsa_private_key_prepare +#define rsa_md5_sign nettle_rsa_md5_sign +#define rsa_md5_verify nettle_rsa_md5_verify +#define rsa_sha1_sign nettle_rsa_sha1_sign +#define rsa_sha1_verify nettle_rsa_sha1_verify +#define rsa_md5_sign_digest nettle_rsa_md5_sign_digest +#define rsa_md5_verify_digest nettle_rsa_md5_verify_digest +#define rsa_sha1_sign_digest nettle_rsa_sha1_sign_digest +#define rsa_sha1_verify_digest nettle_rsa_sha1_verify_digest +#define rsa_encrypt nettle_rsa_encrypt +#define rsa_decrypt nettle_rsa_decrypt +#define rsa_compute_root nettle_rsa_compute_root +#define rsa_generate_keypair nettle_rsa_generate_keypair +#define rsa_keypair_to_sexp nettle_rsa_keypair_to_sexp +#define rsa_keypair_from_sexp_alist nettle_rsa_keypair_from_sexp_alist +#define rsa_keypair_from_sexp nettle_rsa_keypair_from_sexp +#define rsa_keypair_to_openpgp nettle_rsa_keypair_to_openpgp +#define _rsa_verify _nettle_rsa_verify +#define _rsa_check_size _nettle_rsa_check_size /* For PKCS#1 to make sense, the size of the modulo, in octets, must * be at least 11 + the length of the DER-encoded Digest Info. diff --git a/serpent.h b/serpent.h index ae8afeb7c3040ec3da42eafd5b6b1e672e4b49b0..79cad0ef64cb47768fc5a5d2ba7f33d09adbc3d4 100644 --- a/serpent.h +++ b/serpent.h @@ -33,6 +33,11 @@ #include <inttypes.h> +/* Name mangling */ +#define serpent_set_key nettle_serpent_set_key +#define serpent_encrypt nettle_serpent_encrypt +#define serpent_decrypt nettle_serpent_decrypt + #define SERPENT_BLOCK_SIZE 16 /* Other key lengths are possible, but the design of Serpent makes diff --git a/sexp.h b/sexp.h index 2b72a2be8129b8cc0999af714fe9b4a9af2497fa..181cc57640b404805d43129c0c42a60eabb2453c 100644 --- a/sexp.h +++ b/sexp.h @@ -29,6 +29,23 @@ #include <inttypes.h> #include <stdarg.h> +/* Name mangling */ +#define sexp_iterator_first nettle_sexp_iterator_first +#define sexp_transport_iterator_first nettle_sexp_transport_iterator_first +#define sexp_iterator_next nettle_sexp_iterator_next +#define sexp_iterator_enter_list nettle_sexp_iterator_enter_list +#define sexp_iterator_exit_list nettle_sexp_iterator_exit_list +#define sexp_iterator_subexpr nettle_sexp_iterator_subexpr +#define sexp_iterator_get_uint32 nettle_sexp_iterator_get_uint32 +#define sexp_iterator_check_type nettle_sexp_iterator_check_type +#define sexp_iterator_check_types nettle_sexp_iterator_check_types +#define sexp_iterator_assoc nettle_sexp_iterator_assoc +#define sexp_format nettle_sexp_format +#define sexp_vformat nettle_sexp_vformat +#define sexp_transport_format nettle_sexp_transport_format +#define sexp_transport_vformat nettle_sexp_transport_vformat +#define sexp_token_chars nettle_sexp_token_chars + enum sexp_type { SEXP_ATOM, SEXP_LIST, SEXP_END }; diff --git a/sha.h b/sha.h index f9eb69bdf3de2c064168a07eae18cba2e2c9c822..134de1d57b8fa60404a79a094c2dc1277df78738 100644 --- a/sha.h +++ b/sha.h @@ -28,6 +28,14 @@ #include <inttypes.h> +/* Name mangling */ +#define sha1_init nettle_sha1_init +#define sha1_update nettle_sha1_update +#define sha1_digest nettle_sha1_digest +#define sha256_init nettle_sha256_init +#define sha256_update nettle_sha256_update +#define sha256_digest nettle_sha256_digest + /* SHA1 */ #define SHA1_DIGEST_SIZE 20 diff --git a/twofish.h b/twofish.h index a33554c589c599492fbd5087bbbbc359ed6726ee..3d007d7ab28a10b935782d88c46cd2faf1444de1 100644 --- a/twofish.h +++ b/twofish.h @@ -34,6 +34,11 @@ #include <inttypes.h> +/* Name mangling */ +#define twofish_set_key nettle_twofish_set_key +#define twofish_encrypt nettle_twofish_encrypt +#define twofish_decrypt nettle_twofish_decrypt + #define TWOFISH_BLOCK_SIZE 16 /* Variable key size between 128 and 256 bits. But the only valid diff --git a/yarrow.h b/yarrow.h index 802542db85ab5d51eca9b2c42ea24ecdbf62434b..a83e53d3a7924b570772cd880882d70a493da444 100644 --- a/yarrow.h +++ b/yarrow.h @@ -29,6 +29,17 @@ #include "aes.h" #include "sha.h" +/* Name mangling */ +#define yarrow256_init nettle_yarrow256_init +#define yarrow256_seed nettle_yarrow256_seed +#define yarrow256_update nettle_yarrow256_update +#define yarrow256_random nettle_yarrow256_random +#define yarrow256_is_seeded nettle_yarrow256_is_seeded +#define yarrow256_needed_sources nettle_yarrow256_needed_sources +#define yarrow256_force_reseed nettle_yarrow256_force_reseed +#define yarrow_key_event_init nettle_yarrow_key_event_init +#define yarrow_key_event_estimate nettle_yarrow_key_event_estimate + enum yarrow_pool_id { YARROW_FAST = 0, YARROW_SLOW = 1 }; struct yarrow_source