Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev-db/mysql-connector-c fails to build #566

Open
GoldsrcSource opened this issue Jul 17, 2024 · 1 comment
Open

dev-db/mysql-connector-c fails to build #566

GoldsrcSource opened this issue Jul 17, 2024 · 1 comment

Comments

@GoldsrcSource
Copy link

build.log
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h: In function ‘bool {anonymous}::set_dh(SSL_CTX*)’:
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:264:26: error: ‘NID_ffdhe2048’ was not declared in this scope
264 | dh = DH_new_by_nid(NID_ffdhe2048);
| ^~~~~~~~~~~~~
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:264:12: error: ‘DH_new_by_nid’ was not declared in this scope
264 | dh = DH_new_by_nid(NID_ffdhe2048);
| ^~~~~~~~~~~~~
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:267:26: error: ‘NID_ffdhe3072’ was not declared in this scope
267 | dh = DH_new_by_nid(NID_ffdhe3072);
| ^~~~~~~~~~~~~
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:270:26: error: ‘NID_ffdhe8192’ was not declared in this scope
270 | dh = DH_new_by_nid(NID_ffdhe8192);
| ^~~~~~~~~~~~~

@orbea
Copy link
Contributor

orbea commented Jul 25, 2024

This is the problematic part of include/dh_ecdh_config.h.

#if OPENSSL_VERSION_NUMBER >= 0x10100000L
  switch (security_level) {
    case 1:
      [[fallthrough]];
    case 2:
      dh = DH_new_by_nid(NID_ffdhe2048);
      break;
    case 3:
      dh = DH_new_by_nid(NID_ffdhe3072);
      break;
    case 4:
      dh = DH_new_by_nid(NID_ffdhe8192);
      break;
    case 5:
      /* there is no RFC7919 approved prime for sec level 5 */
      [[fallthrough]];
    default:
      break;
  };
#else  /* OPENSSL_VERSION_NUMBER >= 0x10100000L */
  dh = DH_new();
  if (!dh) return true;

  switch (security_level) {
    case 1:
      [[fallthrough]];
    case 2:
      dh->p =
          BN_bin2bn(rfc7919_ffdhe2048_p, sizeof(rfc7919_ffdhe2048_p), nullptr);
      break;
    case 3:
      dh->p =
          BN_bin2bn(rfc7919_ffdhe3072_p, sizeof(rfc7919_ffdhe3072_p), nullptr);
      break;
    case 4:
      dh->p =
          BN_bin2bn(rfc7919_ffdhe8192_p, sizeof(rfc7919_ffdhe8192_p), nullptr);
      break;
    case 5:
      /* There is no RFC7919 approved prime for sec level 5 */
      [[fallthrough]];
    default:
      DH_free(dh);
      return true;
  };

  dh->g = BN_bin2bn(rfc7919_g, sizeof(rfc7919_g), nullptr);
  if (!dh->p || !dh->g) {
    DH_free(dh);
    return true;
  }
#endif /* OPENSSL_VERSION_NUMBER >= 0x10100000L */

However taking the other code path also fails.

--- a/include/dh_ecdh_config.h.orig
+++ b/include/dh_ecdh_config.h
@@ -256,7 +256,7 @@
 #else /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
 
   DH *dh = nullptr;
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
   switch (security_level) {
     case 1:
       [[fallthrough]];
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h: In function ‘bool {anonymous}::set_dh(SSL_CTX*)’:
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:286:9: error: invalid use of incomplete type ‘DH’ {aka ‘struct dh_st’}
  286 |       dh->p =
      |         ^~
In file included from /usr/include/openssl/evp.h:64,
                 from /var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/sql/stream_cipher.h:26,
                 from /var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/my_sys.h:73,
                 from /var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/vio/vio_priv.h:35,
                 from /var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/vio/viosslfactories.cc:41:
/usr/include/openssl/ossl_typ.h:130:16: note: forward declaration of ‘DH’ {aka ‘struct dh_st’}
  130 | typedef struct dh_st DH;
      |                ^~~~~
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:287:21: error: ‘rfc7919_ffdhe2048_p’ was not declared in this scope
  287 |           BN_bin2bn(rfc7919_ffdhe2048_p, sizeof(rfc7919_ffdhe2048_p), nullptr);
      |                     ^~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:290:9: error: invalid use of incomplete type ‘DH’ {aka ‘struct dh_st’}
  290 |       dh->p =
      |         ^~
/usr/include/openssl/ossl_typ.h:130:16: note: forward declaration of ‘DH’ {aka ‘struct dh_st’}
  130 | typedef struct dh_st DH;
      |                ^~~~~
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:291:21: error: ‘rfc7919_ffdhe3072_p’ was not declared in this scope
  291 |           BN_bin2bn(rfc7919_ffdhe3072_p, sizeof(rfc7919_ffdhe3072_p), nullptr);
      |                     ^~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:294:9: error: invalid use of incomplete type ‘DH’ {aka ‘struct dh_st’}
  294 |       dh->p =
      |         ^~
/usr/include/openssl/ossl_typ.h:130:16: note: forward declaration of ‘DH’ {aka ‘struct dh_st’}
  130 | typedef struct dh_st DH;
      |                ^~~~~
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:295:21: error: ‘rfc7919_ffdhe8192_p’ was not declared in this scope
  295 |           BN_bin2bn(rfc7919_ffdhe8192_p, sizeof(rfc7919_ffdhe8192_p), nullptr);
      |                     ^~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:305:5: error: invalid use of incomplete type ‘DH’ {aka ‘struct dh_st’}
  305 |   dh->g = BN_bin2bn(rfc7919_g, sizeof(rfc7919_g), nullptr);
      |     ^~
/usr/include/openssl/ossl_typ.h:130:16: note: forward declaration of ‘DH’ {aka ‘struct dh_st’}
  130 | typedef struct dh_st DH;
      |                ^~~~~
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:305:21: error: ‘rfc7919_g’ was not declared in this scope
  305 |   dh->g = BN_bin2bn(rfc7919_g, sizeof(rfc7919_g), nullptr);
      |                     ^~~~~~~~~
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:306:10: error: invalid use of incomplete type ‘DH’ {aka ‘struct dh_st’}
  306 |   if (!dh->p || !dh->g) {
      |          ^~
/usr/include/openssl/ossl_typ.h:130:16: note: forward declaration of ‘DH’ {aka ‘struct dh_st’}
  130 | typedef struct dh_st DH;
      |                ^~~~~
/var/tmp/portage/dev-db/mysql-connector-c-8.0.36/work/mysql-8.0.36/include/dh_ecdh_config.h:306:20: error: invalid use of incomplete type ‘DH’ {aka ‘struct dh_st’}
  306 |   if (!dh->p || !dh->g) {
      |                    ^~
/usr/include/openssl/ossl_typ.h:130:16: note: forward declaration of ‘DH’ {aka ‘struct dh_st’}
  130 | typedef struct dh_st DH;
      |                ^~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants