Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 302073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:03:51+00:00 2026-05-12T07:03:51+00:00

With prior OpenSSL versions it was possible to do this in SWIG .i files:

  • 0

With prior OpenSSL versions it was possible to do this in SWIG .i files:

STACK *ssl_get_ciphers(SSL *ssl) {
    return (STACK *)SSL_get_ciphers(ssl);
}

With OpenSSL 1.0.0beta3 this fails because STACK seems to be no longer defined. New OpenSSL tries to do a better job at type checking, so one is supposed to use the STACK_OF macro, which is defined like this:

#define STACK_OF(type) struct stack_st_##type

If I change the code above to use STACK_OF:

STACK_OF(SSL_CIPHER) *ssl_get_ciphers(SSL *ssl) {
    return SSL_get_ciphers(ssl);
}

Then SWIG does not like this:

Error: Syntax error in input(1).

I can get things to compile by changing that to:

struct stack_st_SSL_CIPHER *ssl_get_ciphers(SSL *ssl) {
    return SSL_get_ciphers(ssl);
}

but this is obviously not good, because OpenSSL could change the macro from release to release. There is _STACK struct, but again that is OpenSSL private detail and could change from release to release. Stacks can also come in as parameters, as in:

int sk_x509_num(STACK_OF(X509) *stack) {
    return sk_num(stack);
}

which SWIG does not like either.

Is there any way to make this work without resorting to using OpenSSL private details?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:03:51+00:00Added an answer on May 12, 2026 at 7:03 am

    After some more reading I found why I had the problem, and how to get around it. The problem happened because SWIG’s preprocessor does not know about the STACK_OF macro, so that is why SWIG fails. I can fix that by adding this in my .i file:

    %include <openssl/safestack.h>
    

    Now I also run into the same problem with LHASH_OF macro. Unfortunately it is included in lhash.h which also includes stdio.h etc. which I don’t want (and my build actually can’t find them the way it is set up). My build happens to need -includeall command line option to swig. So unfortunately with LHASH_OF I ended up with copying the definition from OpenSSL 🙁

    #define LHASH_OF(type) struct lhash_st_##type
    

    right under the %include line I mentioned above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In versions prior to r146 it was possible to create X509Certificate objects directly. Now
In prior versions of Windows before Vista you could have a Windows Service interact
I am trying to execute this SQL query prior to restoring a .BAK file
Prior to asking this question here, I have googled aroung. In general, people suggest
I have no prior experience working with batch files or shell scripting in general.
Prior to this question, I asked this question on this site. (Mr Jon Skeet
Prior to xcode 3.2.1, you could cycle through the list of files your in
My prior problem was this . Now, when i see change logs and click
I read various post's prior to this. but none of them seemed to work
This is related to a prior question of mine C# Generic List conversion to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.