Skip to content

Commit

Permalink
Move the SCT List extension parser into libssl.
Browse files Browse the repository at this point in the history
Add the extension parser in the s_client, ocsp and x509 apps.
  • Loading branch information
Rob Stradling committed Feb 19, 2014
1 parent dcfe8df commit b263f21
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 280 deletions.
2 changes: 2 additions & 0 deletions apps/ocsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ int MAIN(int argc, char **argv)
goto end;
SSL_load_error_strings();
OpenSSL_add_ssl_algorithms();
X509V3_EXT_add_rfc6962();
args = argv + 1;
reqnames = sk_OPENSSL_STRING_new_null();
ids = sk_OCSP_CERTID_new_null();
Expand Down Expand Up @@ -970,6 +971,7 @@ int MAIN(int argc, char **argv)
OPENSSL_free(path);
}

X509V3_EXT_cleanup();
OPENSSL_EXIT(ret);
}

Expand Down
3 changes: 3 additions & 0 deletions apps/s_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,8 @@ static char *jpake_secret = NULL;
c_msg=0;
c_showcerts=0;

X509V3_EXT_add_rfc6962();

if (bio_err == NULL)
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);

Expand Down Expand Up @@ -2193,6 +2195,7 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
BIO_free(bio_c_msg);
bio_c_msg=NULL;
}
X509V3_EXT_cleanup();
apps_shutdown();
OPENSSL_EXIT(ret);
}
Expand Down
4 changes: 4 additions & 0 deletions apps/x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#include <openssl/x509v3.h>
#include <openssl/objects.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
#endif
Expand Down Expand Up @@ -224,6 +225,8 @@ int MAIN(int argc, char **argv)

apps_startup();

X509V3_EXT_add_rfc6962();

if (bio_err == NULL)
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);

Expand Down Expand Up @@ -1155,6 +1158,7 @@ int MAIN(int argc, char **argv)
sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
if (passin) OPENSSL_free(passin);
X509V3_EXT_cleanup();
apps_shutdown();
OPENSSL_EXIT(ret);
}
Expand Down
4 changes: 2 additions & 2 deletions crypto/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o \
SRC= $(LIBSRC)

EXHEADER= crypto.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
ossl_typ.h
HEADER= cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(EXHEADER)
ossl_typ.h o_time.h
HEADER= cryptlib.h buildinf.h md32_common.h o_str.h o_dir.h $(EXHEADER)

ALL= $(GENERAL) $(SRC) $(HEADER)

Expand Down
22 changes: 22 additions & 0 deletions crypto/bio/b_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,25 @@ int BIO_dump_indent(BIO *bp, const char *s, int len, int indent)
return BIO_dump_indent_cb(write_bio, bp, s, len, indent);
}

int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data,
int datalen)
{
int i, j = 0;

if (datalen < 1)
return 1;

for (i = 0; i < datalen - 1; i++)
{
if (i && !j) BIO_printf(out, "%*s", indent, "");

BIO_printf(out, "%02X:", data[i]);

j = (j + 1) % width;
if (!j) BIO_printf(out, "\n");
}

if (i && !j) BIO_printf(out, "%*s", indent, "");
BIO_printf(out, "%02X", data[datalen - 1]);
return 1;
}
3 changes: 3 additions & 0 deletions crypto/bio/bio.h
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@ int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent);
int BIO_dump_fp(FILE *fp, const char *s, int len);
int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent);
#endif
int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data,
int datalen);

struct hostent *BIO_gethostbyname(const char *name);
/* We might want a thread-safe interface too:
* struct hostent *BIO_gethostbyname_r(const char *name,
Expand Down
2 changes: 1 addition & 1 deletion crypto/crypto-lib.com
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ $ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ -
"v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info,"+ -
"v3_ocsp,v3_akeya,v3_pmaps,v3_pcons,v3_ncons,v3_pcia,v3_pci,"+ -
"pcy_cache,pcy_node,pcy_data,pcy_map,pcy_tree,pcy_lib,"+ -
"v3_asid,v3_addr,v3_scts"
"v3_asid,v3_addr"
$ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def,conf_mod,conf_mall,conf_sap"
$ LIB_TXT_DB = "txt_db"
$ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ -
Expand Down
4 changes: 2 additions & 2 deletions crypto/x509v3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ v3_prn.c v3_utl.c v3err.c v3_genn.c v3_alt.c v3_skey.c v3_akey.c v3_pku.c \
v3_int.c v3_enum.c v3_sxnet.c v3_cpols.c v3_crld.c v3_purp.c v3_info.c \
v3_ocsp.c v3_akeya.c v3_pmaps.c v3_pcons.c v3_ncons.c v3_pcia.c v3_pci.c \
pcy_cache.c pcy_node.c pcy_data.c pcy_map.c pcy_tree.c pcy_lib.c \
v3_asid.c v3_addr.c v3_scts.c
v3_asid.c v3_addr.c
LIBOBJ= v3_bcons.o v3_bitst.o v3_conf.o v3_extku.o v3_ia5.o v3_lib.o \
v3_prn.o v3_utl.o v3err.o v3_genn.o v3_alt.o v3_skey.o v3_akey.o v3_pku.o \
v3_int.o v3_enum.o v3_sxnet.o v3_cpols.o v3_crld.o v3_purp.o v3_info.o \
v3_ocsp.o v3_akeya.o v3_pmaps.o v3_pcons.o v3_ncons.o v3_pcia.o v3_pci.o \
pcy_cache.o pcy_node.o pcy_data.o pcy_map.o pcy_tree.o pcy_lib.o \
v3_asid.o v3_addr.o v3_scts.o
v3_asid.o v3_addr.o

SRC= $(LIBSRC)

Expand Down
3 changes: 0 additions & 3 deletions crypto/x509v3/ext_dat.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ extern X509V3_EXT_METHOD v3_crl_hold, v3_pci;
extern X509V3_EXT_METHOD v3_policy_mappings, v3_policy_constraints;
extern X509V3_EXT_METHOD v3_name_constraints, v3_inhibit_anyp, v3_idp;
extern X509V3_EXT_METHOD v3_addr, v3_asid;
extern X509V3_EXT_METHOD v3_ct_scts[];

/* This table will be searched using OBJ_bsearch so it *must* kept in
* order of the ext_nid values.
Expand Down Expand Up @@ -125,8 +124,6 @@ static const X509V3_EXT_METHOD *standard_exts[] = {
&v3_idp,
&v3_alt[2],
&v3_freshest_crl,
&v3_ct_scts[0],
&v3_ct_scts[1],
};

/* Number of standard extensions */
Expand Down

0 comments on commit b263f21

Please sign in to comment.