summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2002-03-20 13:08:09 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2002-03-20 13:08:09 +0000
commitb62ab22770ac03598c53246f4b2e3f30daabc1d3 (patch)
tree994918d5d5ea8cbac48a6e362c32d6f91d84da64
parent9409242790e0363d0c2d779c1897a4fe089739a1 (diff)
downloadgnutls-b62ab22770ac03598c53246f4b2e3f30daabc1d3.tar.gz
*** empty log message ***
-rw-r--r--lib/auth_srp_passwd.c2
-rw-r--r--lib/gnutls_cipher.c15
-rw-r--r--lib/gnutls_x509.c8
3 files changed, 14 insertions, 11 deletions
diff --git a/lib/auth_srp_passwd.c b/lib/auth_srp_passwd.c
index ec58c1258d..aca241f079 100644
--- a/lib/auth_srp_passwd.c
+++ b/lib/auth_srp_passwd.c
@@ -213,7 +213,7 @@ static int pwd_read_conf( const char* pconf_file, GNUTLS_SRP_PWD_ENTRY* entry, i
if (fd==NULL) {
gnutls_assert();
gnutls_free(entry);
- return GNUTLS_E_PWD_ERROR;
+ return GNUTLS_E_FILE_ERROR;
}
while( fgets( line, sizeof(line), fd) != NULL) {
diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c
index 1c1cb456a0..49c773b102 100644
--- a/lib/gnutls_cipher.c
+++ b/lib/gnutls_cipher.c
@@ -46,8 +46,10 @@ int _gnutls_encrypt(GNUTLS_STATE state, const char* headers, int headers_size,
gnutls_datum comp, ciph;
int err;
- if (plain.size == 0) comp = plain;
- else {
+ if (plain.size == 0) {
+ comp.data = NULL;
+ comp.size = 0;
+ } else {
err = _gnutls_plaintext2TLSCompressed(state, &comp, plain);
if (err < 0) {
gnutls_assert();
@@ -61,8 +63,7 @@ int _gnutls_encrypt(GNUTLS_STATE state, const char* headers, int headers_size,
return err;
}
- if (plain.size != 0) /* in that case it is not allocated */
- gnutls_free_datum(&comp);
+ gnutls_free_datum(&comp);
/* copy the headers */
memcpy( ciph.data, headers, headers_size);
@@ -95,8 +96,10 @@ int _gnutls_decrypt(GNUTLS_STATE state, char *ciphertext,
return ret;
}
- if (gcomp.size==0) gtxt = gcomp;
- else {
+ if (gcomp.size==0) {
+ gtxt.data = NULL;
+ gtxt.size = 0;
+ } else {
ret = _gnutls_TLSCompressed2plaintext(state, &gtxt, gcomp);
if (ret < 0) {
gnutls_free_datum(&gcomp);
diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c
index 876442f728..b0204a4e55 100644
--- a/lib/gnutls_x509.c
+++ b/lib/gnutls_x509.c
@@ -1168,7 +1168,7 @@ static int read_cert_file(GNUTLS_CERTIFICATE_CREDENTIALS res, char *certfile)
fd1 = fopen(certfile, "r");
if (fd1 == NULL)
- return GNUTLS_E_UNKNOWN_ERROR;
+ return GNUTLS_E_FILE_ERROR;
siz = fread(x, 1, sizeof(x), fd1);
fclose(fd1);
@@ -1191,7 +1191,7 @@ static int read_ca_file(GNUTLS_CERTIFICATE_CREDENTIALS res, char *cafile)
fd1 = fopen(cafile, "r");
if (fd1 == NULL) {
gnutls_assert();
- return GNUTLS_E_UNKNOWN_ERROR;
+ return GNUTLS_E_FILE_ERROR;
}
siz = fread(x, 1, sizeof(x), fd1);
@@ -1213,7 +1213,7 @@ static int read_key_file(GNUTLS_CERTIFICATE_CREDENTIALS res, char *keyfile)
fd2 = fopen(keyfile, "r");
if (fd2 == NULL)
- return GNUTLS_E_UNKNOWN_ERROR;
+ return GNUTLS_E_FILE_ERROR;
siz = fread(x, 1, sizeof(x), fd2);
fclose(fd2);
@@ -1910,7 +1910,7 @@ int _gnutls_verify_x509_file( char *cafile)
fd1 = fopen(cafile, "r");
if (fd1 == NULL) {
gnutls_assert();
- return GNUTLS_E_UNKNOWN_ERROR;
+ return GNUTLS_E_FILE_ERROR;
}
siz = fread(x, 1, sizeof(x), fd1);