VirtualBox

Changeset 94742 in vbox


Ignore:
Timestamp:
Apr 28, 2022 5:59:53 PM (3 years ago)
Author:
vboxsync
Message:

Main/ConsoleImpl: Some helpers to retain and release the cryptographic interface (mirrors the implementation in VirtualBoxImpl required for the NVRAM store). Loading the actual extension pack plugin is missing still, bugref:9955

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r94660 r94742  
    7676# include <VBox/vrdpusb.h>
    7777#endif
     78#include <VBox/VBoxCryptoIf.h>
    7879
    7980#if    defined(VBOX_WITH_GUEST_PROPS) || defined(VBOX_WITH_SHARED_CLIPBOARD) \
     
    322323    HRESULT i_setDiskEncryptionKeys(const Utf8Str &strCfg);
    323324
     325    HRESULT i_retainCryptoIf(PCVBOXCRYPTOIF *ppCryptoIf);
     326    HRESULT i_releaseCryptoIf(PCVBOXCRYPTOIF pCryptoIf);
    324327
    325328#ifdef VBOX_WITH_GUEST_PROPS
     
    10861089    Bstr mstrUuid;
    10871090
     1091    /** @name Members related to the cryptographic support interface.
     1092     * @{ */
     1093    /** The loaded module handle if loaded. */
     1094    RTLDRMOD                            mhLdrModCrypto;
     1095    /** Reference counter tracking how many users of the cryptographic support
     1096     * are there currently. */
     1097    volatile uint32_t                   mcRefsCrypto;
     1098    /** Pointer to the cryptographic support interface. */
     1099    PCVBOXCRYPTOIF                      mpCryptoIf;
     1100    /** @} */
     1101
    10881102#ifdef VBOX_WITH_DRAG_AND_DROP
    10891103    HGCMSVCEXTHANDLE m_hHgcmSvcExtDragAndDrop;
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r94660 r94742  
    417417    , mfUseHostClipboard(true)
    418418    , mMachineState(MachineState_PoweredOff)
     419    , mhLdrModCrypto(NIL_RTLDRMOD)
     420    , mcRefsCrypto(0)
     421    , mpCryptoIf(NULL)
    419422{
    420423}
     
    89298932}
    89308933
     8934/**
     8935 * Retains a reference to the default cryptographic interface.
     8936 *
     8937 * @returns COM status code.
     8938 * @param   ppCryptoIf          Where to store the pointer to the cryptographic interface on success.
     8939 *
     8940 * @note Locks this object for writing.
     8941 */
     8942HRESULT Console::i_retainCryptoIf(PCVBOXCRYPTOIF *ppCryptoIf)
     8943{
     8944    AssertReturn(ppCryptoIf != NULL, E_INVALIDARG);
     8945
     8946    if (mhLdrModCrypto == NIL_RTLDRMOD)
     8947        return setError(VBOX_E_NOT_SUPPORTED,
     8948                        tr("The VM is not configured for encryption"));
     8949
     8950    ASMAtomicIncU32(&mcRefsCrypto);
     8951    *ppCryptoIf = mpCryptoIf;
     8952
     8953    return S_OK;
     8954}
     8955
     8956/**
     8957 * Releases the reference of the given cryptographic interface.
     8958 *
     8959 * @returns COM status code.
     8960 * @param   pCryptoIf           Pointer to the cryptographic interface to release.
     8961 *
     8962 * @note Locks this object for writing.
     8963 */
     8964HRESULT Console::i_releaseCryptoIf(PCVBOXCRYPTOIF pCryptoIf)
     8965{
     8966    AssertReturn(pCryptoIf == mpCryptoIf, E_INVALIDARG);
     8967
     8968    ASMAtomicDecU32(&mcRefsCrypto);
     8969    return S_OK;
     8970}
     8971
    89318972/** @callback_method_impl{FNVMATSTATE}
    89328973 *
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