summaryrefslogtreecommitdiffstats
path: root/xbmc/media/drm/CryptoSession.cpp
blob: 9e5e8888d7b07bb81b15acafcb12f2d16f45b06a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 *  Copyright (C) 2005-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#include "CryptoSession.h"

using namespace DRM;

std::vector<GET_CRYPTO_SESSION_INTERFACE_FN> CCryptoSession::s_registeredInterfaces;

void CCryptoSession::RegisterInterface(GET_CRYPTO_SESSION_INTERFACE_FN fn)
{
  s_registeredInterfaces.push_back(fn);
}

CCryptoSession* CCryptoSession::GetCryptoSession(const std::string& UUID, const std::string& cipherAlgo, const std::string& macAlgo)
{
  CCryptoSession* retVal = nullptr;
  for (auto fn : s_registeredInterfaces)
    if ((retVal = fn(UUID, cipherAlgo, macAlgo)))
      break;
  return retVal;
}