From 82271cee5b6369c263213845f8a81be40d5d5585 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 2 May 2000 12:16:01 +0000 Subject: In Message-ID: <003201bfb332$14a07520$0801a8c0@janm.transactionsite.com>, "Jan Mikkelsen" correctly states that the OpenSSL header files have #include's and extern "C"'s in an incorrect order. Thusly fixed. --- crypto/asn1/asn1.h | 8 ++++---- crypto/asn1/asn1_mac.h | 4 ++-- crypto/bio/bio.h | 8 ++++---- crypto/comp/comp.h | 4 ++-- crypto/conf/conf.h | 8 ++++---- crypto/conf/conf_api.h | 6 +++--- crypto/des/des.h | 8 ++++---- crypto/dh/dh.h | 8 ++++---- crypto/dsa/dsa.h | 8 ++++---- crypto/err/err.h | 8 ++++---- crypto/evp/evp.h | 8 ++++---- crypto/hmac/hmac.h | 8 ++++---- crypto/idea/idea.h | 8 ++++---- crypto/lhash/lhash.h | 8 ++++---- crypto/md2/md2.h | 8 ++++---- crypto/mdc2/mdc2.h | 4 ++-- crypto/objects/objects.h | 8 ++++---- crypto/pem/pem.h | 8 ++++---- crypto/pem/pem2.h | 8 ++++++++ crypto/pkcs12/pkcs12.h | 6 +++--- crypto/pkcs7/pkcs7.h | 8 ++++---- crypto/rand/rand.h | 19 +++++++++++++++---- crypto/rc2/rc2.h | 8 ++++---- crypto/rc4/rc4.h | 8 ++++---- crypto/rsa/rsa.h | 8 ++++---- crypto/txt_db/txt_db.h | 8 ++++---- crypto/x509/x509.h | 16 ++++++++++++---- crypto/x509/x509_vfy.h | 6 +++--- crypto/x509v3/x509v3.h | 8 ++++---- e_os2.h | 4 ++-- rsaref/rsaref.h | 14 +++++++------- ssl/ssl.h | 20 ++++++++++++++++++-- 32 files changed, 157 insertions(+), 114 deletions(-) diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h index 99bd64a11e..8cf317640e 100644 --- a/crypto/asn1/asn1.h +++ b/crypto/asn1/asn1.h @@ -59,10 +59,6 @@ #ifndef HEADER_ASN1_H #define HEADER_ASN1_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include @@ -72,6 +68,10 @@ extern "C" { #include #endif +#ifdef __cplusplus +extern "C" { +#endif + #define V_ASN1_UNIVERSAL 0x00 #define V_ASN1_APPLICATION 0x40 #define V_ASN1_CONTEXT_SPECIFIC 0x80 diff --git a/crypto/asn1/asn1_mac.h b/crypto/asn1/asn1_mac.h index 4f2a82d340..653f5fe1c9 100644 --- a/crypto/asn1/asn1_mac.h +++ b/crypto/asn1/asn1_mac.h @@ -59,12 +59,12 @@ #ifndef HEADER_ASN1_MAC_H #define HEADER_ASN1_MAC_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - #ifndef ASN1_MAC_ERR_LIB #define ASN1_MAC_ERR_LIB ERR_LIB_ASN1 #endif diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h index dd3cc3f470..3775072695 100644 --- a/crypto/bio/bio.h +++ b/crypto/bio/bio.h @@ -59,14 +59,14 @@ #ifndef HEADER_BIO_H #define HEADER_BIO_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* These are the 'types' of BIOs */ #define BIO_TYPE_NONE 0 #define BIO_TYPE_MEM (1|0x0400) diff --git a/crypto/comp/comp.h b/crypto/comp/comp.h index 811cb5833d..0922609542 100644 --- a/crypto/comp/comp.h +++ b/crypto/comp/comp.h @@ -2,12 +2,12 @@ #ifndef HEADER_COMP_H #define HEADER_COMP_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - typedef struct comp_method_st { int type; /* NID for compression library */ diff --git a/crypto/conf/conf.h b/crypto/conf/conf.h index 0ec58e1200..56b5f5c216 100644 --- a/crypto/conf/conf.h +++ b/crypto/conf/conf.h @@ -59,16 +59,16 @@ #ifndef HEADER_CONF_H #define HEADER_CONF_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include #include #include +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { char *section; diff --git a/crypto/conf/conf_api.h b/crypto/conf/conf_api.h index 05be7d8fb7..a5cc17b233 100644 --- a/crypto/conf/conf_api.h +++ b/crypto/conf/conf_api.h @@ -59,13 +59,13 @@ #ifndef HEADER_CONF_API_H #define HEADER_CONF_API_H +#include +#include + #ifdef __cplusplus extern "C" { #endif -#include -#include - /* Up until OpenSSL 0.9.5a, this was new_section */ CONF_VALUE *_CONF_new_section(CONF *conf, char *section); /* Up until OpenSSL 0.9.5a, this was get_section */ diff --git a/crypto/des/des.h b/crypto/des/des.h index ead67986d9..cf536e6428 100644 --- a/crypto/des/des.h +++ b/crypto/des/des.h @@ -59,10 +59,6 @@ #ifndef HEADER_DES_H #define HEADER_DES_H -#ifdef __cplusplus -extern "C" { -#endif - #ifdef NO_DES #error DES is disabled. #endif @@ -75,6 +71,10 @@ extern "C" { #include /* DES_LONG */ #include /* OPENSSL_EXTERN */ +#ifdef __cplusplus +extern "C" { +#endif + typedef unsigned char des_cblock[8]; typedef /* const */ unsigned char const_des_cblock[8]; /* With "const", gcc 2.8.1 on Solaris thinks that des_cblock * diff --git a/crypto/dh/dh.h b/crypto/dh/dh.h index c15b2ad483..19bd570309 100644 --- a/crypto/dh/dh.h +++ b/crypto/dh/dh.h @@ -59,10 +59,6 @@ #ifndef HEADER_DH_H #define HEADER_DH_H -#ifdef __cplusplus -extern "C" { -#endif - #ifdef NO_DH #error DH is disabled. #endif @@ -72,6 +68,10 @@ extern "C" { #define DH_FLAG_CACHE_MONT_P 0x01 +#ifdef __cplusplus +extern "C" { +#endif + typedef struct dh_st DH; typedef struct dh_method { diff --git a/crypto/dsa/dsa.h b/crypto/dsa/dsa.h index 68d9912cbc..ca301c5336 100644 --- a/crypto/dsa/dsa.h +++ b/crypto/dsa/dsa.h @@ -65,10 +65,6 @@ #ifndef HEADER_DSA_H #define HEADER_DSA_H -#ifdef __cplusplus -extern "C" { -#endif - #ifdef NO_DSA #error DSA is disabled. #endif @@ -81,6 +77,10 @@ extern "C" { #define DSA_FLAG_CACHE_MONT_P 0x01 +#ifdef __cplusplus +extern "C" { +#endif + typedef struct dsa_st DSA; typedef struct DSA_SIG_st diff --git a/crypto/err/err.h b/crypto/err/err.h index eb62af2af8..76a8ed1b38 100644 --- a/crypto/err/err.h +++ b/crypto/err/err.h @@ -59,14 +59,14 @@ #ifndef HEADER_ERR_H #define HEADER_ERR_H -#ifdef __cplusplus -extern "C" { -#endif - #ifndef NO_FP_API #include #endif +#ifdef __cplusplus +extern "C" { +#endif + /* The following is a bit of a trick to help the object files only contain * the 'name of the file' string once. Since 'err.h' is protected by the * HEADER_ERR_H stuff, this should be included only once per file. */ diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h index 54215b0905..6c0275b9e2 100644 --- a/crypto/evp/evp.h +++ b/crypto/evp/evp.h @@ -59,10 +59,6 @@ #ifndef HEADER_ENVELOPE_H #define HEADER_ENVELOPE_H -#ifdef __cplusplus -extern "C" { -#endif - #ifndef NO_MD2 #include #endif @@ -147,6 +143,10 @@ extern "C" { #define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 #define EVP_PKEY_DH NID_dhKeyAgreement +#ifdef __cplusplus +extern "C" { +#endif + /* Type needs to be a bit field * Sub-type needs to be for variations on the method, as in, can it do * arbitrary encryption.... */ diff --git a/crypto/hmac/hmac.h b/crypto/hmac/hmac.h index 223eeda7f3..328bad2608 100644 --- a/crypto/hmac/hmac.h +++ b/crypto/hmac/hmac.h @@ -58,10 +58,6 @@ #ifndef HEADER_HMAC_H #define HEADER_HMAC_H -#ifdef __cplusplus -extern "C" { -#endif - #ifdef NO_HMAC #error HMAC is disabled. #endif @@ -70,6 +66,10 @@ extern "C" { #define HMAC_MAX_MD_CBLOCK 64 +#ifdef __cplusplus +extern "C" { +#endif + typedef struct hmac_ctx_st { const EVP_MD *md; diff --git a/crypto/idea/idea.h b/crypto/idea/idea.h index ae32f5692e..f5efeae366 100644 --- a/crypto/idea/idea.h +++ b/crypto/idea/idea.h @@ -59,10 +59,6 @@ #ifndef HEADER_IDEA_H #define HEADER_IDEA_H -#ifdef __cplusplus -extern "C" { -#endif - #ifdef NO_IDEA #error IDEA is disabled. #endif @@ -74,6 +70,10 @@ extern "C" { #define IDEA_BLOCK 8 #define IDEA_KEY_LENGTH 16 +#ifdef __cplusplus +extern "C" { +#endif + typedef struct idea_key_st { IDEA_INT data[9][6]; diff --git a/crypto/lhash/lhash.h b/crypto/lhash/lhash.h index d315fd9c6d..868d535260 100644 --- a/crypto/lhash/lhash.h +++ b/crypto/lhash/lhash.h @@ -63,14 +63,14 @@ #ifndef HEADER_LHASH_H #define HEADER_LHASH_H -#ifdef __cplusplus -extern "C" { -#endif - #ifndef NO_FP_API #include #endif +#ifdef __cplusplus +extern "C" { +#endif + typedef struct lhash_node_st { void *data; diff --git a/crypto/md2/md2.h b/crypto/md2/md2.h index 582bffb859..a00bd162b3 100644 --- a/crypto/md2/md2.h +++ b/crypto/md2/md2.h @@ -59,10 +59,6 @@ #ifndef HEADER_MD2_H #define HEADER_MD2_H -#ifdef __cplusplus -extern "C" { -#endif - #ifdef NO_MD2 #error MD2 is disabled. #endif @@ -71,6 +67,10 @@ extern "C" { #define MD2_BLOCK 16 #include /* MD2_INT */ +#ifdef __cplusplus +extern "C" { +#endif + typedef struct MD2state_st { int num; diff --git a/crypto/mdc2/mdc2.h b/crypto/mdc2/mdc2.h index 00acd707cd..5da8da72f5 100644 --- a/crypto/mdc2/mdc2.h +++ b/crypto/mdc2/mdc2.h @@ -59,12 +59,12 @@ #ifndef HEADER_MDC2_H #define HEADER_MDC2_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - #ifdef NO_MDC2 #error MDC2 is disabled. #endif diff --git a/crypto/objects/objects.h b/crypto/objects/objects.h index 95c8a21568..2f11517a9a 100644 --- a/crypto/objects/objects.h +++ b/crypto/objects/objects.h @@ -59,10 +59,6 @@ #ifndef HEADER_OBJECTS_H #define HEADER_OBJECTS_H -#ifdef __cplusplus -extern "C" { -#endif - #define SN_undef "UNDEF" #define LN_undef "undefined" #define NID_undef 0 @@ -967,6 +963,10 @@ extern "C" { #define OBJ_NAME_ALIAS 0x8000 +#ifdef __cplusplus +extern "C" { +#endif + typedef struct obj_name_st { int type; diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h index e4bae0b4aa..38b98015c4 100644 --- a/crypto/pem/pem.h +++ b/crypto/pem/pem.h @@ -59,14 +59,14 @@ #ifndef HEADER_PEM_H #define HEADER_PEM_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include +#ifdef __cplusplus +extern "C" { +#endif + #define PEM_BUFSIZE 1024 #define PEM_OBJ_UNDEF 0 diff --git a/crypto/pem/pem2.h b/crypto/pem/pem2.h index 4a016aacd2..4e484bcd82 100644 --- a/crypto/pem/pem2.h +++ b/crypto/pem/pem2.h @@ -57,4 +57,12 @@ * Ben 30 Jan 1999. */ +#ifdef __cplusplus +extern "C" { +#endif + void ERR_load_PEM_strings(void); + +#ifdef __cplusplus +} +#endif diff --git a/crypto/pkcs12/pkcs12.h b/crypto/pkcs12/pkcs12.h index dad356c00f..c5bafc4fea 100644 --- a/crypto/pkcs12/pkcs12.h +++ b/crypto/pkcs12/pkcs12.h @@ -59,13 +59,13 @@ #ifndef HEADER_PKCS12_H #define HEADER_PKCS12_H +#include +#include + #ifdef __cplusplus extern "C" { #endif -#include -#include - #define PKCS12_KEY_ID 1 #define PKCS12_IV_ID 2 #define PKCS12_MAC_ID 3 diff --git a/crypto/pkcs7/pkcs7.h b/crypto/pkcs7/pkcs7.h index 3ec725d226..fd2877de84 100644 --- a/crypto/pkcs7/pkcs7.h +++ b/crypto/pkcs7/pkcs7.h @@ -59,10 +59,6 @@ #ifndef HEADER_PKCS7_H #define HEADER_PKCS7_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include @@ -70,6 +66,10 @@ extern "C" { #include #endif +#ifdef __cplusplus +extern "C" { +#endif + #ifdef WIN32 /* Under Win32 thes are defined in wincrypt.h */ #undef PKCS7_ISSUER_AND_SERIAL diff --git a/crypto/rand/rand.h b/crypto/rand/rand.h index 2973ee90e4..b4b12c2d74 100644 --- a/crypto/rand/rand.h +++ b/crypto/rand/rand.h @@ -90,12 +90,26 @@ int RAND_write_file(const char *file); const char *RAND_file_name(char *file,int num); int RAND_status(void); int RAND_egd(const char *path); +void ERR_load_RAND_strings(void); + +#ifdef __cplusplus +} +#endif + #if defined(WINDOWS) || defined(WIN32) #include + +#ifdef __cplusplus +extern "C" { +#endif + void RAND_screen(void); int RAND_event(UINT, WPARAM, LPARAM); + +#ifdef __cplusplus +} +#endif #endif -void ERR_load_RAND_strings(void); /* BEGIN ERROR CODES */ /* The following lines are auto generated by the script mkerr.pl. Any changes @@ -110,8 +124,5 @@ void ERR_load_RAND_strings(void); /* Reason codes. */ #define RAND_R_PRNG_NOT_SEEDED 100 -#ifdef __cplusplus -} -#endif #endif diff --git a/crypto/rc2/rc2.h b/crypto/rc2/rc2.h index 9571efb755..099bc31b66 100644 --- a/crypto/rc2/rc2.h +++ b/crypto/rc2/rc2.h @@ -59,10 +59,6 @@ #ifndef HEADER_RC2_H #define HEADER_RC2_H -#ifdef __cplusplus -extern "C" { -#endif - #ifdef NO_RC2 #error RC2 is disabled. #endif @@ -74,6 +70,10 @@ extern "C" { #define RC2_BLOCK 8 #define RC2_KEY_LENGTH 16 +#ifdef __cplusplus +extern "C" { +#endif + typedef struct rc2_key_st { RC2_INT data[64]; diff --git a/crypto/rc4/rc4.h b/crypto/rc4/rc4.h index 8556dddab0..40251024a4 100644 --- a/crypto/rc4/rc4.h +++ b/crypto/rc4/rc4.h @@ -59,16 +59,16 @@ #ifndef HEADER_RC4_H #define HEADER_RC4_H -#ifdef __cplusplus -extern "C" { -#endif - #ifdef NO_RC4 #error RC4 is disabled. #endif #include /* RC4_INT */ +#ifdef __cplusplus +extern "C" { +#endif + typedef struct rc4_key_st { RC4_INT x,y; diff --git a/crypto/rsa/rsa.h b/crypto/rsa/rsa.h index f9f9b5cfe9..74033cf607 100644 --- a/crypto/rsa/rsa.h +++ b/crypto/rsa/rsa.h @@ -59,10 +59,6 @@ #ifndef HEADER_RSA_H #define HEADER_RSA_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include @@ -70,6 +66,10 @@ extern "C" { #error RSA is disabled. #endif +#ifdef __cplusplus +extern "C" { +#endif + typedef struct rsa_st RSA; typedef struct rsa_meth_st diff --git a/crypto/txt_db/txt_db.h b/crypto/txt_db/txt_db.h index 58b9de1353..22a54f06ee 100644 --- a/crypto/txt_db/txt_db.h +++ b/crypto/txt_db/txt_db.h @@ -59,10 +59,6 @@ #ifndef HEADER_TXT_DB_H #define HEADER_TXT_DB_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include @@ -73,6 +69,10 @@ extern "C" { #define DB_ERROR_NO_INDEX 4 #define DB_ERROR_INSERT_INDEX_CLASH 5 +#ifdef __cplusplus +extern "C" { +#endif + typedef struct txt_db_st { int num_fields; diff --git a/crypto/x509/x509.h b/crypto/x509/x509.h index 0192272e7c..57f9bab0fb 100644 --- a/crypto/x509/x509.h +++ b/crypto/x509/x509.h @@ -59,10 +59,6 @@ #ifndef HEADER_X509_H #define HEADER_X509_H -#ifdef __cplusplus -extern "C" { -#endif - #ifdef VMS #undef X509_REVOKED_get_ext_by_critical #define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic @@ -87,6 +83,10 @@ extern "C" { #include +#ifdef __cplusplus +extern "C" { +#endif + #ifdef WIN32 /* Under Win32 this is defined in wincrypt.h */ #undef X509_NAME @@ -445,9 +445,17 @@ typedef struct pkcs8_priv_key_info_st STACK_OF(X509_ATTRIBUTE) *attributes; } PKCS8_PRIV_KEY_INFO; +#ifdef __cplusplus +} +#endif + #include #include +#ifdef __cplusplus +extern "C" { +#endif + #ifdef SSLEAY_MACROS #define X509_verify(a,r) ASN1_verify((int (*)())i2d_X509_CINF,a->sig_alg,\ a->signature,(char *)a->cert_info,r) diff --git a/crypto/x509/x509_vfy.h b/crypto/x509/x509_vfy.h index 4637aecedf..9173943dcd 100644 --- a/crypto/x509/x509_vfy.h +++ b/crypto/x509/x509_vfy.h @@ -65,13 +65,13 @@ #ifndef HEADER_X509_VFY_H #define HEADER_X509_VFY_H +#include +#include + #ifdef __cplusplus extern "C" { #endif -#include -#include - /* Outer object */ typedef struct x509_hash_dir_st { diff --git a/crypto/x509v3/x509v3.h b/crypto/x509v3/x509v3.h index 96ceb7c4fb..209b203a0c 100644 --- a/crypto/x509v3/x509v3.h +++ b/crypto/x509v3/x509v3.h @@ -58,14 +58,14 @@ #ifndef HEADER_X509V3_H #define HEADER_X509V3_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* Forward reference */ struct v3_ext_method; struct v3_ext_ctx; diff --git a/e_os2.h b/e_os2.h index bd97b921a8..5a25ac7cf6 100644 --- a/e_os2.h +++ b/e_os2.h @@ -3,12 +3,12 @@ #ifndef HEADER_E_OS2_H #define HEADER_E_OS2_H +#include /* OPENSSL_UNISTD */ + #ifdef __cplusplus extern "C" { #endif -#include /* OPENSSL_UNISTD */ - #ifdef MSDOS # define OPENSSL_UNISTD_IO # define OPENSSL_DECLARE_EXIT extern void exit(int); diff --git a/rsaref/rsaref.h b/rsaref/rsaref.h index 15f65dd94f..498449f40e 100644 --- a/rsaref/rsaref.h +++ b/rsaref/rsaref.h @@ -59,13 +59,13 @@ #ifndef HEADER_RSAREF_H #define HEADER_RSAREF_H +#ifndef NO_RSA +#include + #ifdef __cplusplus extern "C" { #endif -#ifndef NO_RSA -#include - /* RSAeuro */ /*#define RSAref_MAX_BITS 2048*/ @@ -133,6 +133,10 @@ int R_RandomFinal(RSARandomState *rnd); void ERR_load_RSAREF_strings(void ); RSA_METHOD *RSA_PKCS1_RSAref(void ); + +#ifdef __cplusplus +} +#endif #endif /* BEGIN ERROR CODES */ @@ -173,8 +177,4 @@ RSA_METHOD *RSA_PKCS1_RSAref(void ); #define RSAREF_R_SIGNATURE 0x040b #define RSAREF_R_SIGNATURE_ENCODING 0x040c -#ifdef __cplusplus -} -#endif #endif - diff --git a/ssl/ssl.h b/ssl/ssl.h index bb846f491c..f7c91b80e0 100644 --- a/ssl/ssl.h +++ b/ssl/ssl.h @@ -59,12 +59,12 @@ #ifndef HEADER_SSL_H #define HEADER_SSL_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /* SSLeay version number for ASN.1 encoding of the session information */ /* Version 0 - initial version * Version 1 - added the optional peer certificate @@ -140,6 +140,10 @@ extern "C" { #define SSL_SENT_SHUTDOWN 1 #define SSL_RECEIVED_SHUTDOWN 2 +#ifdef __cplusplus +} +#endif + #include #include #include @@ -147,6 +151,10 @@ extern "C" { #include #include +#ifdef __cplusplus +extern "C" { +#endif + #if (defined(NO_RSA) || defined(NO_MD5)) && !defined(NO_SSL2) #define NO_SSL2 #endif @@ -655,11 +663,19 @@ struct ssl_st * SSLv3/TLS rollback check */ }; +#ifdef __cplusplus +} +#endif + #include #include #include /* This is mostly sslv3 with a few tweaks */ #include +#ifdef __cplusplus +extern "C" { +#endif + /* compatibility */ #define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)arg)) #define SSL_get_app_data(s) (SSL_get_ex_data(s,0)) -- cgit v1.2.3