Fix Windows shared library build.

Windows is much pickier about dllimport/dllexport. Declare it on
the declaration, not the definition. Also ensure that the declaration
precedes the definition. Finally, remove a stray OPENSSL_EXPORT.

Change-Id: Id50b9de5acbe5adf1b15b22dd60b7a5c13a80cce
Reviewed-on: https://boringssl-review.googlesource.com/1862
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2014-09-30 19:51:34 -04:00 committed by Adam Langley
parent de211dbd7b
commit 775b75f9de
5 changed files with 14 additions and 10 deletions

View File

@ -106,6 +106,8 @@ typedef struct ec_parameters_st {
ASN1_INTEGER *cofactor;
} ECPARAMETERS;
DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS);
ASN1_SEQUENCE(ECPARAMETERS) = {
ASN1_SIMPLE(ECPARAMETERS, version, LONG),
ASN1_SIMPLE(ECPARAMETERS, fieldID, X9_62_FIELDID),
@ -115,7 +117,6 @@ ASN1_SEQUENCE(ECPARAMETERS) = {
ASN1_OPT(ECPARAMETERS, cofactor, ASN1_INTEGER)
} ASN1_SEQUENCE_END(ECPARAMETERS);
DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS);
IMPLEMENT_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS);
typedef struct ecpk_parameters_st {
@ -134,15 +135,19 @@ typedef struct ec_privatekey_st {
ASN1_BIT_STRING *publicKey;
} EC_PRIVATEKEY;
DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS);
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECPKPARAMETERS, ECPKPARAMETERS);
ASN1_CHOICE(ECPKPARAMETERS) = {
ASN1_SIMPLE(ECPKPARAMETERS, value.named_curve, ASN1_OBJECT),
ASN1_SIMPLE(ECPKPARAMETERS, value.parameters, ECPARAMETERS),
} ASN1_CHOICE_END(ECPKPARAMETERS);
DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS);
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECPKPARAMETERS, ECPKPARAMETERS);
IMPLEMENT_ASN1_FUNCTIONS_const(ECPKPARAMETERS);
DECLARE_ASN1_FUNCTIONS_const(EC_PRIVATEKEY);
DECLARE_ASN1_ENCODE_FUNCTIONS_const(EC_PRIVATEKEY, EC_PRIVATEKEY);
ASN1_SEQUENCE(EC_PRIVATEKEY) = {
ASN1_SIMPLE(EC_PRIVATEKEY, version, LONG),
ASN1_SIMPLE(EC_PRIVATEKEY, privateKey, ASN1_OCTET_STRING),
@ -150,8 +155,6 @@ ASN1_SEQUENCE(EC_PRIVATEKEY) = {
ASN1_EXP_OPT(EC_PRIVATEKEY, publicKey, ASN1_BIT_STRING, 1),
} ASN1_SEQUENCE_END(EC_PRIVATEKEY);
DECLARE_ASN1_FUNCTIONS_const(EC_PRIVATEKEY);
DECLARE_ASN1_ENCODE_FUNCTIONS_const(EC_PRIVATEKEY, EC_PRIVATEKEY);
IMPLEMENT_ASN1_FUNCTIONS_const(EC_PRIVATEKEY);

View File

@ -59,13 +59,14 @@
#include "../ec/internal.h"
DECLARE_ASN1_FUNCTIONS_const(ECDSA_SIG);
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECDSA_SIG, ECDSA_SIG);
ASN1_SEQUENCE(ECDSA_SIG) = {
ASN1_SIMPLE(ECDSA_SIG, r, CBIGNUM),
ASN1_SIMPLE(ECDSA_SIG, s, CBIGNUM),
} ASN1_SEQUENCE_END(ECDSA_SIG);
DECLARE_ASN1_FUNCTIONS_const(ECDSA_SIG);
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECDSA_SIG, ECDSA_SIG);
IMPLEMENT_ASN1_FUNCTIONS_const(ECDSA_SIG);
size_t ECDSA_size(const EC_KEY *key) {

View File

@ -392,7 +392,7 @@ typedef const ASN1_ITEM ASN1_ITEM_EXP;
#define ASN1_ITEM_rptr(ref) (&(ref##_it))
#define DECLARE_ASN1_ITEM(name) \
extern const ASN1_ITEM name##_it;
extern OPENSSL_EXPORT const ASN1_ITEM name##_it;
/* Parameters used by ASN1_STRING_print_ex() */

View File

@ -80,7 +80,7 @@ extern "C" {
/* Macros for start and end of ASN1_ITEM definition */
#define ASN1_ITEM_start(itname) \
OPENSSL_EXPORT const ASN1_ITEM itname##_it = {
const ASN1_ITEM itname##_it = {
#define ASN1_ITEM_end(itname) \
};

View File

@ -555,7 +555,7 @@ OPENSSL_EXPORT int GENERAL_NAME_get0_otherName(GENERAL_NAME *gen,
OPENSSL_EXPORT char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5);
OPENSSL_EXPORT ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str);
OPENSSL_EXPORT DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE)
DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE)
OPENSSL_EXPORT int i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION* a);
DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES)