[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / crypto / scoped_cng_types.h
1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CRYPTO_SCOPED_CNG_TYPES_H_
6 #define CRYPTO_SCOPED_CNG_TYPES_H_
7
8 #include <windows.h>
9
10 #include "base/scoped_generic.h"
11 #include "base/win/wincrypt_shim.h"
12
13 namespace crypto {
14
15 template <typename T>
16 struct NCryptObjectTraits {
17   static T InvalidValue() { return 0; }
18   static void Free(T handle) { NCryptFreeObject(handle); }
19 };
20
21 using ScopedNCryptProvider =
22     base::ScopedGeneric<NCRYPT_PROV_HANDLE,
23                         NCryptObjectTraits<NCRYPT_PROV_HANDLE>>;
24 using ScopedNCryptKey =
25     base::ScopedGeneric<NCRYPT_KEY_HANDLE,
26                         NCryptObjectTraits<NCRYPT_KEY_HANDLE>>;
27
28 }  // namespace crypto
29
30 #endif  // CRYPTO_SCOPED_CNG_TYPES_H_