Reference Counters in OpenSSL - Openssl

This is a discussion on Reference Counters in OpenSSL - Openssl ; On Wed, Jun 18, 2008, Gerhard Gappmeier wrote: > Hi > > some functions like X509_PUBKEY_get increment the internal reference > counter of the "object" > so that EVP_PKEY_free( pKey ) has to be called. > > Other functions like ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Reference Counters in OpenSSL

  1. Re: Reference Counters in OpenSSL

    On Wed, Jun 18, 2008, Gerhard Gappmeier wrote:

    > Hi
    >
    > some functions like X509_PUBKEY_get increment the internal reference
    > counter of the "object"
    > so that EVP_PKEY_free( pKey ) has to be called.
    >
    > Other functions like X509_get_X509_PUBKEY just return an internal pointer
    > and I have to care myself about reference counting.
    >
    > Is there a general rule or naming convention to know how to use that?
    > Or is the only possibilty to figure that out debugging into the code?
    >


    If the function has a '1' in the name it ups the reference count. If it has a
    '0' it doesn't.

    Unfortunately there are quiet a few functions around which existed before this
    convention was decided on which can do either :-(

    Steve.
    --
    Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
    OpenSSL project core developer and freelance consultant.
    Homepage: http://www.drh-consultancy.demon.co.uk
    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    User Support Mailing List openssl-users@openssl.org
    Automated List Manager majordomo@openssl.org


  2. Reference Counters in OpenSSL

    Hi

    some functions like X509_PUBKEY_get increment the internal reference
    counter of the "object"
    so that EVP_PKEY_free( pKey ) has to be called.

    Other functions like X509_get_X509_PUBKEY just return an internal pointer
    and I have to care myself about reference counting.

    Is there a general rule or naming convention to know how to use that?
    Or is the only possibilty to figure that out debugging into the code?

    --
    mit freundlichen Grüßen / best regards

    *Gerhard Gappmeier*
    ascolab GmbH - automation systems communication laboratory
    Tel.: +49 9131 691 123
    Fax: +49 9131 691 128
    Web: http://www.ascolab.com
    GPG-Key: http://www.ascolab.com/gpg/gg.asc

    --
    *ascolab GmbH*
    Geschäftsführer: Gerhard Gappmeier, Matthias Damm, Uwe Steinkrauß
    Sitz der Gesellschaft: Am Weichselgarten 7 . 91058 Erlangen . Germany
    Registernummer: HRB 9360
    Registergericht: Amtsgericht Fürth



+ Reply to Thread