Don't leak symbols into static library

Simon Josefsson simon at josefsson.org
Fri Apr 18 09:00:06 CEST 2008


Before patch below:

jas at mocca:~/src/libgcrypt$ nm -B src/.libs/libgcrypt.a |grep ' T '|grep -v gcry|grep -v __
000059c0 T Camellia_DecryptBlock
00005b90 T Camellia_Ekeygen
00005850 T Camellia_EncryptBlock
00003020 T camellia_decrypt128
000049b0 T camellia_decrypt256
00002530 T camellia_encrypt128
00003b10 T camellia_encrypt256
00000000 T camellia_setup128
00005b30 T camellia_setup192
00000f10 T camellia_setup256
00001d30 T ac_data_extract
jas at mocca:~/src/libgcrypt$ 

After patch below:

jas at mocca:~/src/libgcrypt$ nm -B src/.libs/libgcrypt.a |grep ' T '|grep -v gcry|grep -v __
jas at mocca:~/src/libgcrypt$ 

What do you think?

/Simon

Index: cipher/camellia.h
===================================================================
--- cipher/camellia.h	(revision 1283)
+++ cipher/camellia.h	(working copy)
@@ -1,6 +1,6 @@
 /* camellia.h	ver 1.2.0
  *
- * Copyright (C) 2006,2007
+ * Copyright (C) 2006,2007,2008
  * NTT (Nippon Telegraph and Telephone Corporation).
  *
  * This library is free software; you can redistribute it and/or
@@ -28,6 +28,7 @@
  *  
  * This prefixes all external symbols with "foo_".
  */
+#define CAMELLIA_EXT_SYM_PREFIX _gcry_
 #ifdef CAMELLIA_EXT_SYM_PREFIX
 #define CAMELLIA_PREFIX1(x,y) x ## y
 #define CAMELLIA_PREFIX2(x,y) CAMELLIA_PREFIX1(x,y)
Index: cipher/ac.c
===================================================================
--- cipher/ac.c	(revision 1283)
+++ cipher/ac.c	(working copy)
@@ -1,6 +1,6 @@
 /* ac.c - Alternative interface for asymmetric cryptography.
    Copyright (C) 2003, 2004, 2005, 2006
-                 2007  Free Software Foundation, Inc.
+                 2007, 2008  Free Software Foundation, Inc.
  
    This file is part of Libgcrypt.
   
@@ -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)
 {



More information about the Gcrypt-devel mailing list