summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2001-12-19 13:17:00 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2001-12-19 13:17:00 +0000
commit81d821cd5819aef7d3ea68c30b5d4d18e806faf1 (patch)
tree76c3c2dec862a0cb12efa326daf80d28b3f7cc90
parent3bc76b218eae9adc7bb235c7aabeb4b0fb0fecac (diff)
downloadgnutls-81d821cd5819aef7d3ea68c30b5d4d18e806faf1.tar.gz
some cleanups. *_CREDENTIALS renamed to GNUTLS_*_CREDENTIALS.
Added defines to keep source compatibility.
-rw-r--r--doc/TODO1
-rw-r--r--doc/tex/ex1.tex2
-rw-r--r--doc/tex/ex2.tex2
-rw-r--r--doc/tex/serv1.tex4
-rw-r--r--doc/tex/srp1.tex2
-rw-r--r--lib/auth_anon.h4
-rw-r--r--lib/auth_srp.c4
-rw-r--r--lib/auth_srp.h4
-rw-r--r--lib/auth_srp_passwd.c4
-rw-r--r--lib/auth_x509.c16
-rw-r--r--lib/auth_x509.h2
-rw-r--r--lib/ext_srp.c2
-rw-r--r--lib/gnutls.h.in.in59
-rw-r--r--lib/gnutls_anon_cred.c32
-rw-r--r--lib/gnutls_cert.c32
-rw-r--r--lib/gnutls_global.c9
-rw-r--r--lib/gnutls_global.h4
-rw-r--r--lib/gnutls_handshake.c2
-rw-r--r--lib/gnutls_sig.c4
-rw-r--r--lib/gnutls_srp.c36
-rw-r--r--lib/gnutls_ui.h50
-rw-r--r--src/cli.c6
-rw-r--r--src/serv.c6
23 files changed, 148 insertions, 139 deletions
diff --git a/doc/TODO b/doc/TODO
index 963c59c7c4..8388e3999f 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -6,6 +6,7 @@ Current list:
+ Audit the code
+ Add support for certificates with DSS parameters
+ OpenPGP certificate support
+* Add function to clone GNUTLS_STATE structures
* Minimize footprint.
- Add Kerberos support
diff --git a/doc/tex/ex1.tex b/doc/tex/ex1.tex
index 5432567716..dd7d2c7af2 100644
--- a/doc/tex/ex1.tex
+++ b/doc/tex/ex1.tex
@@ -31,7 +31,7 @@ int main()
struct sockaddr_in sa;
GNUTLS_STATE state;
char buffer[MAX_BUF + 1];
- X509PKI_CLIENT_CREDENTIALS xcred;
+ GNUTLS_X509PKI_CLIENT_CREDENTIALS xcred;
/* variables used in session resuming */
int t;
char *session;
diff --git a/doc/tex/ex2.tex b/doc/tex/ex2.tex
index 6c6ea3a321..3a8dc90ef6 100644
--- a/doc/tex/ex2.tex
+++ b/doc/tex/ex2.tex
@@ -23,7 +23,7 @@ int main()
struct sockaddr_in sa;
GNUTLS_STATE state;
char buffer[MAX_BUF + 1];
- X509PKI_CLIENT_CREDENTIALS xcred;
+ GNUTLS_X509PKI_CLIENT_CREDENTIALS xcred;
const int protocol_priority[] = { GNUTLS_TLS1, GNUTLS_SSL3, 0 };
const int kx_priority[] = { GNUTLS_KX_X509PKI_RSA, 0 };
const int cipher_priority[] = { GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_ARCFOUR, 0};
diff --git a/doc/tex/serv1.tex b/doc/tex/serv1.tex
index 0e7dec2714..517554a328 100644
--- a/doc/tex/serv1.tex
+++ b/doc/tex/serv1.tex
@@ -30,8 +30,8 @@
#define PORT 5556 /* listen to 5556 port */
/* These are global */
-SRP_SERVER_CREDENTIALS srp_cred;
-X509PKI_SERVER_CREDENTIALS x509_cred;
+GNUTLS_SRP_SERVER_CREDENTIALS srp_cred;
+GNUTLS_X509PKI_SERVER_CREDENTIALS x509_cred;
GNUTLS_STATE initialize_state()
{
diff --git a/doc/tex/srp1.tex b/doc/tex/srp1.tex
index 59c55b5ca1..65f87917a6 100644
--- a/doc/tex/srp1.tex
+++ b/doc/tex/srp1.tex
@@ -29,7 +29,7 @@ int main()
struct sockaddr_in sa;
GNUTLS_STATE state;
char buffer[MAX_BUF + 1];
- SRP_CLIENT_CREDENTIALS xcred;
+ GNUTLS_SRP_CLIENT_CREDENTIALS xcred;
if (gnutls_global_init() < 0) {
fprintf(stderr, "global state initialization error\n");
diff --git a/lib/auth_anon.h b/lib/auth_anon.h
index 44542c447a..8ce554e83e 100644
--- a/lib/auth_anon.h
+++ b/lib/auth_anon.h
@@ -5,8 +5,8 @@ typedef struct {
int dh_bits;
} ANON_SERVER_CREDENTIALS_INT;
-#define ANON_SERVER_CREDENTIALS ANON_SERVER_CREDENTIALS_INT*
-#define ANON_CLIENT_CREDENTIALS ANON_SERVER_CREDENTIALS_INT*
+#define GNUTLS_ANON_SERVER_CREDENTIALS ANON_SERVER_CREDENTIALS_INT*
+#define GNUTLS_ANON_CLIENT_CREDENTIALS ANON_SERVER_CREDENTIALS_INT*
typedef struct ANON_CLIENT_AUTH_INFO_INT {
int dh_bits;
diff --git a/lib/auth_srp.c b/lib/auth_srp.c
index a20b460426..d568657c30 100644
--- a/lib/auth_srp.c
+++ b/lib/auth_srp.c
@@ -246,7 +246,7 @@ int gen_srp_client_kx0(GNUTLS_STATE state, opaque ** data)
uint8 *data_a;
char *username;
char *password;
- const SRP_CLIENT_CREDENTIALS cred =
+ const GNUTLS_SRP_CLIENT_CREDENTIALS cred =
_gnutls_get_cred(state->gnutls_key, GNUTLS_SRP, NULL);
if (cred == NULL) {
@@ -306,7 +306,7 @@ int proc_srp_server_hello(GNUTLS_STATE state, const opaque * data, int data_size
opaque hd[SRP_MAX_HASH_SIZE];
char *username;
char *password;
- const SRP_CLIENT_CREDENTIALS cred =
+ const GNUTLS_SRP_CLIENT_CREDENTIALS cred =
_gnutls_get_cred(state->gnutls_key, GNUTLS_SRP, NULL);
if (cred == NULL) {
diff --git a/lib/auth_srp.h b/lib/auth_srp.h
index 9b75981c42..04bb48cc6f 100644
--- a/lib/auth_srp.h
+++ b/lib/auth_srp.h
@@ -5,14 +5,14 @@ typedef struct {
char* password;
} SRP_CLIENT_CREDENTIALS_INT;
-#define SRP_CLIENT_CREDENTIALS SRP_CLIENT_CREDENTIALS_INT*
+#define GNUTLS_SRP_CLIENT_CREDENTIALS SRP_CLIENT_CREDENTIALS_INT*
typedef struct {
char* password_file;
char* password_conf_file;
} SRP_SERVER_CREDENTIALS_INT;
-#define SRP_SERVER_CREDENTIALS SRP_SERVER_CREDENTIALS_INT*
+#define GNUTLS_SRP_SERVER_CREDENTIALS SRP_SERVER_CREDENTIALS_INT*
/* these structures should not use allocated data */
typedef struct SRP_SERVER_AUTH_INFO_INT {
diff --git a/lib/auth_srp_passwd.c b/lib/auth_srp_passwd.c
index a56a091306..63becca31d 100644
--- a/lib/auth_srp_passwd.c
+++ b/lib/auth_srp_passwd.c
@@ -194,7 +194,7 @@ int tmp_size;
/* this function opens the tpasswd.conf file
*/
-static int pwd_read_conf( const SRP_SERVER_CREDENTIALS cred, GNUTLS_SRP_PWD_ENTRY* entry, int index) {
+static int pwd_read_conf( const GNUTLS_SRP_SERVER_CREDENTIALS cred, GNUTLS_SRP_PWD_ENTRY* entry, int index) {
FILE * fd;
char line[5*1024];
int i;
@@ -229,7 +229,7 @@ static int pwd_read_conf( const SRP_SERVER_CREDENTIALS cred, GNUTLS_SRP_PWD_ENTR
GNUTLS_SRP_PWD_ENTRY *_gnutls_srp_pwd_read_entry( GNUTLS_KEY key, char* username, int *err) {
- const SRP_SERVER_CREDENTIALS cred;
+ const GNUTLS_SRP_SERVER_CREDENTIALS cred;
FILE * fd;
char line[5*1024];
int i, len;
diff --git a/lib/auth_x509.c b/lib/auth_x509.c
index e8cb2540f1..a7ab7078a7 100644
--- a/lib/auth_x509.c
+++ b/lib/auth_x509.c
@@ -207,7 +207,7 @@ static int _gnutls_find_acceptable_client_cert(GNUTLS_STATE state,
gnutls_datum odn;
opaque *data = _data;
int data_size = _data_size;
- const X509PKI_CREDENTIALS cred;
+ const GNUTLS_X509PKI_CREDENTIALS cred;
cred = _gnutls_get_cred(state->gnutls_key, GNUTLS_X509PKI, NULL);
@@ -470,7 +470,7 @@ int _gnutls_proc_x509_server_certificate(GNUTLS_STATE state, opaque * data,
int size, len, ret;
opaque *p = data;
X509PKI_AUTH_INFO info;
- const X509PKI_CREDENTIALS cred;
+ const GNUTLS_X509PKI_CREDENTIALS cred;
int dsize = data_size;
int i, j, x;
gnutls_cert *peer_certificate_list;
@@ -644,7 +644,7 @@ int _gnutls_proc_x509_cert_req(GNUTLS_STATE state, opaque * data,
{
int size, ret;
opaque *p = data;
- const X509PKI_CREDENTIALS cred;
+ const GNUTLS_X509PKI_CREDENTIALS cred;
X509PKI_AUTH_INFO info;
int dsize = data_size;
int i;
@@ -808,7 +808,7 @@ int _gnutls_proc_x509_client_cert_vrfy(GNUTLS_STATE state, opaque * data,
#define CERTTYPE_SIZE 2
int _gnutls_gen_x509_server_cert_req(GNUTLS_STATE state, opaque ** data)
{
- const X509PKI_CREDENTIALS cred;
+ const GNUTLS_X509PKI_CREDENTIALS cred;
int size;
opaque *pdata;
@@ -857,7 +857,7 @@ int _gnutls_find_apr_cert(GNUTLS_STATE state, gnutls_cert ** apr_cert_list,
int *apr_cert_list_length,
gnutls_private_key ** apr_pkey)
{
- const X509PKI_CREDENTIALS cred;
+ const GNUTLS_X509PKI_CREDENTIALS cred;
int ind;
cred =
@@ -1218,7 +1218,7 @@ int gnutls_x509pki_extract_certificate_version(const gnutls_datum * cert)
int gnutls_x509pki_get_peer_certificate_status(GNUTLS_STATE state)
{
X509PKI_AUTH_INFO info;
- const X509PKI_CREDENTIALS cred;
+ const GNUTLS_X509PKI_CREDENTIALS cred;
CertificateStatus verify;
gnutls_cert *peer_certificate_list;
int peer_certificate_list_size, i, x, ret;
@@ -1290,7 +1290,7 @@ int gnutls_x509pki_get_peer_certificate_status(GNUTLS_STATE state)
const gnutls_cert *_gnutls_server_find_x509_cert(GNUTLS_STATE state)
{
int i;
- const X509PKI_CREDENTIALS x509_cred;
+ const GNUTLS_X509PKI_CREDENTIALS x509_cred;
x509_cred =
_gnutls_get_cred(state->gnutls_key, GNUTLS_X509PKI, NULL);
@@ -1315,7 +1315,7 @@ int _gnutls_server_find_x509_cert_list_index(GNUTLS_STATE state,
int cert_list_length)
{
int i, index = -1;
- const X509PKI_CREDENTIALS cred;
+ const GNUTLS_X509PKI_CREDENTIALS cred;
state->gnutls_internals.selected_cert_index = 0;
diff --git a/lib/auth_x509.h b/lib/auth_x509.h
index cd67750627..a4126877e0 100644
--- a/lib/auth_x509.h
+++ b/lib/auth_x509.h
@@ -36,7 +36,7 @@ typedef struct {
} X509PKI_CREDENTIALS_INT;
/* typedef X509PKI_CREDENTIALS_INT * X509PKI_CREDENTIALS; */
-#define X509PKI_CREDENTIALS X509PKI_CREDENTIALS_INT*
+#define GNUTLS_X509PKI_CREDENTIALS X509PKI_CREDENTIALS_INT*
typedef struct X509PKI_AUTH_INFO_INT {
int certificate_requested; /* if the peer requested certificate
diff --git a/lib/ext_srp.c b/lib/ext_srp.c
index 8fe9d6e771..7653a3a832 100644
--- a/lib/ext_srp.c
+++ b/lib/ext_srp.c
@@ -65,7 +65,7 @@ int _gnutls_srp_send_params( GNUTLS_STATE state, opaque** data) {
uint8 len;
/* this function sends the client extension data (username) */
if (state->security_parameters.entity == GNUTLS_CLIENT) {
- const SRP_CLIENT_CREDENTIALS cred = _gnutls_get_cred( state->gnutls_key, GNUTLS_SRP, NULL);
+ const GNUTLS_SRP_CLIENT_CREDENTIALS cred = _gnutls_get_cred( state->gnutls_key, GNUTLS_SRP, NULL);
(*data) = NULL;
diff --git a/lib/gnutls.h.in.in b/lib/gnutls.h.in.in
index cbf29b52c0..86ceff4eaa 100644
--- a/lib/gnutls.h.in.in
+++ b/lib/gnutls.h.in.in
@@ -146,7 +146,7 @@ int gnutls_db_check_entry( GNUTLS_STATE state, gnutls_datum session_entry);
void gnutls_handshake_set_max_data_buffer_size( GNUTLS_STATE state, int max);
/* returns libgnutls version */
-const char* gnutls_check_version();
+const char* gnutls_check_version(void);
/* Functions for setting/clearing credentials */
int gnutls_clear_creds( GNUTLS_STATE state);
@@ -161,40 +161,47 @@ int gnutls_cred_set( GNUTLS_STATE, CredType type, void* cred);
/* Credential structures for SRP - used in gnutls_set_cred(); */
struct DSTRUCT;
-typedef struct DSTRUCT* X509PKI_CREDENTIALS;
-typedef X509PKI_CREDENTIALS X509PKI_CLIENT_CREDENTIALS;
-typedef X509PKI_CREDENTIALS X509PKI_SERVER_CREDENTIALS;
+typedef struct DSTRUCT* GNUTLS_X509PKI_CREDENTIALS;
+typedef GNUTLS_X509PKI_CREDENTIALS GNUTLS_X509PKI_CLIENT_CREDENTIALS;
+typedef GNUTLS_X509PKI_CREDENTIALS GNUTLS_X509PKI_SERVER_CREDENTIALS;
+#define X509PKI_CLIENT_CREDENTIALS GNUTLS_X509PKI_CLIENT_CREDENTIALS
+#define X509PKI_SERVER_CREDENTIALS GNUTLS_X509PKI_SERVER_CREDENTIALS
-typedef struct DSTRUCT* SRP_SERVER_CREDENTIALS;
-typedef struct DSTRUCT* SRP_CLIENT_CREDENTIALS;
+typedef struct DSTRUCT* GNUTLS_SRP_SERVER_CREDENTIALS;
+typedef struct DSTRUCT* GNUTLS_SRP_CLIENT_CREDENTIALS;
+#define SRP_SERVER_CREDENTIALS GNUTLS_SRP_SERVER_CREDENTIALS
+#define GNUTLS_SRP_CLIENT_CREDENTIALS GNUTLS_GNUTLS_SRP_CLIENT_CREDENTIALS
-typedef struct DSTRUCT* ANON_SERVER_CREDENTIALS;
-typedef struct DSTRUCT* ANON_CLIENT_CREDENTIALS;
+typedef struct DSTRUCT* GNUTLS_ANON_SERVER_CREDENTIALS;
+typedef struct DSTRUCT* GNUTLS_ANON_CLIENT_CREDENTIALS;
+#define ANON_SERVER_CREDENTIALS GNUTLS_ANON_SERVER_CREDENTIALS
+#define ANON_CLIENT_CREDENTIALS GNUTLS_ANON_CLIENT_CREDENTIALS
-void gnutls_srp_free_client_sc( SRP_CLIENT_CREDENTIALS sc);
-int gnutls_srp_allocate_client_sc( SRP_CLIENT_CREDENTIALS *sc);
-int gnutls_srp_set_client_cred( SRP_CLIENT_CREDENTIALS res, char *username, char* password);
-void gnutls_srp_free_server_sc( SRP_SERVER_CREDENTIALS sc);
-int gnutls_srp_allocate_server_sc( SRP_SERVER_CREDENTIALS *sc);
-int gnutls_srp_set_server_cred_file( SRP_SERVER_CREDENTIALS res, char *password_file, char* password_conf_file);
+void gnutls_srp_free_client_sc( GNUTLS_SRP_CLIENT_CREDENTIALS sc);
+int gnutls_srp_allocate_client_sc( GNUTLS_SRP_CLIENT_CREDENTIALS *sc);
+int gnutls_srp_set_client_cred( GNUTLS_SRP_CLIENT_CREDENTIALS res, char *username, char* password);
-void gnutls_anon_free_server_sc( ANON_SERVER_CREDENTIALS sc);
-int gnutls_anon_allocate_server_sc( ANON_SERVER_CREDENTIALS *sc);
-int gnutls_anon_set_server_cred( ANON_SERVER_CREDENTIALS res, int dh_bits);
+void gnutls_srp_free_server_sc( GNUTLS_SRP_SERVER_CREDENTIALS sc);
+int gnutls_srp_allocate_server_sc( GNUTLS_SRP_SERVER_CREDENTIALS *sc);
+int gnutls_srp_set_server_cred_file( GNUTLS_SRP_SERVER_CREDENTIALS res, char *password_file, char* password_conf_file);
-void gnutls_anon_free_client_sc( ANON_SERVER_CREDENTIALS sc);
-int gnutls_anon_allocate_client_sc( ANON_SERVER_CREDENTIALS *sc);
-int gnutls_anon_set_client_cred( ANON_SERVER_CREDENTIALS res, int dh_bits);
+void gnutls_anon_free_server_sc( GNUTLS_ANON_SERVER_CREDENTIALS sc);
+int gnutls_anon_allocate_server_sc( GNUTLS_ANON_SERVER_CREDENTIALS *sc);
+int gnutls_anon_set_server_cred( GNUTLS_ANON_SERVER_CREDENTIALS res, int dh_bits);
+
+void gnutls_anon_free_client_sc( GNUTLS_ANON_SERVER_CREDENTIALS sc);
+int gnutls_anon_allocate_client_sc( GNUTLS_ANON_SERVER_CREDENTIALS *sc);
+int gnutls_anon_set_client_cred( GNUTLS_ANON_SERVER_CREDENTIALS res, int dh_bits);
/* CERTFILE is an x509 certificate in PEM form.
* KEYFILE is a pkcs-1 private key in PEM form (for RSA keys).
*/
-void gnutls_x509pki_free_sc( X509PKI_CREDENTIALS sc);
-int gnutls_x509pki_allocate_sc( X509PKI_CREDENTIALS *sc, int ncerts);
-int gnutls_x509pki_set_key_file( X509PKI_CREDENTIALS res, char *CERTFILE, char* KEYFILE);
-int gnutls_x509pki_set_trust_file( X509PKI_CREDENTIALS res, char* CAFILE, char* CRLFILE);
+void gnutls_x509pki_free_sc( GNUTLS_X509PKI_CREDENTIALS sc);
+int gnutls_x509pki_allocate_sc( GNUTLS_X509PKI_CREDENTIALS *sc, int ncerts);
+int gnutls_x509pki_set_key_file( GNUTLS_X509PKI_CREDENTIALS res, char *CERTFILE, char* KEYFILE);
+int gnutls_x509pki_set_trust_file( GNUTLS_X509PKI_CREDENTIALS res, char* CAFILE, char* CRLFILE);
#define gnutls_x509pki_free_server_sc gnutls_x509pki_free_sc
#define gnutls_x509pki_allocate_server_sc gnutls_x509pki_allocate_sc
@@ -213,8 +220,8 @@ int gnutls_x509pki_set_trust_file( X509PKI_CREDENTIALS res, char* CAFILE, char*
* This will not be the case in the final version. These files
* are located in the src/ directory of gnutls distribution.
*/
-int gnutls_global_init();
-void gnutls_global_deinit();
+int gnutls_global_init(void);
+void gnutls_global_deinit(void);
int gnutls_dh_replace_params( gnutls_datum prime, gnutls_datum generator, int bits);
int gnutls_dh_generate_params( gnutls_datum* prime, gnutls_datum* generator, int bits);
diff --git a/lib/gnutls_anon_cred.c b/lib/gnutls_anon_cred.c
index 5ae25f1f63..f74f96f0b7 100644
--- a/lib/gnutls_anon_cred.c
+++ b/lib/gnutls_anon_cred.c
@@ -27,35 +27,35 @@
#include "gnutls_gcry.h"
/**
- * gnutls_anon_free_server_sc - Used to free an allocated ANON_SERVER_CREDENTIALS structure
- * @sc: is an &ANON_SERVER_CREDENTIALS structure.
+ * gnutls_anon_free_server_sc - Used to free an allocated GNUTLS_ANON_SERVER_CREDENTIALS structure
+ * @sc: is an &GNUTLS_ANON_SERVER_CREDENTIALS structure.
*
* This structure is complex enough to manipulate directly thus
* this helper function is provided in order to free (deallocate)
* the structure.
**/
-void gnutls_anon_free_server_sc( ANON_SERVER_CREDENTIALS sc) {
+void gnutls_anon_free_server_sc( GNUTLS_ANON_SERVER_CREDENTIALS sc) {
gnutls_free(sc);
}
/**
- * gnutls_anon_allocate_server_sc - Used to allocate an ANON_SERVER CREDENTIALS structure
- * @sc: is a pointer to an &ANON_SERVER_CREDENTIALS structure.
+ * gnutls_anon_allocate_server_sc - Used to allocate an GNUTLS_ANON_SERVER CREDENTIALS structure
+ * @sc: is a pointer to an &GNUTLS_ANON_SERVER_CREDENTIALS structure.
*
* This structure is complex enough to manipulate directly thus
* this helper function is provided in order to allocate
* the structure.
**/
-int gnutls_anon_allocate_server_sc( ANON_SERVER_CREDENTIALS *sc) {
- *sc = gnutls_malloc(sizeof( ANON_SERVER_CREDENTIALS));
+int gnutls_anon_allocate_server_sc( GNUTLS_ANON_SERVER_CREDENTIALS *sc) {
+ *sc = gnutls_malloc(sizeof( ANON_SERVER_CREDENTIALS_INT));
if (*sc==NULL) return GNUTLS_E_MEMORY_ERROR;
return 0;
}
/**
- * gnutls_anon_set_server_cred - Used to set the number of bits to use in DH, in a ANON_SERVER_CREDENTIALS structure
- * @res: is an &ANON_SERVER_CREDENTIALS structure.
+ * gnutls_anon_set_server_cred - Used to set the number of bits to use in DH, in a GNUTLS_ANON_SERVER_CREDENTIALS structure
+ * @res: is an &GNUTLS_ANON_SERVER_CREDENTIALS structure.
* @dh_bits: is the number of bits in DH key exchange
*
* Used to set the number of bits to use in an anonymous Diffie-Hellman,
@@ -63,34 +63,34 @@ int gnutls_anon_allocate_server_sc( ANON_SERVER_CREDENTIALS *sc) {
*
**/
-int gnutls_anon_set_server_cred( ANON_SERVER_CREDENTIALS res, int dh_bits) {
+int gnutls_anon_set_server_cred( GNUTLS_ANON_SERVER_CREDENTIALS res, int dh_bits) {
res->dh_bits = dh_bits;
return 0;
}
/**
- * gnutls_anon_free_client_sc - Used to free an allocated ANON_CLIENT_CREDENTIALS structure
- * @sc: is an &ANON_CLIENT_CREDENTIALS structure.
+ * gnutls_anon_free_client_sc - Used to free an allocated GNUTLS_ANON_CLIENT_CREDENTIALS structure
+ * @sc: is an &GNUTLS_ANON_CLIENT_CREDENTIALS structure.
*
* This structure is complex enough to manipulate directly thus
* this helper function is provided in order to free (deallocate)
* the structure.
**/
-void gnutls_anon_free_client_sc( ANON_CLIENT_CREDENTIALS sc) {
+void gnutls_anon_free_client_sc( GNUTLS_ANON_CLIENT_CREDENTIALS sc) {
return;
}
const static int anon_tmp;
/**
- * gnutls_allocate_anon_client_sc - Used to allocate an ANON_CLIENT CREDENTIALS structure
- * @sc: is a pointer to an &ANON_CLIENT_CREDENTIALS structure.
+ * gnutls_allocate_anon_client_sc - Used to allocate an GNUTLS_ANON_CLIENT CREDENTIALS structure
+ * @sc: is a pointer to an &GNUTLS_ANON_CLIENT_CREDENTIALS structure.
*
* This structure is complex enough to manipulate directly thus
* this helper function is provided in order to allocate
* the structure.
**/
-int gnutls_anon_allocate_client_sc( ANON_CLIENT_CREDENTIALS *sc) {
+int gnutls_anon_allocate_client_sc( GNUTLS_ANON_CLIENT_CREDENTIALS *sc) {
/* anon_tmp is only there for *sc not to be null.
* it is not used at all;
*/
diff --git a/lib/gnutls_cert.c b/lib/gnutls_cert.c
index 3160379ce0..9936f1a9ee 100644
--- a/lib/gnutls_cert.c
+++ b/lib/gnutls_cert.c
@@ -97,13 +97,13 @@ void gnutls_free_cert(gnutls_cert cert)
/**
* gnutls_x509pki_free_sc - Used to free an allocated x509 SERVER CREDENTIALS structure
- * @sc: is an &X509PKI_CREDENTIALS structure.
+ * @sc: is an &GNUTLS_X509PKI_CREDENTIALS structure.
*
* This structure is complex enough to manipulate directly thus
* this helper function is provided in order to free (deallocate)
* the structure.
**/
-void gnutls_x509pki_free_sc(X509PKI_CREDENTIALS sc)
+void gnutls_x509pki_free_sc(GNUTLS_X509PKI_CREDENTIALS sc)
{
int i, j;
@@ -138,7 +138,7 @@ void gnutls_x509pki_free_sc(X509PKI_CREDENTIALS sc)
/* Reads a base64 encoded certificate file
*/
-static int read_cert_file(X509PKI_CREDENTIALS res, char *certfile)
+static int read_cert_file(GNUTLS_X509PKI_CREDENTIALS res, char *certfile)
{
int siz, i, siz2;
opaque *b64;
@@ -217,7 +217,7 @@ static int read_cert_file(X509PKI_CREDENTIALS res, char *certfile)
/* Reads a base64 encoded CA file (file contains multiple certificate
* authorities). This is to be called once.
*/
-static int read_ca_file(X509PKI_CREDENTIALS res, char *cafile)
+static int read_ca_file(GNUTLS_X509PKI_CREDENTIALS res, char *cafile)
{
int siz, siz2, i;
opaque *b64;
@@ -289,7 +289,7 @@ static int read_ca_file(X509PKI_CREDENTIALS res, char *cafile)
/* Reads a PEM encoded PKCS-1 RSA private key file
*/
-static int read_key_file(X509PKI_CREDENTIALS res, char *keyfile)
+static int read_key_file(GNUTLS_X509PKI_CREDENTIALS res, char *keyfile)
{
int siz, ret;
opaque *b64;
@@ -332,7 +332,7 @@ static int read_key_file(X509PKI_CREDENTIALS res, char *keyfile)
/**
* gnutls_x509pki_allocate_sc - Used to allocate an x509 SERVER CREDENTIALS structure
- * @res: is a pointer to an &X509PKI_CREDENTIALS structure.
+ * @res: is a pointer to an &GNUTLS_X509PKI_CREDENTIALS structure.
* @ncerts: this is the number of certificate/private key pair you're going to use.
* This should be 1 in common sites.
*
@@ -340,7 +340,7 @@ static int read_key_file(X509PKI_CREDENTIALS res, char *keyfile)
* this helper function is provided in order to allocate
* the structure.
**/
-int gnutls_x509pki_allocate_sc(X509PKI_CREDENTIALS * res, int ncerts)
+int gnutls_x509pki_allocate_sc(GNUTLS_X509PKI_CREDENTIALS * res, int ncerts)
{
*res = gnutls_calloc(1, sizeof(X509PKI_CREDENTIALS_INT));
@@ -382,14 +382,14 @@ int gnutls_x509pki_allocate_sc(X509PKI_CREDENTIALS * res, int ncerts)
}
/**
- * gnutls_x509pki_set_key_file - Used to set keys in a X509PKI_CREDENTIALS structure
- * @res: is an &X509PKI_CREDENTIALS structure.
+ * gnutls_x509pki_set_key_file - Used to set keys in a GNUTLS_X509PKI_CREDENTIALS structure
+ * @res: is an &GNUTLS_X509PKI_CREDENTIALS structure.
* @CERTFILE: is a PEM encoded file containing the certificate list (path) for
* the specified private key
* @KEYFILE: is a PEM encoded file containing a private key
*
* This function sets a certificate/private key pair in the
- * X509PKI_CREDENTIALS structure. This function may be called
+ * GNUTLS_X509PKI_CREDENTIALS structure. This function may be called
* more than once (in case multiple keys/certificates exist for the
* server).
*
@@ -397,7 +397,7 @@ int gnutls_x509pki_allocate_sc(X509PKI_CREDENTIALS * res, int ncerts)
* this function.
*
**/
-int gnutls_x509pki_set_key_file(X509PKI_CREDENTIALS res, char *CERTFILE,
+int gnutls_x509pki_set_key_file(GNUTLS_X509PKI_CREDENTIALS res, char *CERTFILE,
char *KEYFILE)
{
int ret;
@@ -414,15 +414,15 @@ int gnutls_x509pki_set_key_file(X509PKI_CREDENTIALS res, char *CERTFILE,
}
/**
- * gnutls_x509pki_set_trust_file - Used to set trusted CAs in a X509PKI_CREDENTIALS structure
- * @res: is an &X509PKI_CREDENTIALS structure.
+ * gnutls_x509pki_set_trust_file - Used to set trusted CAs in a GNUTLS_X509PKI_CREDENTIALS structure
+ * @res: is an &GNUTLS_X509PKI_CREDENTIALS structure.
* @CAFILE: is a PEM encoded file containing trusted CAs
* @CRLFILE: is a PEM encoded file containing CRLs (ignored for now)
*
* This function sets the trusted CAs in order to verify client
* certificates.
**/
-int gnutls_x509pki_set_trust_file(X509PKI_CREDENTIALS res, char *CAFILE,
+int gnutls_x509pki_set_trust_file(GNUTLS_X509PKI_CREDENTIALS res, char *CAFILE,
char *CRLFILE)
{
int ret, size, i;
@@ -972,7 +972,7 @@ int _gnutls_check_x509pki_key_usage(const gnutls_cert * cert,
if (cert->keyUsage != 0) {
if (!
(cert->
- keyUsage & X509KEY_KEY_ENCIPHERMENT))
+ keyUsage & GNUTLS_X509KEY_KEY_ENCIPHERMENT))
return
GNUTLS_E_X509_KEY_USAGE_VIOLATION;
else
@@ -983,7 +983,7 @@ int _gnutls_check_x509pki_key_usage(const gnutls_cert * cert,
if (cert->keyUsage != 0) {
if (!
(cert->
- keyUsage & X509KEY_DIGITAL_SIGNATURE))
+ keyUsage & GNUTLS_X509KEY_DIGITAL_SIGNATURE))
return
GNUTLS_E_X509_KEY_USAGE_VIOLATION;
else
diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c
index 8264e29d4a..829aa7fe08 100644
--- a/lib/gnutls_global.c
+++ b/lib/gnutls_global.c
@@ -36,11 +36,11 @@ LOG_FUNC _gnutls_log_func;
static node_asn *PKIX1_ASN;
static node_asn *PKCS1_ASN;
-node_asn* _gnutls_get_pkix() {
+node_asn* _gnutls_get_pkix(void) {
return PKIX1_ASN;
}
-node_asn* _gnutls_get_pkcs() {
+node_asn* _gnutls_get_pkcs(void) {
return PKCS1_ASN;
}
@@ -78,7 +78,7 @@ static void dlog( const char* str) {
* Returns zero on success.
*
**/
-int gnutls_global_init()
+int gnutls_global_init( void)
{
int result;
@@ -118,9 +118,10 @@ int gnutls_global_init()
* gnutls_global_deinit - This function deinitializes the global state
*
* This function deinitializes the global state.
+ *
**/
-void gnutls_global_deinit() {
+void gnutls_global_deinit( void) {
asn1_delete_structure( PKCS1_ASN);
asn1_delete_structure( PKIX1_ASN);
diff --git a/lib/gnutls_global.h b/lib/gnutls_global.h
index dcb012ec32..c767b45f96 100644
--- a/lib/gnutls_global.h
+++ b/lib/gnutls_global.h
@@ -4,7 +4,7 @@
#include <x509_asn1.h>
int gnutls_is_secure_memory(const void* mem);
-node_asn* _gnutls_get_pkcs();
-node_asn* _gnutls_get_pkix();
+node_asn* _gnutls_get_pkcs(void);
+node_asn* _gnutls_get_pkix(void);
#endif
diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c
index 3b95d78053..f7f041c307 100644
--- a/lib/gnutls_handshake.c
+++ b/lib/gnutls_handshake.c
@@ -2138,7 +2138,7 @@ int _gnutls_remove_unwanted_ciphersuites(GNUTLS_STATE state,
int ret = 0;
GNUTLS_CipherSuite *newSuite;
int newSuiteSize = 0, i, j, keep;
- const X509PKI_CREDENTIALS x509_cred;
+ const GNUTLS_X509PKI_CREDENTIALS x509_cred;
const gnutls_cert *cert = NULL;
KXAlgorithm *alg;
int alg_size;
diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c
index e1ab900ec4..51830ae4e7 100644
--- a/lib/gnutls_sig.c
+++ b/lib/gnutls_sig.c
@@ -113,7 +113,7 @@ GNUTLS_HASH_HANDLE td;
if ( cert != NULL)
if ( cert->keyUsage != 0)
- if ( !(cert->keyUsage & X509KEY_DIGITAL_SIGNATURE)) {
+ if ( !(cert->keyUsage & GNUTLS_X509KEY_DIGITAL_SIGNATURE)) {
gnutls_assert();
return GNUTLS_E_X509_KEY_USAGE_VIOLATION;
}
@@ -175,7 +175,7 @@ int _gnutls_pkcs1_rsa_verify_sig( gnutls_cert *cert, const gnutls_datum *data, g
*/
if ( cert != NULL)
if ( cert->keyUsage != 0)
- if ( !(cert->keyUsage & X509KEY_DIGITAL_SIGNATURE)) {
+ if ( !(cert->keyUsage & GNUTLS_X509KEY_DIGITAL_SIGNATURE)) {
gnutls_assert();
return GNUTLS_E_X509_KEY_USAGE_VIOLATION;
}
diff --git a/lib/gnutls_srp.c b/lib/gnutls_srp.c
index 4b9917f706..02afdbf3bd 100644
--- a/lib/gnutls_srp.c
+++ b/lib/gnutls_srp.c
@@ -309,26 +309,26 @@ MPI _gnutls_calc_srp_S2(MPI B, MPI g, MPI x, MPI a, MPI u, MPI n)
}
/**
- * gnutls_srp_free_server_sc - Used to free an allocated SRP_CLIENT_CREDENTIALS structure
- * @sc: is an &SRP_CLIENT_CREDENTIALS structure.
+ * gnutls_srp_free_server_sc - Used to free an allocated GNUTLS_SRP_CLIENT_CREDENTIALS structure
+ * @sc: is an &GNUTLS_SRP_CLIENT_CREDENTIALS structure.
*
* This structure is complex enough to manipulate directly thus
* this helper function is provided in order to free (deallocate)
* the structure.
**/
-void gnutls_srp_free_client_sc( SRP_CLIENT_CREDENTIALS sc) {
+void gnutls_srp_free_client_sc( GNUTLS_SRP_CLIENT_CREDENTIALS sc) {
gnutls_free(sc);
}
/**
- * gnutls_srp_allocate_server_sc - Used to allocate an SRP_CLIENT_CREDENTIALS structure
- * @sc: is a pointer to an &SRP_CLIENT_CREDENTIALS structure.
+ * gnutls_srp_allocate_server_sc - Used to allocate an GNUTLS_SRP_CLIENT_CREDENTIALS structure
+ * @sc: is a pointer to an &GNUTLS_SRP_CLIENT_CREDENTIALS structure.
*
* This structure is complex enough to manipulate directly thus
* this helper function is provided in order to allocate
* the structure.
**/
-int gnutls_srp_allocate_client_sc( SRP_CLIENT_CREDENTIALS *sc) {
+int gnutls_srp_allocate_client_sc( GNUTLS_SRP_CLIENT_CREDENTIALS *sc) {
*sc = gnutls_malloc( sizeof(SRP_CLIENT_CREDENTIALS_INT));
if (*sc==NULL) return GNUTLS_E_MEMORY_ERROR;
@@ -337,13 +337,13 @@ int gnutls_srp_allocate_client_sc( SRP_CLIENT_CREDENTIALS *sc) {
}
/**
- * gnutls_srp_set_client_cred - Used to set the username/password, in a SRP_CLIENT_CREDENTIALS structure
- * @res: is an &SRP_CLIENT_CREDENTIALS structure.
+ * gnutls_srp_set_client_cred - Used to set the username/password, in a GNUTLS_SRP_CLIENT_CREDENTIALS structure
+ * @res: is an &GNUTLS_SRP_CLIENT_CREDENTIALS structure.
* @username: is the user's userid
* @password: is the user's password
*
**/
-int gnutls_srp_set_client_cred( SRP_CLIENT_CREDENTIALS res, char *username, char * password) {
+int gnutls_srp_set_client_cred( GNUTLS_SRP_CLIENT_CREDENTIALS res, char *username, char * password) {
res->username = gnutls_strdup( username);
if (res->username == NULL) return GNUTLS_E_MEMORY_ERROR;
@@ -358,27 +358,27 @@ int gnutls_srp_set_client_cred( SRP_CLIENT_CREDENTIALS res, char *username, char
}
/**
- * gnutls_srp_free_server_sc - Used to free an allocated SRP_SERVER_CREDENTIALS structure
- * @sc: is an &SRP_SERVER_CREDENTIALS structure.
+ * gnutls_srp_free_server_sc - Used to free an allocated GNUTLS_SRP_SERVER_CREDENTIALS structure
+ * @sc: is an &GNUTLS_SRP_SERVER_CREDENTIALS structure.
*
* This structure is complex enough to manipulate directly thus
* this helper function is provided in order to free (deallocate)
* the structure.
**/
-void gnutls_srp_free_server_sc( SRP_SERVER_CREDENTIALS sc) {
+void gnutls_srp_free_server_sc( GNUTLS_SRP_SERVER_CREDENTIALS sc) {
gnutls_free(sc);
}
/**
- * gnutls_srp_allocate_server_sc - Used to allocate an SRP_SERVER_CREDENTIALS structure
- * @sc: is a pointer to an &SRP_SERVER_CREDENTIALS structure.
+ * gnutls_srp_allocate_server_sc - Used to allocate an GNUTLS_SRP_SERVER_CREDENTIALS structure
+ * @sc: is a pointer to an &GNUTLS_SRP_SERVER_CREDENTIALS structure.
*
* This structure is complex enough to manipulate directly thus
* this helper function is provided in order to allocate
* the structure.
**/
-int gnutls_srp_allocate_server_sc( SRP_SERVER_CREDENTIALS *sc) {
+int gnutls_srp_allocate_server_sc( GNUTLS_SRP_SERVER_CREDENTIALS *sc) {
*sc = gnutls_malloc( sizeof(SRP_SERVER_CREDENTIALS_INT));
if (*sc==NULL) return GNUTLS_E_MEMORY_ERROR;
@@ -387,13 +387,13 @@ int gnutls_srp_allocate_server_sc( SRP_SERVER_CREDENTIALS *sc) {
}
/**
- * gnutls_srp_set_server_cred_file - Used to set the password files, in a SRP_SERVER_CREDENTIALS structure
- * @res: is an &SRP_SERVER_CREDENTIALS structure.
+ * gnutls_srp_set_server_cred_file - Used to set the password files, in a GNUTLS_SRP_SERVER_CREDENTIALS structure
+ * @res: is an &GNUTLS_SRP_SERVER_CREDENTIALS structure.
* @password_file: is the SRP password file (tpasswd)
* @password_conf_file: is the SRP password conf file (tpasswd.conf)
*
**/
-int gnutls_srp_set_server_cred_file( SRP_SERVER_CREDENTIALS res, char *password_file, char * password_conf_file) {
+int gnutls_srp_set_server_cred_file( GNUTLS_SRP_SERVER_CREDENTIALS res, char *password_file, char * password_conf_file) {
res->password_file = gnutls_strdup( password_file);
if (res->password_file==NULL) return GNUTLS_E_MEMORY_ERROR;
diff --git a/lib/gnutls_ui.h b/lib/gnutls_ui.h
index 5759276b97..9f3af78108 100644
--- a/lib/gnutls_ui.h
+++ b/lib/gnutls_ui.h
@@ -4,36 +4,36 @@
/* Extra definitions */
-#define X509_CN_SIZE 256
-#define X509_C_SIZE 3
-#define X509_O_SIZE 256
-#define X509_OU_SIZE 256
-#define X509_L_SIZE 256
-#define X509_S_SIZE 256
-#define X509_EMAIL_SIZE 256
+#define GNUTLS_X509_CN_SIZE 256
+#define GNUTLS_X509_C_SIZE 3
+#define GNUTLS_X509_O_SIZE 256
+#define GNUTLS_X509_OU_SIZE 256
+#define GNUTLS_X509_L_SIZE 256
+#define GNUTLS_X509_S_SIZE 256
+#define GNUTLS_X509_EMAIL_SIZE 256
typedef struct {
- char common_name[X509_CN_SIZE];
- char country[X509_C_SIZE];
- char organization[X509_O_SIZE];
- char organizational_unit_name[X509_OU_SIZE];
- char locality_name[X509_L_SIZE];
- char state_or_province_name[X509_S_SIZE];
- char email[X509_EMAIL_SIZE];
+ char common_name[GNUTLS_X509_CN_SIZE];
+ char country[GNUTLS_X509_C_SIZE];
+ char organization[GNUTLS_X509_O_SIZE];
+ char organizational_unit_name[GNUTLS_X509_OU_SIZE];
+ char locality_name[GNUTLS_X509_L_SIZE];
+ char state_or_province_name[GNUTLS_X509_S_SIZE];
+ char email[GNUTLS_X509_EMAIL_SIZE];
} gnutls_DN;
/* For key Usage, test as:
* if (st.keyUsage & X509KEY_DIGITAL_SIGNATURE) ...
*/
-#define X509KEY_DIGITAL_SIGNATURE 256
-#define X509KEY_NON_REPUDIATION 128
-#define X509KEY_KEY_ENCIPHERMENT 64
-#define X509KEY_DATA_ENCIPHERMENT 32
-#define X509KEY_KEY_AGREEMENT 16
-#define X509KEY_KEY_CERT_SIGN 8
-#define X509KEY_CRL_SIGN 4
-#define X509KEY_ENCIPHER_ONLY 2
-#define X509KEY_DECIPHER_ONLY 1
+#define GNUTLS_X509KEY_DIGITAL_SIGNATURE 256
+#define GNUTLS_X509KEY_NON_REPUDIATION 128
+#define GNUTLS_X509KEY_KEY_ENCIPHERMENT 64
+#define GNUTLS_X509KEY_DATA_ENCIPHERMENT 32
+#define GNUTLS_X509KEY_KEY_AGREEMENT 16
+#define GNUTLS_X509KEY_KEY_CERT_SIGN 8
+#define GNUTLS_X509KEY_CRL_SIGN 4
+#define GNUTLS_X509KEY_ENCIPHER_ONLY 2
+#define GNUTLS_X509KEY_DECIPHER_ONLY 1
# ifdef LIBGNUTLS_VERSION /* These are defined only in gnutls.h */
@@ -57,9 +57,9 @@ int gnutls_anon_client_get_dh_bits( GNUTLS_STATE state);
/* X509PKI */
-void gnutls_x509pki_set_client_cert_callback( X509PKI_CREDENTIALS, x509pki_client_cert_callback_func *);
+void gnutls_x509pki_set_client_cert_callback( GNUTLS_X509PKI_CREDENTIALS, x509pki_client_cert_callback_func *);
-void gnutls_x509pki_set_server_cert_callback( X509PKI_CREDENTIALS, x509pki_server_cert_callback_func *);
+void gnutls_x509pki_set_server_cert_callback( GNUTLS_X509PKI_CREDENTIALS, x509pki_server_cert_callback_func *);
void gnutls_x509pki_server_set_cert_request( GNUTLS_STATE, CertificateRequest);
void gnutls_x509pki_set_dh_bits( GNUTLS_STATE state, int bits);
diff --git a/src/cli.c b/src/cli.c
index b95dd9ed6c..1eaae195cd 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -172,9 +172,9 @@ int main(int argc, char** argv)
int maxfd;
struct timeval tv;
int user_term = 0;
- SRP_CLIENT_CREDENTIALS cred;
- ANON_CLIENT_CREDENTIALS anon_cred;
- X509PKI_CLIENT_CREDENTIALS xcred;
+ GNUTLS_SRP_CLIENT_CREDENTIALS cred;
+ GNUTLS_ANON_CLIENT_CREDENTIALS anon_cred;
+ GNUTLS_X509PKI_CLIENT_CREDENTIALS xcred;
struct hostent* server_host;
signal( SIGPIPE, SIG_IGN);
diff --git a/src/serv.c b/src/serv.c
index d1a1f5836f..94c4f82840 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -66,9 +66,9 @@ static char http_buffer[16*1024];
#define RENEGOTIATE
/* These are global */
-SRP_SERVER_CREDENTIALS srp_cred;
-ANON_SERVER_CREDENTIALS dh_cred;
-X509PKI_SERVER_CREDENTIALS x509_cred;
+GNUTLS_SRP_SERVER_CREDENTIALS srp_cred;
+GNUTLS_ANON_SERVER_CREDENTIALS dh_cred;
+GNUTLS_X509PKI_SERVER_CREDENTIALS x509_cred;
GNUTLS_STATE initialize_state()