"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ssl/sslxprint.c" between
ssldump-0.9b3.tar.gz and ssldump-1.3.tar.gz

About: ssldump is an SSLv3/TLS network protocol analyzer.

sslxprint.c  (ssldump-0.9b3):sslxprint.c  (ssldump-1.3)
skipping to change at line 44 skipping to change at line 44
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMA GE. OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMA GE.
$Id: sslxprint.c,v 1.3 2000/11/03 06:38:06 ekr Exp $ $Id: sslxprint.c,v 1.3 2000/11/03 06:38:06 ekr Exp $
ekr@rtfm.com Thu Mar 25 21:17:16 1999 ekr@rtfm.com Thu Mar 25 21:17:16 1999
*/ */
static char *RCSSTRING="$Id: sslxprint.c,v 1.3 2000/11/03 06:38:06 ekr Exp $"; #include <json-c/json.h>
#include "network.h" #include "network.h"
#include "ssl_h.h" #include "ssl_h.h"
#include "sslprint.h" #include "sslprint.h"
#include "ssl.enums.h" #include "ssl.enums.h"
#ifdef OPENSSL #ifdef OPENSSL
#include <openssl/asn1.h> #include <openssl/asn1.h>
#include <openssl/x509.h> #include <openssl/x509.h>
#include <openssl/x509v3.h> #include <openssl/x509v3.h>
#endif #endif
skipping to change at line 74 skipping to change at line 73
ssl_obj *ssl; ssl_obj *ssl;
Data *data; Data *data;
int pf; int pf;
{ {
#ifdef OPENSSL #ifdef OPENSSL
X509 *x=0; X509 *x=0;
ASN1_INTEGER *a; ASN1_INTEGER *a;
#endif #endif
UCHAR *d; UCHAR *d;
int _status; int _status;
struct json_object *cert_obj;
#ifdef OPENSSL #ifdef OPENSSL
P_(P_ASN){ P_(P_ASN){
char buf[BUFSIZE]; char buf[BUFSIZE];
int ext; int ext;
char *b64_cert;
char *serial_str = NULL;
Data data_tmp;
struct json_object *jobj;
jobj = ssl->cur_json_st;
cert_obj = json_object_new_object();
d=data->data; d=data->data;
if(!(x=d2i_X509(0,&d,data->len))){ if(!(b64_cert=(char *)calloc(1,sizeof(char) * ((((data->len) + 3 - 1)/3) *
4 + 1))))
ABORT(R_NO_MEMORY);
EVP_EncodeBlock((unsigned char *)b64_cert, d, data->len);
json_object_object_add(cert_obj, "cert_der", json_object_new_string(b64_ce
rt));
free(b64_cert);
if(!(x=d2i_X509(0,(const unsigned char **) &d,data->len))){
explain(ssl,"Bad certificate"); explain(ssl,"Bad certificate");
ABORT(R_BAD_DATA); ABORT(R_BAD_DATA);
} }
X509_NAME_oneline(X509_get_subject_name(x),buf, X509_NAME_oneline(X509_get_subject_name(x),buf,
BUFSIZE); BUFSIZE);
explain(ssl,"Subject\n"); explain(ssl,"Subject\n");
INDENT_INCR; INDENT_INCR;
json_object_object_add(cert_obj, "cert_subject", json_object_new_string(bu f));
sslx__print_dn(ssl,buf); sslx__print_dn(ssl,buf);
INDENT_POP; INDENT_POP;
X509_NAME_oneline(X509_get_issuer_name(x),buf, X509_NAME_oneline(X509_get_issuer_name(x),buf,
BUFSIZE); BUFSIZE);
explain(ssl,"Issuer\n"); explain(ssl,"Issuer\n");
INDENT_INCR; INDENT_INCR;
json_object_object_add(cert_obj, "cert_issuer", json_object_new_string(buf ));
sslx__print_dn(ssl,buf); sslx__print_dn(ssl,buf);
INDENT_POP; INDENT_POP;
a=X509_get_serialNumber(x); a=X509_get_serialNumber(x);
explain(ssl,"Serial "); explain(ssl,"Serial ");
if(!(serial_str=(char *)calloc(1,sizeof(char) * (a->length * 3))))
ABORT(R_NO_MEMORY);
INIT_DATA(data_tmp,a->data,a->length);
exstr(ssl, serial_str, &data_tmp);
json_object_object_add(cert_obj, "cert_serial", json_object_new_string(ser
ial_str));
free(serial_str);
sslx__print_serial(ssl,a); sslx__print_serial(ssl,a);
ext=X509_get_ext_count(x); ext=X509_get_ext_count(x);
if(ext>0){ if(ext>0){
int i,j; int i,j;
UCHAR buf[1024]; UCHAR buf[1024];
explain(ssl,"Extensions\n"); explain(ssl,"Extensions\n");
INDENT_INCR; INDENT_INCR;
for(i=0;i<ext;i++){ for(i=0;i<ext;i++){
X509_EXTENSION *ex; X509_EXTENSION *ex;
ASN1_OBJECT *obj; ASN1_OBJECT *obj;
ex=X509_get_ext(x,i); ex=X509_get_ext(x,i);
obj=X509_EXTENSION_get_object(ex); obj=X509_EXTENSION_get_object(ex);
i2t_ASN1_OBJECT(buf,sizeof(buf),obj); i2t_ASN1_OBJECT((char *)buf,sizeof(buf),obj);
explain(ssl,"Extension: %s\n",buf); explain(ssl,"Extension: %s\n",buf);
j=X509_EXTENSION_get_critical(ex); j=X509_EXTENSION_get_critical(ex);
if(j){ if(j){
INDENT; INDENT;
explain(ssl,"Critical\n"); explain(ssl,"Critical\n");
} }
if(SSL_print_flags & SSL_PRINT_NROFF){ if(SSL_print_flags & SSL_PRINT_NROFF){
if(ssl->process_ciphertext&ssl->direction) if(ssl->process_ciphertext&ssl->direction)
printf("\\f(CI"); printf("\\f(CI");
skipping to change at line 148 skipping to change at line 172
INDENT_POP; INDENT_POP;
} }
else{ else{
#endif #endif
P_(pf){ P_(pf){
exdump(ssl,"certificate",data); exdump(ssl,"certificate",data);
} }
#ifdef OPENSSL #ifdef OPENSSL
} }
struct json_object *certs_array;
json_object_object_get_ex(jobj, "cert_chain", &certs_array);
json_object_array_add(certs_array,cert_obj);
} }
#endif #endif
_status=0; _status=0;
abort: abort:
#ifdef OPENSSL #ifdef OPENSSL
if(x) X509_free(x); if(x) X509_free(x);
#endif #endif
if(_status && cert_obj) json_object_put(cert_obj);
return(_status); return(_status);
} }
int sslx_print_dn(ssl,data,pf) int sslx_print_dn(ssl,data,pf)
ssl_obj *ssl; ssl_obj *ssl;
Data *data; Data *data;
int pf; int pf;
{ {
UCHAR buf[BUFSIZE]; UCHAR buf[BUFSIZE];
int _status; int _status;
UCHAR *d=data->data; UCHAR *d=data->data;
#ifdef OPENSSL #ifdef OPENSSL
X509_NAME *n=0; X509_NAME *n=0;
#endif #endif
P_(pf){ P_(pf){
#ifdef OPENSSL #ifdef OPENSSL
P_(P_ASN){ P_(P_ASN){
if(!(n=d2i_X509_NAME(0,&d,data->len))) if(!(n=d2i_X509_NAME(0,(const unsigned char **) &d,data->len)))
ABORT(R_BAD_DATA); ABORT(R_BAD_DATA);
X509_NAME_oneline(n,buf,BUFSIZE); X509_NAME_oneline(n,(char *)buf,BUFSIZE);
sslx__print_dn(ssl,buf); sslx__print_dn(ssl,(char *)buf);
} }
else{ else{
#endif #endif
exdump(ssl,0,data); exdump(ssl,0,data);
#ifdef OPENSSL #ifdef OPENSSL
} }
#endif #endif
} }
_status=0; _status=0;
skipping to change at line 204 skipping to change at line 233
static int sslx__print_dn(ssl,x) static int sslx__print_dn(ssl,x)
ssl_obj *ssl; ssl_obj *ssl;
char *x; char *x;
{ {
char *slash; char *slash;
if(*x=='/') x++; if(*x=='/') x++;
while (x){ while (x){
if(slash=strchr(x,'/')){ if((slash=strchr(x,'/'))){
*slash=0; *slash=0;
} }
explain(ssl,"%s\n",x); explain(ssl,"%s\n",x);
x=slash?slash+1:0; x=slash?slash+1:0;
}; };
return(0); return(0);
} }
 End of changes. 13 change blocks. 
8 lines changed or deleted 40 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)