Commit 9faed3a
Unify OsslAsymcipher for all asymmetric cipher ops
This patch refactors the `OsslAsymcipher` structure to provide a unified and
comprehensive interface for all asymmetric cipher operations, including
**encryption**, **decryption**, **encapsulation**, and **decapsulation**.
Previously, encapsulation and decapsulation operations were handled by a
separate `OsslEncapsulation` structure. This patch moves the operations
previously performed by `OsslEncapsulation` directly into `OsslAsymcipher`.
Key changes include:
* The `EncOp` enum now includes `Encapsulate` and `Decapsulate` variants.
* The `OsslAsymcipher::new` method is enhanced to handle initialization for
all four operation types, taking an `Option<&OsslParam>` for parameters to
support cases where parameters might be null.
* The `OsslEncapsulation` structure and its associated `new_encapsulation`
and `new_decapsulation` methods have been **removed**.
* The `encapsulate` and `decapsulate` methods of `OsslAsymcipher` now include
checks to ensure the `EncOp` matches the intended operation, returning an
`WrapperError` if there's a mismatch.
Signed-off-by: Simo Sorce <simo@redhat.com>
Co-authored-by: Gemini <gemini@google.com>1 parent 45de8d6 commit 9faed3a
3 files changed
+40
-68
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
79 | 81 | | |
80 | 82 | | |
81 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
82 | 90 | | |
83 | 91 | | |
84 | 92 | | |
| |||
93 | 101 | | |
94 | 102 | | |
95 | 103 | | |
96 | | - | |
| 104 | + | |
97 | 105 | | |
98 | 106 | | |
99 | 107 | | |
100 | 108 | | |
101 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
102 | 114 | | |
103 | 115 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 116 | + | |
108 | 117 | | |
109 | 118 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
114 | 126 | | |
115 | 127 | | |
116 | 128 | | |
| |||
121 | 133 | | |
122 | 134 | | |
123 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
124 | 142 | | |
125 | | - | |
126 | 143 | | |
127 | 144 | | |
128 | 145 | | |
| |||
191 | 208 | | |
192 | 209 | | |
193 | 210 | | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | 211 | | |
225 | 212 | | |
226 | 213 | | |
| |||
229 | 216 | | |
230 | 217 | | |
231 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
232 | 222 | | |
233 | 223 | | |
234 | 224 | | |
| |||
269 | 259 | | |
270 | 260 | | |
271 | 261 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | 262 | | |
294 | 263 | | |
295 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
296 | 268 | | |
297 | 269 | | |
298 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
| |||
82 | 80 | | |
83 | 81 | | |
84 | 82 | | |
85 | | - | |
| 83 | + | |
| 84 | + | |
86 | 85 | | |
87 | 86 | | |
88 | 87 | | |
| |||
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
103 | | - | |
| 102 | + | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
| 293 | + | |
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| |||
0 commit comments