Skip to content

Commit 528bb66

Browse files
committed
WL#15135 third set of post-push fixes
Disable most of NodeCertificate-t in builds that use OpenSSL 1.0.x. Change-Id: Ic197e5d81302e39f000824d3a8ac13d635337988
1 parent 08d508c commit 528bb66

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

storage/ndb/include/util/ndb_openssl3_compat.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ EVP_PKEY * EVP_EC_generate(const char * curve);
5151
const ASN1_INTEGER *X509_get0_serialNumber(const X509 *);
5252

5353
#ifndef X509_getm_notBefore
54+
5455
#define X509_getm_notBefore X509_get_notBefore
5556
#define X509_getm_notAfter X509_get_notAfter
56-
#define __NEED_STUB_ASN1_TIME_GET0_FUNCTIONS 1
57+
#define __NEED_STUB_ASN1_FUNCTIONS 1
58+
int ASN1_INTEGER_get_uint64(uint64_t *, const ASN1_INTEGER *);
59+
int ASN1_TIME_to_tm(const ASN1_TIME *, struct tm *);
5760
const ASN1_TIME *X509_get0_notBefore(const X509 *);
5861
const ASN1_TIME *X509_get0_notAfter(const X509 *);
62+
5963
#endif
6064

6165
EVP_PKEY *X509_get0_pubkey(X509 *);
@@ -65,7 +69,6 @@ inline void X509_get0_signature(const ASN1_BIT_STRING **, const X509_ALGOR **,
6569
int X509_get_signature_info(X509 *, int *, int *, int *, uint32_t *);
6670
X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *,
6771
X509V3_CTX *, int, const char *);
68-
int ASN1_TIME_to_tm(const ASN1_TIME *, struct tm *);
6972
int EVP_PKEY_up_ref(EVP_PKEY *);
7073
int X509_up_ref(X509 *);
7174

storage/ndb/src/common/util/NodeCertificate.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,10 @@ static constexpr bool isWin32 = 1;
13491349
static constexpr bool isWin32 = 0;
13501350
#endif
13511351

1352+
static constexpr bool openssl_version_ok =
1353+
((OPENSSL_VERSION_NUMBER >= NDB_TLS_MINIMUM_OPENSSL) ||
1354+
(OPENSSL_VERSION_NUMBER == UBUNTU18_OPENSSL_VER_ID));
1355+
13521356
/*
13531357
Test name parsing
13541358
*/
@@ -1740,17 +1744,21 @@ int main(int argc, char *argv[]) {
17401744
r1 = search_path_test();
17411745
if(r1 != 0) return fail("search path", r1);
17421746

1743-
r1 = cert_lifetime_test();
1744-
if(r1 != 0) return fail("lifetime", r1);
1745-
17461747
r1 = parser_test();
17471748
if(r1 != 0) return fail("parser", r1);
17481749

1749-
r1 = file_test();
1750-
if(r1 != 0) return fail("file", r1);
1750+
if(openssl_version_ok) {
1751+
1752+
r1 = cert_lifetime_test();
1753+
if(r1 != 0) return fail("lifetime", r1);
17511754

1752-
r1 = verify_test();
1753-
if(r1 != 0) return fail("verify", r1);
1755+
r1 = file_test();
1756+
if(r1 != 0) return fail("file", r1);
1757+
1758+
r1 = verify_test();
1759+
if(r1 != 0) return fail("verify", r1);
1760+
1761+
}
17541762

17551763
return 0;
17561764
}

storage/ndb/src/common/util/ndb_openssl3_compat.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,6 @@ X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf,
131131
return X509V3_EXT_conf_nid(conf, ctx, ext_nid, const_cast<char *>(value));
132132
}
133133

134-
int ASN1_TIME_to_tm(const ASN1_TIME *, struct tm *) {
135-
return 0;
136-
}
137-
138134
int EVP_PKEY_up_ref(EVP_PKEY *) {
139135
return 0;
140136
}
@@ -143,14 +139,24 @@ int X509_up_ref(X509 *) {
143139
return 0;
144140
}
145141

146-
#ifdef __NEED_STUB_ASN1_TIME_GET0_FUNCTIONS
142+
#ifdef __NEED_STUB_ASN1_FUNCTIONS
147143
const ASN1_TIME *X509_get0_notBefore(const X509 *x) {
148144
return X509_get_notBefore(x);
149145
}
150146

151147
const ASN1_TIME *X509_get0_notAfter(const X509 *x) {
152148
return X509_get_notAfter(x);
153149
}
154-
#endif // __NEED_STUB_ASN1_TIME_GET0_FUNCTIONS
150+
151+
int ASN1_TIME_to_tm(const ASN1_TIME *, struct tm *) {
152+
return 0;
153+
}
154+
155+
int ASN1_INTEGER_get_uint64(uint64_t *v, const ASN1_INTEGER *) {
156+
*v = 0;
157+
return 0;
158+
}
159+
160+
#endif // __NEED_STUB_ASN1_FUNCTIONS
155161

156162
#endif

0 commit comments

Comments
 (0)