summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2003-11-10 21:21:07 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2003-11-10 21:21:07 +0000
commita079708e058324b0233a7d11c8278ecd726f3a5d (patch)
treeca4be51b5ce062249ed855504cd6d4adc6c9f4da
parent2cefc18b9a397b266e4352dfc160cb876d47811e (diff)
downloadgnutls-a079708e058324b0233a7d11c8278ecd726f3a5d.tar.gz
Removed the gnutls_handshake_set_rsa_pms_check() prototype from gnutls.h. Corrected the *_get_dn() functions to return the data size if the data argument is NULL, and *data_size == 0. Bugs reported by Gergely Nagy <algernon@bonehunter.rulez.org>.
-rw-r--r--lib/gnutls.h.in.in1
-rw-r--r--lib/x509/common.c4
-rw-r--r--lib/x509/crl.c12
-rw-r--r--lib/x509/crq.c12
-rw-r--r--lib/x509/dn.c20
-rw-r--r--lib/x509/x509.c24
6 files changed, 12 insertions, 61 deletions
diff --git a/lib/gnutls.h.in.in b/lib/gnutls.h.in.in
index a6bfeb2703..f1c9a19a0f 100644
--- a/lib/gnutls.h.in.in
+++ b/lib/gnutls.h.in.in
@@ -211,7 +211,6 @@ const char* gnutls_strerror( int error);
/* Semi-internal functions.
*/
void gnutls_handshake_set_private_extensions(gnutls_session session, int allow);
-void gnutls_handshake_set_rsa_pms_check(gnutls_session session, int check);
gnutls_handshake_description gnutls_handshake_get_last_out( gnutls_session session);
gnutls_handshake_description gnutls_handshake_get_last_in( gnutls_session session);
diff --git a/lib/x509/common.c b/lib/x509/common.c
index ffa138bd0f..ec76e18463 100644
--- a/lib/x509/common.c
+++ b/lib/x509/common.c
@@ -125,8 +125,8 @@ ASN1_TYPE tmpasn = ASN1_TYPE_EMPTY;
return GNUTLS_E_INVALID_REQUEST;
}
- res[0] = 0;
-
+ if (res) res[0] = 0;
+
if ( _gnutls_x509_oid_data_printable( oid) == 0) {
gnutls_assert();
return GNUTLS_E_INTERNAL_ERROR;
diff --git a/lib/x509/crl.c b/lib/x509/crl.c
index d7b48d6e83..7b30cf842e 100644
--- a/lib/x509/crl.c
+++ b/lib/x509/crl.c
@@ -161,15 +161,9 @@ int gnutls_x509_crl_import(gnutls_x509_crl crl, const gnutls_datum * data,
int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl crl, char *buf,
size_t *sizeof_buf)
{
- if (sizeof_buf == 0 || crl == NULL) {
- return GNUTLS_E_INVALID_REQUEST;
- }
-
return _gnutls_x509_parse_dn(crl->crl,
"tbsCertList.issuer.rdnSequence",
buf, sizeof_buf);
-
-
}
/**
@@ -196,15 +190,9 @@ int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl crl,
const char *oid, int indx,
char *buf, size_t *sizeof_buf)
{
- if (sizeof_buf == 0 || crl == NULL) {
- return GNUTLS_E_INVALID_REQUEST;
- }
-
return _gnutls_x509_parse_dn_oid(crl->crl,
"tbsCertList.issuer.rdnSequence",
oid, indx, buf, sizeof_buf);
-
-
}
/**
diff --git a/lib/x509/crq.c b/lib/x509/crq.c
index 6988e60645..79a653c0c3 100644
--- a/lib/x509/crq.c
+++ b/lib/x509/crq.c
@@ -171,14 +171,8 @@ int gnutls_x509_crq_import(gnutls_x509_crq crq, const gnutls_datum * data,
int gnutls_x509_crq_get_dn(gnutls_x509_crq crq, char *buf,
size_t *sizeof_buf)
{
- if (sizeof_buf == 0 || crq == NULL) {
- return GNUTLS_E_INVALID_REQUEST;
- }
-
return _gnutls_x509_parse_dn( crq->crq, "certificationRequestInfo.subject.rdnSequence",
buf, sizeof_buf);
-
-
}
/**
@@ -204,14 +198,8 @@ int gnutls_x509_crq_get_dn(gnutls_x509_crq crq, char *buf,
int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq crq, const char* oid,
int indx, char *buf, size_t *sizeof_buf)
{
- if (sizeof_buf == 0 || crq == NULL) {
- return GNUTLS_E_INVALID_REQUEST;
- }
-
return _gnutls_x509_parse_dn_oid( crq->crq, "certificationRequestInfo.subject.rdnSequence", oid,
indx, buf, sizeof_buf);
-
-
}
/* Parses an Attribute list in the asn1_struct, and searches for the
diff --git a/lib/x509/dn.c b/lib/x509/dn.c
index 1ebd6de8d4..ea5c56e57f 100644
--- a/lib/x509/dn.c
+++ b/lib/x509/dn.c
@@ -97,12 +97,13 @@ int _gnutls_x509_parse_dn(ASN1_TYPE asn1_struct,
char oid[128];
int len, printable;
- if (*sizeof_buf == 0) {
+ if (sizeof_buf == NULL) {
gnutls_assert();
return GNUTLS_E_INVALID_REQUEST;
}
- buf[0] = 0;
+ if (buf) buf[0] = 0;
+ else *sizeof_buf = 0;
_gnutls_string_init(&out_str, gnutls_malloc, gnutls_realloc,
gnutls_free);
@@ -311,12 +312,10 @@ int _gnutls_x509_parse_dn_oid(ASN1_TYPE asn1_struct,
int len, printable;
int i = 0;
- if (*sizeof_buf == 0) {
- gnutls_assert();
- return GNUTLS_E_INVALID_REQUEST;
- }
-
- buf[0] = 0;
+ if (buf==NULL)
+ *sizeof_buf = 0;
+ else
+ buf[0] = 0;
k1 = 0;
do {
@@ -430,10 +429,11 @@ int _gnutls_x509_parse_dn_oid(ASN1_TYPE asn1_struct,
_gnutls_x509_oid_data_printable(oid);
if (printable == 1) {
- if ((result =
+ result =
_gnutls_x509_oid_data2string
(oid, value, len, buf,
- sizeof_buf)) < 0) {
+ sizeof_buf);
+ if (result < 0) {
gnutls_assert();
goto cleanup;
}
diff --git a/lib/x509/x509.c b/lib/x509/x509.c
index 19e5a53462..7df61d07bd 100644
--- a/lib/x509/x509.c
+++ b/lib/x509/x509.c
@@ -223,14 +223,8 @@ int gnutls_x509_crt_import(gnutls_x509_crt cert, const gnutls_datum * data,
int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt cert, char *buf,
size_t *sizeof_buf)
{
- if (sizeof_buf == 0 || cert == NULL) {
- return GNUTLS_E_INVALID_REQUEST;
- }
-
return _gnutls_x509_parse_dn( cert->cert, "tbsCertificate.issuer.rdnSequence",
buf, sizeof_buf);
-
-
}
/**
@@ -256,14 +250,8 @@ int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt cert, char *buf,
int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert, const char* oid,
int indx, char *buf, size_t *sizeof_buf)
{
- if (sizeof_buf == 0 || cert == NULL) {
- return GNUTLS_E_INVALID_REQUEST;
- }
-
return _gnutls_x509_parse_dn_oid( cert->cert, "tbsCertificate.issuer.rdnSequence", oid,
indx, buf, sizeof_buf);
-
-
}
/**
@@ -285,14 +273,8 @@ int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert, const char* oid,
int gnutls_x509_crt_get_dn(gnutls_x509_crt cert, char *buf,
size_t *sizeof_buf)
{
- if (sizeof_buf == 0 || cert == NULL) {
- return GNUTLS_E_INVALID_REQUEST;
- }
-
return _gnutls_x509_parse_dn( cert->cert, "tbsCertificate.subject.rdnSequence",
buf, sizeof_buf);
-
-
}
/**
@@ -318,14 +300,8 @@ int gnutls_x509_crt_get_dn(gnutls_x509_crt cert, char *buf,
int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert, const char* oid,
int indx, char *buf, size_t *sizeof_buf)
{
- if (sizeof_buf == 0 || cert == NULL) {
- return GNUTLS_E_INVALID_REQUEST;
- }
-
return _gnutls_x509_parse_dn_oid( cert->cert, "tbsCertificate.subject.rdnSequence", oid,
indx, buf, sizeof_buf);
-
-
}
/**