| 1 |
/* |
| 2 |
* Copyright (C) 2005-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "CryptoSession.h" |
| 10 |
|
| 11 |
using namespace DRM; |
| 12 |
|
| 13 |
std::vector<GET_CRYPTO_SESSION_INTERFACE_FN> CCryptoSession::s_registeredInterfaces; |
| 14 |
|
| 15 |
void CCryptoSession::RegisterInterface(GET_CRYPTO_SESSION_INTERFACE_FN fn) |
| 16 |
{ |
| 17 |
s_registeredInterfaces.push_back(fn); |
| 18 |
} |
| 19 |
|
| 20 |
CCryptoSession* CCryptoSession::GetCryptoSession(const std::string& UUID, const std::string& cipherAlgo, const std::string& macAlgo) |
| 21 |
{ |
| 22 |
CCryptoSession* retVal = nullptr; |
| 23 |
for (auto fn : s_registeredInterfaces) |
| 24 |
if ((retVal = fn(UUID, cipherAlgo, macAlgo))) |
| 25 |
break; |
| 26 |
return retVal; |
| 27 |
} |