Certificate stuff
FossilOrigin-Name: f5efe9f37f9bcc74b5f814cdb48dd4986ccbc6088bf5431f4a51583b97e182e3
This commit is contained in:
		@ -490,6 +490,25 @@ static int wtpman_establish_dtls(void *arg)
 | 
			
		||||
	cw_dbg(DBG_DTLS,"DTLS session established with %s, cipher=%s", CLIENT_IP,dtls_get_cipher(wtpman->conn));
 | 
			
		||||
	/* DTLS handshake done */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	int cert_len;
 | 
			
		||||
	struct dtls_ssl_cert cert;
 | 
			
		||||
 | 
			
		||||
	FILE *f;
 | 
			
		||||
	f = fopen ("pcert.der","wb");
 | 
			
		||||
 | 
			
		||||
	printf("Calling peers cert\n");
 | 
			
		||||
	cert = dtls_get_peers_cert(wtpman->conn,0);
 | 
			
		||||
	printf("Back from peers cert\n");
 | 
			
		||||
	
 | 
			
		||||
	printf("Have Peers Cert: %p, %d\n",cert.data,cert.size);
 | 
			
		||||
	fwrite(cert.data,1,cert.size,f);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	exit(0);
 | 
			
		||||
 | 
			
		||||
//	dtls_get_peers_cert(cert_len,&cert_len);
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -156,7 +156,8 @@ DTLSOBJS+= dtls_gnutls.o \
 | 
			
		||||
	dtls_gnutls_accept.o \
 | 
			
		||||
	dtls_gnutls_connect.o \
 | 
			
		||||
	dtls_gnutls_bio.o \
 | 
			
		||||
	dtls_gnutls_get_cipher.o
 | 
			
		||||
	dtls_gnutls_get_cipher.o \
 | 
			
		||||
	dtls_gnutls_get_peers_cert.o
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
DTLSOBJS+=dtls_bio.o 
 | 
			
		||||
 | 
			
		||||
@ -19,6 +19,19 @@
 | 
			
		||||
#ifndef __DTLS_H
 | 
			
		||||
#define __DTLS_H
 | 
			
		||||
 | 
			
		||||
struct dtls_ssl_cert 
 | 
			
		||||
{
 | 
			
		||||
	int size;
 | 
			
		||||
	int type;
 | 
			
		||||
	uint8_t * data;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
extern int dtls_bio_read(struct conn *conn, char *out, int maxlen);
 | 
			
		||||
extern int dtls_bio_write(struct conn * conn, const char *data, int len);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef WITH_GNUTLS
 | 
			
		||||
	#include "dtls_gnutls.h"
 | 
			
		||||
	#define dtls_init dtls_gnutls_init
 | 
			
		||||
@ -26,6 +39,7 @@
 | 
			
		||||
	#define dtls_connect dtls_gnutls_connect
 | 
			
		||||
	#define dtls_shutdown dtls_gnutls_shutdown
 | 
			
		||||
	#define dtls_get_cipher dtls_gnutls_get_cipher
 | 
			
		||||
	#define dtls_get_peers_cert dtls_gnutls_get_peers_cert
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
	#include "dtls_openssl.h"
 | 
			
		||||
@ -37,8 +51,6 @@
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
extern int dtls_bio_read(struct conn *conn, char *out, int maxlen);
 | 
			
		||||
extern int dtls_bio_write(struct conn * conn, const char *data, int len);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -32,6 +32,7 @@ extern int dtls_gnutls_init();
 | 
			
		||||
extern int dtls_gnutls_accept(struct conn * conn);
 | 
			
		||||
extern int dtls_gnutls_connect(struct conn * conn);
 | 
			
		||||
extern const char * dtls_gnutls_get_cipher(struct conn * conn);
 | 
			
		||||
struct dtls_ssl_cert dtls_gnutls_get_peers_cert(struct conn * conn,unsigned int n);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* functions used only by capwap libray */
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user