From 2806585aad4b4910156cbaa24c8ea027c572365f Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 14 Nov 2016 18:22:15 -0500 Subject: Tweak pkey access control to allow wheel to see keys. The current pkey access control rules are a bit complex, because they need to support the somewhat complex rules required by PKCS #11. This is fine, as far as it goes, but a strict interpretation leaves HAL_USER_NORMAL as the only user able to see many keys. This is confusing when using the CLI, to put it mildly. HAL_USER_WHEEL is intended for exactly this sort of thing: it's a user ID which, by definition, can never appear in an RPC call from PKCS to see the same keys that HAL_USER_NORMAL would. HAL_USER_SO remains restricted per the PKCS #11 rules. --- rpc_pkey.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rpc_pkey.c b/rpc_pkey.c index 52b6b0e..3788f5e 100644 --- a/rpc_pkey.c +++ b/rpc_pkey.c @@ -138,13 +138,21 @@ static inline hal_pkey_slot_t *find_handle(const hal_pkey_handle_t handle) * need to refactor. */ +static inline hal_error_t check_normal_or_wheel(const hal_client_handle_t client) +{ + const hal_error_t err = hal_rpc_is_logged_in(client, HAL_USER_NORMAL); + return (err == HAL_ERROR_FORBIDDEN + ? hal_rpc_is_logged_in(client, HAL_USER_WHEEL) + : err); +} + static inline hal_error_t check_readable(const hal_client_handle_t client, const hal_key_flags_t flags) { if ((flags & HAL_KEY_FLAG_PUBLIC) != 0) return HAL_OK; - return hal_rpc_is_logged_in(client, HAL_USER_NORMAL); + return check_normal_or_wheel(client); } static inline hal_error_t check_writable(const hal_client_handle_t client, @@ -153,7 +161,7 @@ static inline hal_error_t check_writable(const hal_client_handle_t client, if ((flags & (HAL_KEY_FLAG_TOKEN | HAL_KEY_FLAG_PUBLIC)) == HAL_KEY_FLAG_PUBLIC) return HAL_OK; - return hal_rpc_is_logged_in(client, HAL_USER_NORMAL); + return check_normal_or_wheel(client); } /* -- cgit v1.2.3 m'>
path: root/rtl/clkmgr_mmcm.v
blob: afb571634cb9a44e7a973ff9135ba7ea74488755 (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157