summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/gl/gettext.h105
-rw-r--r--lib/gl/override/lib/gettext.h.diff112
-rw-r--r--lib/gnutls_hash_int.c6
-rw-r--r--lib/gnutls_hash_int.h5
-rw-r--r--lib/gnutls_state.c9
-rw-r--r--lib/gnutls_str.h12
-rw-r--r--lib/openpgp/output.c10
-rw-r--r--lib/x509/Makefile.am2
-rw-r--r--lib/x509/dn.c2
-rw-r--r--lib/x509/output.c30
-rw-r--r--lib/x509/privkey.c2
11 files changed, 161 insertions, 134 deletions
diff --git a/lib/gl/gettext.h b/lib/gl/gettext.h
index bd214d5cec..a8ca5a4c21 100644
--- a/lib/gl/gettext.h
+++ b/lib/gl/gettext.h
@@ -162,109 +162,4 @@ npgettext_aux (const char *domain,
return translation;
}
-/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
- can be arbitrary expressions. But for string literals these macros are
- less efficient than those above. */
-
-#include <string.h>
-
-#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
- (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
- /* || __STDC_VERSION__ >= 199901L */ )
-
-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
-#include <stdlib.h>
-#endif
-
-#define pgettext_expr(Msgctxt, Msgid) \
- dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
-#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
- dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static const char *
-dcpgettext_expr (const char *domain,
- const char *msgctxt, const char *msgid,
- int category)
-{
- size_t msgctxt_len = strlen (msgctxt) + 1;
- size_t msgid_len = strlen (msgid) + 1;
- const char *translation;
-#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
- char msg_ctxt_id[msgctxt_len + msgid_len];
-#else
- char buf[1024];
- char *msg_ctxt_id =
- (msgctxt_len + msgid_len <= sizeof (buf)
- ? buf
- : (char *) malloc (msgctxt_len + msgid_len));
- if (msg_ctxt_id != NULL)
-#endif
- {
- memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
- msg_ctxt_id[msgctxt_len - 1] = '\004';
- memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
- translation = dcgettext (domain, msg_ctxt_id, category);
-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
- if (msg_ctxt_id != buf)
- free (msg_ctxt_id);
-#endif
- if (translation != msg_ctxt_id)
- return translation;
- }
- return msgid;
-}
-
-#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
- dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
-#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
- dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static const char *
-dcnpgettext_expr (const char *domain,
- const char *msgctxt, const char *msgid,
- const char *msgid_plural, unsigned long int n,
- int category)
-{
- size_t msgctxt_len = strlen (msgctxt) + 1;
- size_t msgid_len = strlen (msgid) + 1;
- const char *translation;
-#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
- char msg_ctxt_id[msgctxt_len + msgid_len];
-#else
- char buf[1024];
- char *msg_ctxt_id =
- (msgctxt_len + msgid_len <= sizeof (buf)
- ? buf
- : (char *) malloc (msgctxt_len + msgid_len));
- if (msg_ctxt_id != NULL)
-#endif
- {
- memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
- msg_ctxt_id[msgctxt_len - 1] = '\004';
- memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
- translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
- if (msg_ctxt_id != buf)
- free (msg_ctxt_id);
-#endif
- if (!(translation == msg_ctxt_id || translation == msgid_plural))
- return translation;
- }
- return (n == 1 ? msgid : msgid_plural);
-}
-
#endif /* _LIBGETTEXT_H */
diff --git a/lib/gl/override/lib/gettext.h.diff b/lib/gl/override/lib/gettext.h.diff
new file mode 100644
index 0000000000..ec8f03fe78
--- /dev/null
+++ b/lib/gl/override/lib/gettext.h.diff
@@ -0,0 +1,112 @@
+--- lib/gl/gettext.h.orig 2008-11-17 17:11:58.000000000 +0100
++++ lib/gl/gettext.h 2008-11-17 17:12:03.000000000 +0100
+@@ -162,109 +162,4 @@
+ return translation;
+ }
+
+-/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
+- can be arbitrary expressions. But for string literals these macros are
+- less efficient than those above. */
+-
+-#include <string.h>
+-
+-#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
+- (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
+- /* || __STDC_VERSION__ >= 199901L */ )
+-
+-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+-#include <stdlib.h>
+-#endif
+-
+-#define pgettext_expr(Msgctxt, Msgid) \
+- dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
+-#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
+- dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
+-
+-#ifdef __GNUC__
+-__inline
+-#else
+-#ifdef __cplusplus
+-inline
+-#endif
+-#endif
+-static const char *
+-dcpgettext_expr (const char *domain,
+- const char *msgctxt, const char *msgid,
+- int category)
+-{
+- size_t msgctxt_len = strlen (msgctxt) + 1;
+- size_t msgid_len = strlen (msgid) + 1;
+- const char *translation;
+-#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+- char msg_ctxt_id[msgctxt_len + msgid_len];
+-#else
+- char buf[1024];
+- char *msg_ctxt_id =
+- (msgctxt_len + msgid_len <= sizeof (buf)
+- ? buf
+- : (char *) malloc (msgctxt_len + msgid_len));
+- if (msg_ctxt_id != NULL)
+-#endif
+- {
+- memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
+- msg_ctxt_id[msgctxt_len - 1] = '\004';
+- memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
+- translation = dcgettext (domain, msg_ctxt_id, category);
+-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+- if (msg_ctxt_id != buf)
+- free (msg_ctxt_id);
+-#endif
+- if (translation != msg_ctxt_id)
+- return translation;
+- }
+- return msgid;
+-}
+-
+-#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
+- dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
+-#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
+- dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
+-
+-#ifdef __GNUC__
+-__inline
+-#else
+-#ifdef __cplusplus
+-inline
+-#endif
+-#endif
+-static const char *
+-dcnpgettext_expr (const char *domain,
+- const char *msgctxt, const char *msgid,
+- const char *msgid_plural, unsigned long int n,
+- int category)
+-{
+- size_t msgctxt_len = strlen (msgctxt) + 1;
+- size_t msgid_len = strlen (msgid) + 1;
+- const char *translation;
+-#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+- char msg_ctxt_id[msgctxt_len + msgid_len];
+-#else
+- char buf[1024];
+- char *msg_ctxt_id =
+- (msgctxt_len + msgid_len <= sizeof (buf)
+- ? buf
+- : (char *) malloc (msgctxt_len + msgid_len));
+- if (msg_ctxt_id != NULL)
+-#endif
+- {
+- memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
+- msg_ctxt_id[msgctxt_len - 1] = '\004';
+- memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
+- translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
+-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+- if (msg_ctxt_id != buf)
+- free (msg_ctxt_id);
+-#endif
+- if (!(translation == msg_ctxt_id || translation == msgid_plural))
+- return translation;
+- }
+- return (n == 1 ? msgid : msgid_plural);
+-}
+-
+ #endif /* _LIBGETTEXT_H */
diff --git a/lib/gnutls_hash_int.c b/lib/gnutls_hash_int.c
index 5ae4e6b1eb..e55ae541e2 100644
--- a/lib/gnutls_hash_int.c
+++ b/lib/gnutls_hash_int.c
@@ -531,9 +531,9 @@ ssl3_md5 (int i, opaque * secret, int secret_len,
}
int
-_gnutls_ssl3_hash_md5 (void *first, int first_len,
- void *second, int second_len, int ret_len,
- opaque * ret)
+_gnutls_ssl3_hash_md5 (const void *first, int first_len,
+ const void *second, int second_len,
+ int ret_len, opaque * ret)
{
opaque digest[MAX_HASH_SIZE];
digest_hd_st td;
diff --git a/lib/gnutls_hash_int.h b/lib/gnutls_hash_int.h
index 8606642e43..8017d12f9a 100644
--- a/lib/gnutls_hash_int.h
+++ b/lib/gnutls_hash_int.h
@@ -83,8 +83,9 @@ int _gnutls_hash_fast( gnutls_digest_algorithm_t algorithm,
int _gnutls_ssl3_generate_random (void *secret, int secret_len,
void *rnd, int random_len, int bytes,
opaque * ret);
-int _gnutls_ssl3_hash_md5 (void *first, int first_len, void *second,
- int second_len, int ret_len, opaque * ret);
+int _gnutls_ssl3_hash_md5 (const void *first, int first_len,
+ const void *second, int second_len,
+ int ret_len, opaque * ret);
void _gnutls_mac_deinit_ssl3_handshake (digest_hd_st* handle, void *digest,
opaque * key, uint32_t key_size);
diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c
index e42d2f66c4..3817ccbbc6 100644
--- a/lib/gnutls_state.c
+++ b/lib/gnutls_state.c
@@ -44,6 +44,15 @@
#include <gnutls_algorithms.h>
#include <gnutls_rsa_export.h>
+/* These should really be static, but src/tests.c calls them. Make
+ them public functions? */
+void
+_gnutls_record_set_default_version (gnutls_session_t session,
+ unsigned char major, unsigned char minor);
+void
+_gnutls_rsa_pms_set_version (gnutls_session_t session,
+ unsigned char major, unsigned char minor);
+
void
_gnutls_session_cert_type_set (gnutls_session_t session,
gnutls_certificate_type_t ct)
diff --git a/lib/gnutls_str.h b/lib/gnutls_str.h
index b5eb31948c..6b84fcae64 100644
--- a/lib/gnutls_str.h
+++ b/lib/gnutls_str.h
@@ -55,7 +55,17 @@ int _gnutls_string_copy_str (gnutls_string * dest, const char *src);
int _gnutls_string_append_str (gnutls_string *, const char *str);
int _gnutls_string_append_data (gnutls_string *, const void *data,
size_t data_size);
-int _gnutls_string_append_printf (gnutls_string * dest, const char *fmt, ...);
+
+
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later. */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
+# define __attribute__(Spec) /* empty */
+# endif
+#endif
+
+int _gnutls_string_append_printf (gnutls_string * dest, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
typedef gnutls_string gnutls_buffer;
diff --git a/lib/openpgp/output.c b/lib/openpgp/output.c
index 027f27ce06..617cf77e83 100644
--- a/lib/openpgp/output.c
+++ b/lib/openpgp/output.c
@@ -186,9 +186,9 @@ print_key_times (gnutls_string * str, gnutls_openpgp_crt_t cert, int idx)
struct tm t;
if (gmtime_r (&tim, &t) == NULL)
- addf (str, "error: gmtime_r (%d)\n", t);
+ addf (str, "error: gmtime_r (%ld)\n", (unsigned long) tim);
else if (strftime (s, max, "%a %b %e %H:%M:%S UTC %Y", &t) == 0)
- addf (str, "error: strftime (%d)\n", t);
+ addf (str, "error: strftime (%ld)\n", (unsigned long) tim);
else
addf (str, _("\t\tCreation: %s\n"), s);
}
@@ -204,14 +204,14 @@ print_key_times (gnutls_string * str, gnutls_openpgp_crt_t cert, int idx)
if (tim == 0)
{
- addf (str, _("\t\tExpiration: Never\n"), s);
+ addf (str, _("\t\tExpiration: Never\n"));
}
else
{
if (gmtime_r (&tim, &t) == NULL)
- addf (str, "error: gmtime_r (%d)\n", t);
+ addf (str, "error: gmtime_r (%ld)\n", (unsigned long) tim);
else if (strftime (s, max, "%a %b %e %H:%M:%S UTC %Y", &t) == 0)
- addf (str, "error: strftime (%d)\n", t);
+ addf (str, "error: strftime (%ld)\n", (unsigned long) tim);
else
addf (str, _("\t\tExpiration: %s\n"), s);
}
diff --git a/lib/x509/Makefile.am b/lib/x509/Makefile.am
index d0337b2459..42039db7c9 100644
--- a/lib/x509/Makefile.am
+++ b/lib/x509/Makefile.am
@@ -18,8 +18,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA
+AM_CFLAGS = $(WARN_CFLAGS)
AM_CPPFLAGS = \
- $(WARN_CFLAGS) \
-I$(srcdir)/../gl \
-I$(builddir)/../gl \
-I$(srcdir)/../includes \
diff --git a/lib/x509/dn.c b/lib/x509/dn.c
index c8d99594a0..e714b3298e 100644
--- a/lib/x509/dn.c
+++ b/lib/x509/dn.c
@@ -673,7 +673,7 @@ _gnutls_x509_encode_and_write_attribute (const char *given_oid,
if ((result = _gnutls_x509_oid_data_choice (given_oid)) > 0)
{
- char *string_type;
+ const char *string_type;
int i;
string_type = "printableString";
diff --git a/lib/x509/output.c b/lib/x509/output.c
index 08f51f3339..a8e40c94be 100644
--- a/lib/x509/output.c
+++ b/lib/x509/output.c
@@ -41,7 +41,7 @@
#define addf _gnutls_string_append_printf
#define adds _gnutls_string_append_str
-#define ERROR_STR "(error)"
+#define ERROR_STR (char*) "(error)"
static void
hexdump (gnutls_string * str, const char *data, size_t len, const char *spc)
@@ -940,9 +940,9 @@ print_cert (gnutls_string * str, gnutls_x509_crt_t cert, int notsigned)
struct tm t;
if (gmtime_r (&tim, &t) == NULL)
- addf (str, "error: gmtime_r (%d)\n", t);
+ addf (str, "error: gmtime_r (%ld)\n", (unsigned long) tim);
else if (strftime (s, max, "%a %b %d %H:%M:%S UTC %Y", &t) == 0)
- addf (str, "error: strftime (%d)\n", t);
+ addf (str, "error: strftime (%ld)\n", (unsigned long) tim);
else
addf (str, _("\t\tNot Before: %s\n"), s);
}
@@ -954,9 +954,9 @@ print_cert (gnutls_string * str, gnutls_x509_crt_t cert, int notsigned)
struct tm t;
if (gmtime_r (&tim, &t) == NULL)
- addf (str, "error: gmtime_r (%d)\n", t);
+ addf (str, "error: gmtime_r (%ld)\n", (unsigned long) tim);
else if (strftime (s, max, "%a %b %d %H:%M:%S UTC %Y", &t) == 0)
- addf (str, "error: strftime (%d)\n", t);
+ addf (str, "error: strftime (%ld)\n", (unsigned long) tim);
else
addf (str, _("\t\tNot After: %s\n"), s);
}
@@ -1233,9 +1233,9 @@ print_oneline (gnutls_string * str, gnutls_x509_crt_t cert)
struct tm t;
if (gmtime_r (&tim, &t) == NULL)
- addf (str, "unknown activation (%d), ", t);
+ addf (str, "unknown activation (%ld), ", (unsigned long) tim);
else if (strftime (s, max, "%Y-%m-%d %H:%M:%S UTC", &t) == 0)
- addf (str, "failed activation (%d), ", t);
+ addf (str, "failed activation (%ld), ", (unsigned long) tim);
else
addf (str, "activated `%s', ", s);
}
@@ -1247,9 +1247,9 @@ print_oneline (gnutls_string * str, gnutls_x509_crt_t cert)
struct tm t;
if (gmtime_r (&tim, &t) == NULL)
- addf (str, "unknown expiry (%d), ", t);
+ addf (str, "unknown expiry (%ld), ", (unsigned long) tim);
else if (strftime (s, max, "%Y-%m-%d %H:%M:%S UTC", &t) == 0)
- addf (str, "failed expiry (%d), ", t);
+ addf (str, "failed expiry (%ld), ", (unsigned long) tim);
else
addf (str, "expires `%s', ", s);
}
@@ -1405,9 +1405,9 @@ print_crl (gnutls_string * str, gnutls_x509_crl_t crl, int notsigned)
struct tm t;
if (gmtime_r (&tim, &t) == NULL)
- addf (str, "error: gmtime_r (%d)\n", t);
+ addf (str, "error: gmtime_r (%ld)\n", (unsigned long) tim);
else if (strftime (s, max, "%a %b %d %H:%M:%S UTC %Y", &t) == 0)
- addf (str, "error: strftime (%d)\n", t);
+ addf (str, "error: strftime (%ld)\n", (unsigned long) tim);
else
addf (str, _("\t\tIssued: %s\n"), s);
}
@@ -1421,9 +1421,9 @@ print_crl (gnutls_string * str, gnutls_x509_crl_t crl, int notsigned)
if (tim == -1)
addf (str, "\t\tNo next update time.\n");
else if (gmtime_r (&tim, &t) == NULL)
- addf (str, "error: gmtime_r (%d)\n", t);
+ addf (str, "error: gmtime_r (%ld)\n", (unsigned long) tim);
else if (strftime (s, max, "%a %b %d %H:%M:%S UTC %Y", &t) == 0)
- addf (str, "error: strftime (%d)\n", t);
+ addf (str, "error: strftime (%ld)\n", (unsigned long) tim);
else
addf (str, _("\t\tNext at: %s\n"), s);
}
@@ -1582,9 +1582,9 @@ print_crl (gnutls_string * str, gnutls_x509_crl_t crl, int notsigned)
adds (str, "\n");
if (gmtime_r (&tim, &t) == NULL)
- addf (str, "error: gmtime_r (%d)\n", t);
+ addf (str, "error: gmtime_r (%ld)\n", (unsigned long) tim);
else if (strftime (s, max, "%a %b %d %H:%M:%S UTC %Y", &t) == 0)
- addf (str, "error: strftime (%d)\n", t);
+ addf (str, "error: strftime (%ld)\n", (unsigned long) tim);
else
addf (str, _("\t\tRevoked at: %s\n"), s);
}
diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c
index 53e2f28b7d..3e5c75f5f0 100644
--- a/lib/x509/privkey.c
+++ b/lib/x509/privkey.c
@@ -684,7 +684,7 @@ gnutls_x509_privkey_export (gnutls_x509_privkey_t key,
gnutls_x509_crt_fmt_t format, void *output_data,
size_t * output_data_size)
{
- char *msg;
+ const char *msg;
int ret;
if (key == NULL)