Use appropriate versions of SSL3_ENC_METHOD
[oweals/openssl.git] / ssl / dnssec.c
index f6c26448cded5ff6144cef83ff1357993331ff77..719b0647bd638e79c95485081f631c57e6c76a46 100644 (file)
@@ -2,9 +2,12 @@
 
 #include <string.h>
 #include <netdb.h>
+#include <sys/socket.h>
 #include <openssl/bio.h>
 #include <openssl/dso.h>
 
+#include "ssl.h"
+
 #ifndef OPENSSL_NO_LIBUNBOUND
 #include <unbound.h>
 
@@ -80,7 +83,24 @@ unsigned char *SSL_get_tlsa_record_byname (const char *name,int port,int type)
        char *query=NULL;
        size_t qlen;
 
+#ifndef OPENSSL_NO_LIBUNBOUND
        if (ctx == NULL) return NULL;
+#elif defined(RRSET_VALIDATED)
+       static union {
+               void *p; int (*f)(const char*,unsigned int,unsigned int,unsigned int,struct rrsetinfo **); }
+               p_getrrsetbyname = {NULL};
+       static union {
+               void *p; void (*f)(struct rrsetinfo *); }
+               p_freerrset = {NULL};
+
+       if (p_getrrsetbyname.p==NULL) {
+               if ((p_getrrsetbyname.p = DSO_global_lookup("getrrsetbyname")) == NULL ||
+                   (p_freerrset.p = DSO_global_lookup("freerrset")) == NULL)
+                       p_getrrsetbyname.p = (void*)-1;
+       }
+
+       if (p_getrrsetbyname.p == (void *)-1) return NULL;
+#endif
 
        qlen = 7+5+strlen(name)+1;
        if ((query = OPENSSL_malloc(qlen)) == NULL)
@@ -117,24 +137,9 @@ unsigned char *SSL_get_tlsa_record_byname (const char *name,int port,int type)
        }
        }
 #elif defined(RRSET_VALIDATED)
-       do {
-       static union {
-               void *p; int (*f)(const char*,unsigned int,unsigned int,unsigned int,struct rrsetinfo **); }
-               p_getrrsetbyname = {NULL};
-       static union {
-               void *p; void (*f)(struct rrsetinfo *); }
-               p_freerrset = {NULL};
-
+       {
        struct rrsetinfo *rrset=NULL;
 
-       if (p_getrrsetbyname.p==NULL) {
-               if ((p_getrrsetbyname.p = DSO_global_lookup("getrrsetbyname")) == NULL ||
-                   (p_freerrset.p = DSO_global_lookup("freerrset")) == NULL)
-                       p_getrrsetbyname.p = (void*)-1;
-       }
-
-       if (p_getrrsetbyname.p == (void *)-1) break;
-
        if (p_getrrsetbyname.f(query,1,52,RRSET_VALIDATED,&rrset) == 0 && rrset->rri_nrdatas) {
                ret=(void*)-1;  /* -1 means insecure */
                if ((rrset->rri_flags&RRSET_VALIDATED)) do {
@@ -157,7 +162,7 @@ unsigned char *SSL_get_tlsa_record_byname (const char *name,int port,int type)
                } while (0);    
                p_freerrset.f(rrset);
        }
-       } while (0);
+       }
 #elif defined(_WIN32_NOT_YET)
        {
        PDNS_RECORD rrset;