This repository was archived by the owner on Oct 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobject_policy_data.cc
More file actions
40 lines (32 loc) · 1.44 KB
/
object_policy_data.cc
File metadata and controls
40 lines (32 loc) · 1.44 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "object_policy_data.h"
#include <base/macros.h>
namespace p11net {
// Read policy list as follows:
// {attribute, sensitive, read-only {create, copy, modify}, required}
// sensitive - True if attribute cannot be read.
// read-only.create - True if attribute cannot be set with C_CreateObject.
// read-only.copy - True if attribute cannot be set with C_CopyObject.
// read-only.modify - True if attribute cannot be set with C_SetAttributeValue.
// required - True if attribute is required for a valid object.
static const AttributePolicy kDataPolicies[] = {
{CKA_APPLICATION, false, {false, false, true}, false},
{CKA_OBJECT_ID, false, {false, false, true}, false},
{CKA_VALUE, false, {false, false, true}, false},
};
ObjectPolicyData::ObjectPolicyData() {
AddPolicies(kDataPolicies, arraysize(kDataPolicies));
}
ObjectPolicyData::~ObjectPolicyData() {}
void ObjectPolicyData::SetDefaultAttributes() {
ObjectPolicyCommon::SetDefaultAttributes();
if (!object_->IsAttributePresent(CKA_APPLICATION))
object_->SetAttributeBool(CKA_APPLICATION, "");
if (!object_->IsAttributePresent(CKA_OBJECT_ID))
object_->SetAttributeBool(CKA_OBJECT_ID, "");
if (!object_->IsAttributePresent(CKA_VALUE))
object_->SetAttributeBool(CKA_VALUE, "");
}
} // namespace p11net