VirtualBox

Changeset 74299 in vbox for trunk/src


Ignore:
Timestamp:
Sep 16, 2018 6:35:40 PM (6 years ago)
Author:
vboxsync
Message:

IPRT/crypto: Wrapped SSL, alleged RC4, and RSA key generation. Added methods for quering someRSA key components. Exposed big numbers, x509 and asn1 APIs as stable. bugref:9246 [openssl 0.98.x build fix]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/crypto/ssl-openssl.cpp

    r74296 r74299  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
    31 #include "internal/iprt.h"
    32 #include <iprt/crypto/ssl.h>
    33 
    34 #include <iprt/asm.h>
    35 #include <iprt/assert.h>
    36 #include <iprt/file.h>
    37 #include <iprt/mem.h>
    38 #include <iprt/string.h>
    39 
    40 #include "internal/magics.h"
    41 
    42 #include "internal/iprt-openssl.h"
    43 #include <openssl/ssl.h>
     31# include "internal/iprt.h"
     32# include <iprt/crypto/ssl.h>
     33
     34# include <iprt/asm.h>
     35# include <iprt/assert.h>
     36# include <iprt/file.h>
     37# include <iprt/mem.h>
     38# include <iprt/string.h>
     39
     40# include "internal/magics.h"
     41
     42# include "internal/iprt-openssl.h"
     43# include <openssl/ssl.h>
     44# include <openssl/tls1.h>
    4445
    4546
     
    8687    AssertReturn(!fFlags, VERR_INVALID_FLAGS);
    8788
    88     const SSL_METHOD *pSslMethod = TLS_server_method();
     89    /*
     90     * We aim at TLSv1 or higher here by default.
     91     */
     92# if OPENSSL_VERSION_NUMBER >= 0x10100000
     93    const SSL_METHOD *pSslMethod = TLS_method();
     94# elif OPENSSL_VERSION_NUMBER >= 0x10002000
     95    const SSL_METHOD *pSslMethod = SSLv23_method();
     96# else
     97    SSL_METHOD *pSslMethod = TLSv1_method();
     98# endif
    8999    if (pSslMethod)
    90100    {
     
    95105            if (pThis->pCtx)
    96106            {
     107                /* Help with above aim. */
     108# if OPENSSL_VERSION_NUMBER >= 0x10100000
     109                if (SSL_CTX_get_min_proto_version(pThis->pCtx) < TLS1_VERSION)
     110                    SSL_CTX_set_min_proto_version(pThis->pCtx, TLS1_VERSION);
     111# elif OPENSSL_VERSION_NUMBER >= 0x10002000
     112                SSL_CTX_set_options(pThis->pCtx, SSL_OP_NO_SSLv2);
     113                SSL_CTX_set_options(pThis->pCtx, SSL_OP_NO_SSLv3);
     114# endif
     115
     116                /*
     117                 * Complete the instance and return it.
     118                 */
    97119                pThis->u32Magic = RTCRSSLINT_MAGIC;
    98120                pThis->cRefs    = 1;
     
    241263            if (pSession->pBio)
    242264            {
     265# if OPENSSL_VERSION_NUMBER >= 0x10100000
    243266                BIO_up_ref(pSession->pBio); /* our reference. */
     267# endif
    244268                SSL_set_bio(pSession->pSsl, pSession->pBio, pSession->pBio);
    245269
     
    287311    SSL_free(pThis->pSsl);
    288312    pThis->pSsl = NULL;
     313# if OPENSSL_VERSION_NUMBER >= 0x10100000
    289314    BIO_free(pThis->pBio);
     315# endif
    290316    pThis->pBio = NULL;
    291317    RTMemFree(pThis);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette