Don't leak symbols into static library

Simon Josefsson simon at josefsson.org
Fri Apr 18 11:20:49 CEST 2008


Werner Koch <wk at gnupg.org> writes:

>> Index: cipher/ac.c
>> @@ -1117,7 +1117,7 @@
>>  
>>     (IDENTIFIER [...]
>>     (ALGORITHM <list of named MPI values>)) */
>> -gcry_error_t
>> +static gcry_error_t
>>  ac_data_extract (const char *identifier, const char *algorithm,
>>  		 gcry_sexp_t sexp, gcry_ac_data_t *data)
>
>
> What is the reasons for this?

The same as for the camellia change: the 'ac_data_extract' function is
exported to the static library.  As far as I could tell, the function is
only ever called from the same file it is defined in:

jas at mocca:~/src/libgcrypt$ rgrep ac_data_extract *|grep -v .svn
cipher/ac.c:ac_data_extract (const char *identifier, const char *algorithm,
cipher/ac.c:  err = ac_data_extract ("private-key", handle->algorithm_name,
cipher/ac.c:  err = ac_data_extract ("public-key", handle->algorithm_name,
cipher/ac.c:  err = ac_data_extract ("enc-val", handle->algorithm_name,
cipher/ac.c:  err = ac_data_extract ("sig-val", handle->algorithm_name,
Binary file cipher/.libs/libcipher.a matches
Binary file cipher/.libs/ac.o matches
cipher/ChangeLog:	(ac_data_extract): Use GCRY_AC_FLAG_DEALLOC instead of
Binary file cipher/ac.o matches
Binary file src/.libs/libgcrypt.so.11 matches
Binary file src/.libs/libgcrypt.so.11.4.3 matches
Binary file src/.libs/libgcrypt.a matches
Binary file src/.libs/libgcrypt.so matches
jas at mocca:~/src/libgcrypt$ 

Thus, I think it should be marked as 'static'.

Note that it is not mentioned in the *.def file, so for shared libraries
you can't use the function anyway.

/Simon



More information about the Gcrypt-devel mailing list