From 2e1068f30c8432135b58919b7e42d9940a90aa1d Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 18 Jan 2017 16:50:00 -0800 Subject: [PATCH] Added stubs for new OBJ_cleanup, OBJ_nid2obj, OBJ_obj2txt. Added openssl/objects.h for compatibility. Moved around OBJ function defs. --- src/ssl.c | 77 +++++++++++++++++++++++++------------- wolfssl/openssl/include.am | 1 + wolfssl/openssl/objects.h | 61 ++++++++++++++++++++++++++++++ wolfssl/openssl/ssl.h | 5 --- wolfssl/ssl.h | 5 --- 5 files changed, 114 insertions(+), 35 deletions(-) create mode 100644 wolfssl/openssl/objects.h diff --git a/src/ssl.c b/src/ssl.c index 6d0ed138f..d0fad9999 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -24758,14 +24758,6 @@ void* wolfSSL_GetDhAgreeCtx(WOLFSSL* ssl) return NULL; } - int wolfSSL_OBJ_obj2nid(const WOLFSSL_ASN1_OBJECT *o) { - (void)o; - WOLFSSL_ENTER("wolfSSL_OBJ_obj2nid"); - WOLFSSL_STUB("wolfSSL_OBJ_obj2nid"); - - return 0; - } - int wolfSSL_OBJ_sn2nid(const char *sn) { int i; WOLFSSL_ENTER("wolfSSL_OBJ_osn2nid"); @@ -24785,6 +24777,57 @@ void* wolfSSL_GetDhAgreeCtx(WOLFSSL* ssl) } #endif /* HAVE_ECC */ + int wolfSSL_OBJ_obj2nid(const WOLFSSL_ASN1_OBJECT *o) { + (void)o; + WOLFSSL_ENTER("wolfSSL_OBJ_obj2nid"); + WOLFSSL_STUB("wolfSSL_OBJ_obj2nid"); + + return 0; + } + + WOLFSSL_ASN1_OBJECT* wolfSSL_OBJ_nid2obj(int n) + { + (void)n; + + WOLFSSL_STUB("wolfSSL_OBJ_nid2obj"); + + return NULL; + } + + int wolfSSL_OBJ_obj2txt(char *buf, int buf_len, WOLFSSL_ASN1_OBJECT *a, int no_name) + { + (void)buf; + (void)buf_len; + (void)a; + (void)no_name; + + WOLFSSL_STUB("wolfSSL_OBJ_obj2txt"); + + return 0; + } + + char * wolfSSL_OBJ_nid2ln(int n) + { + (void)n; + WOLFSSL_ENTER("wolfSSL_OBJ_nid2ln"); + WOLFSSL_STUB("wolfSSL_OBJ_nid2ln"); + + return NULL; + } + + int wolfSSL_OBJ_txt2nid(const char* s) + { + (void)s; + WOLFSSL_STUB("wolfSSL_OBJ_txt2nid"); + + return 0; + } + + void wolfSSL_OBJ_cleanup(void) + { + WOLFSSL_STUB("wolfSSL_OBJ_cleanup"); + } + void wolfSSL_CTX_set_verify_depth(WOLFSSL_CTX *ctx, int depth) { WOLFSSL_ENTER("wolfSSL_CTX_set_verify_depth"); @@ -25197,23 +25240,7 @@ void wolfSSL_BUF_MEM_free(WOLFSSL_BUF_MEM* buf) #if defined(HAVE_LIGHTY) || defined(HAVE_STUNNEL) \ - || defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(OPENSSL_EXTRA) || defined(WOLFSSL_HAPROXY) -char * wolfSSL_OBJ_nid2ln(int n) { - (void)n; - WOLFSSL_ENTER("wolfSSL_OBJ_nid2ln"); - WOLFSSL_STUB("wolfSSL_OBJ_nid2ln"); - - return NULL; -} - -int wolfSSL_OBJ_txt2nid(const char* s) { - (void)s; - WOLFSSL_ENTER("wolfSSL_OBJ_txt2nid"); - WOLFSSL_STUB("wolfSSL_OBJ_txt2nid"); - - return 0; -} - + || defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(OPENSSL_EXTRA) WOLFSSL_BIO *wolfSSL_BIO_new_file(const char *filename, const char *mode) { diff --git a/wolfssl/openssl/include.am b/wolfssl/openssl/include.am index 563b35406..44fe0370d 100644 --- a/wolfssl/openssl/include.am +++ b/wolfssl/openssl/include.am @@ -25,6 +25,7 @@ nobase_include_HEADERS+= \ wolfssl/openssl/md4.h \ wolfssl/openssl/md5.h \ wolfssl/openssl/ripemd.h \ + wolfssl/openssl/objects.h \ wolfssl/openssl/ocsp.h \ wolfssl/openssl/opensslconf.h \ wolfssl/openssl/opensslv.h \ diff --git a/wolfssl/openssl/objects.h b/wolfssl/openssl/objects.h new file mode 100644 index 000000000..a6ffd5916 --- /dev/null +++ b/wolfssl/openssl/objects.h @@ -0,0 +1,61 @@ +/* objects.h + * + * Copyright (C) 2006-2016 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLFSSL_OBJECTS_H_ +#define WOLFSSL_OBJECTS_H_ + +#include +#include + +#ifdef __cplusplus + extern "C" { +#endif + + +WOLFSSL_API const char * wolfSSL_OBJ_nid2sn(int n); +WOLFSSL_API int wolfSSL_OBJ_obj2nid(const WOLFSSL_ASN1_OBJECT *o); +WOLFSSL_API int wolfSSL_OBJ_sn2nid(const char *sn); + +WOLFSSL_API char* wolfSSL_OBJ_nid2ln(int n); +WOLFSSL_API int wolfSSL_OBJ_txt2nid(const char *sn); + +WOLFSSL_API WOLFSSL_ASN1_OBJECT* wolfSSL_OBJ_nid2obj(int n); +WOLFSSL_API int wolfSSL_OBJ_obj2txt(char *buf, int buf_len, WOLFSSL_ASN1_OBJECT *a, int no_name); + +WOLFSSL_API void wolfSSL_OBJ_cleanup(void); + + +#define OBJ_nid2sn wolfSSL_OBJ_nid2sn +#define OBJ_obj2nid wolfSSL_OBJ_obj2nid +#define OBJ_sn2nid wolfSSL_OBJ_sn2nid +#define OBJ_nid2ln wolfSSL_OBJ_nid2ln +#define OBJ_txt2nid wolfSSL_OBJ_txt2nid +#define OBJ_nid2obj wolfSSL_OBJ_nid2obj +#define OBJ_obj2txt wolfSSL_OBJ_obj2txt +#define OBJ_cleanup wolfSSL_OBJ_cleanup + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_OBJECTS_H_ */ diff --git a/wolfssl/openssl/ssl.h b/wolfssl/openssl/ssl.h index 5462c68f4..ec6cd1a69 100644 --- a/wolfssl/openssl/ssl.h +++ b/wolfssl/openssl/ssl.h @@ -513,9 +513,6 @@ typedef WOLFSSL_X509_NAME_ENTRY X509_NAME_ENTRY; #define SSL_CTX_use_PrivateKey wolfSSL_CTX_use_PrivateKey #define BIO_read_filename wolfSSL_BIO_read_filename #define BIO_s_file wolfSSL_BIO_s_file -#define OBJ_nid2sn wolfSSL_OBJ_nid2sn -#define OBJ_obj2nid wolfSSL_OBJ_obj2nid -#define OBJ_sn2nid wolfSSL_OBJ_sn2nid #define SSL_CTX_set_verify_depth wolfSSL_CTX_set_verify_depth #define SSL_set_verify_depth wolfSSL_set_verify_depth #define SSL_get_app_data wolfSSL_get_app_data @@ -534,8 +531,6 @@ typedef WOLFSSL_X509_NAME_ENTRY X509_NAME_ENTRY; #define NID_commonName 0x03 /* matchs ASN_COMMON_NAME in asn.h */ -#define OBJ_nid2ln wolfSSL_OBJ_nid2ln -#define OBJ_txt2nid wolfSSL_OBJ_txt2nid #define PEM_read_bio_DHparams wolfSSL_PEM_read_bio_DHparams #define PEM_read_bio_DSAparams wolfSSL_PEM_read_bio_DSAparams #define PEM_write_bio_X509 wolfSSL_PEM_write_bio_X509 diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 3b50c6fe8..ce7140aae 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -2400,9 +2400,6 @@ WOLFSSL_API void wolfSSL_X509_NAME_free(WOLFSSL_X509_NAME *name); WOLFSSL_API char wolfSSL_CTX_use_certificate(WOLFSSL_CTX *ctx, WOLFSSL_X509 *x); WOLFSSL_API int wolfSSL_BIO_read_filename(WOLFSSL_BIO *b, const char *name); /* These are to be merged shortly */ -WOLFSSL_API const char * wolfSSL_OBJ_nid2sn(int n); -WOLFSSL_API int wolfSSL_OBJ_obj2nid(const WOLFSSL_ASN1_OBJECT *o); -WOLFSSL_API int wolfSSL_OBJ_sn2nid(const char *sn); WOLFSSL_API void wolfSSL_CTX_set_verify_depth(WOLFSSL_CTX *ctx,int depth); WOLFSSL_API void wolfSSL_set_verify_depth(WOLFSSL *ssl,int depth); WOLFSSL_API void* wolfSSL_get_app_data( const WOLFSSL *ssl); @@ -2423,8 +2420,6 @@ WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_NAME) *wolfSSL_dup_CA_list( WOLF_STACK_OF || defined(WOLFSSL_HAPROXY) \ || defined(OPENSSL_EXTRA) -WOLFSSL_API char* wolfSSL_OBJ_nid2ln(int n); -WOLFSSL_API int wolfSSL_OBJ_txt2nid(const char *sn); WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_new_file(const char *filename, const char *mode); WOLFSSL_API long wolfSSL_CTX_set_tmp_dh(WOLFSSL_CTX*, WOLFSSL_DH*); WOLFSSL_API WOLFSSL_DH *wolfSSL_PEM_read_bio_DHparams(WOLFSSL_BIO *bp,