1 /*
2 * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 /**
21 * DOC: Public APIs for crypto service
22 */
23 #ifndef _WLAN_CRYPTO_GLOBAL_API_H_
24 #define _WLAN_CRYPTO_GLOBAL_API_H_
25
26 #include "wlan_crypto_global_def.h"
27 #include <qdf_crypto.h>
28
29 /**
30 * is_valid_keyix() - is key index valid
31 * @keyix: Key index
32 *
33 * Return: true or false
34 */
35 bool is_valid_keyix(uint16_t keyix);
36
37 /**
38 * is_igtk() - is given key index for IGTK
39 * @keyix: Key index
40 *
41 * Return: true or false
42 */
43 bool is_igtk(uint16_t keyix);
44
45 /**
46 * is_bigtk() - Is given key index for BIGTK
47 * @keyix: Key index
48 *
49 * Return: true or false
50 */
51 bool is_bigtk(uint16_t keyix);
52
53 /**
54 * is_gtk() - Is given key index for GTK
55 * @keyix: Key index
56 *
57 * Return: true or false
58 */
59 bool is_gtk(uint16_t keyix);
60
61 /**
62 * wlan_crypto_set_vdev_param() - called by ucfg to set crypto param
63 * @vdev: vdev
64 * @param: param to be set.
65 * @value: value
66 *
67 * This function gets called from ucfg to set param
68 *
69 * Return: QDF_STATUS_SUCCESS - in case of success
70 */
71 QDF_STATUS wlan_crypto_set_vdev_param(struct wlan_objmgr_vdev *vdev,
72 wlan_crypto_param_type param,
73 uint32_t value);
74
75 /**
76 * wlan_crypto_set_peer_param() - called by ucfg to set crypto param
77 *
78 * @peer: peer
79 * @param: param to be set.
80 * @value: value
81 *
82 * This function gets called from ucfg to set param
83 *
84 * Return: QDF_STATUS_SUCCESS - in case of success
85 */
86 QDF_STATUS wlan_crypto_set_peer_param(struct wlan_objmgr_peer *peer,
87 wlan_crypto_param_type param,
88 uint32_t value);
89
90 /**
91 * wlan_crypto_get_param() - called by ucfg to get crypto param
92 * @vdev: vdev
93 * @param: param to be get.
94 *
95 * This function gets called from ucfg to get param
96 *
97 * Return: value or -1 for failure
98 */
99 int32_t wlan_crypto_get_param(struct wlan_objmgr_vdev *vdev,
100 wlan_crypto_param_type param);
101
102 /**
103 * wlan_crypto_get_peer_param() - called by ucfg to get crypto peer param
104 * @peer: peer
105 * @param: param to be get.
106 *
107 * This function gets called from ucfg to get peer param
108 *
109 * Return: value or -1 for failure
110 */
111 int32_t wlan_crypto_get_peer_param(struct wlan_objmgr_peer *peer,
112 wlan_crypto_param_type param);
113
114 /**
115 * wlan_crypto_is_htallowed() - called by ucfg to check if HT rates is allowed
116 * @vdev: Vdev
117 * @peer: Peer
118 *
119 * This function is called to check if HT rates is allowed
120 *
121 * Return: 0 for not allowed and +ve for allowed
122 */
123 uint8_t wlan_crypto_is_htallowed(struct wlan_objmgr_vdev *vdev,
124 struct wlan_objmgr_peer *peer);
125
126 /**
127 * wlan_crypto_setkey() - called by ucfg to setkey
128 * @vdev: vdev
129 * @req_key: req_key with cipher type, key macaddress
130 *
131 * This function gets called from ucfg to sey key
132 *
133 * Return: QDF_STATUS_SUCCESS - in case of success
134 */
135 QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev,
136 struct wlan_crypto_req_key *req_key);
137
138 /**
139 * wlan_crypto_getkey() - called by ucfg to get key
140 * @vdev: vdev
141 * @req_key: key value will be copied in this req_key
142 * @mac_addr: mac address of the peer for unicast key
143 * or broadcast address if group key is requested.
144 *
145 * This function gets called from ucfg to get key
146 *
147 * Return: QDF_STATUS_SUCCESS - in case of success
148 */
149 QDF_STATUS wlan_crypto_getkey(struct wlan_objmgr_vdev *vdev,
150 struct wlan_crypto_req_key *req_key,
151 uint8_t *mac_addr);
152
153 /**
154 * wlan_crypto_delkey() - called by ucfg to delete key
155 * @vdev: vdev
156 * @macaddr: mac address of the peer for unicast key
157 * or broadcast address if group key is deleted.
158 * @key_idx: key index to be deleted
159 *
160 * This function gets called from ucfg to delete key
161 *
162 * Return: QDF_STATUS_SUCCESS - in case of success
163 */
164 QDF_STATUS wlan_crypto_delkey(struct wlan_objmgr_vdev *vdev,
165 uint8_t *macaddr,
166 uint8_t key_idx);
167
168 /**
169 * wlan_crypto_default_key() - called by ucfg to set default tx key
170 * @vdev: vdev
171 * @macaddr: mac address of the peer for unicast key
172 * or broadcast address if group key need to made default.
173 * @key_idx: key index to be made as default key
174 * @unicast: is key was unicast or group key.
175 *
176 * This function gets called from ucfg to set default key
177 *
178 * Return: QDF_STATUS_SUCCESS - in case of success
179 */
180 QDF_STATUS wlan_crypto_default_key(struct wlan_objmgr_vdev *vdev,
181 uint8_t *macaddr,
182 uint8_t key_idx,
183 bool unicast);
184
185 /**
186 * wlan_crypto_encap() - called by mgmt for encap the frame based on cipher
187 * @vdev: vdev
188 * @wbuf: wbuf
189 * @macaddr: macaddr
190 * @encapdone: is encapdone already or not.
191 *
192 * This function gets called from mgmt txrx to encap frame.
193 *
194 * Return: QDF_STATUS_SUCCESS - in case of success
195 */
196 QDF_STATUS wlan_crypto_encap(struct wlan_objmgr_vdev *vdev,
197 qdf_nbuf_t wbuf,
198 uint8_t *macaddr,
199 uint8_t encapdone);
200
201 /**
202 * wlan_crypto_decap() - called by mgmt for decap the frame based on cipher
203 * @vdev: vdev
204 * @wbuf: wbuf
205 * @macaddr: macaddr
206 * @tid: tid of the packet.
207 *
208 * This function gets called from mgmt txrx to decap frame.
209 *
210 * Return: QDF_STATUS_SUCCESS - in case of success
211 */
212 QDF_STATUS wlan_crypto_decap(struct wlan_objmgr_vdev *vdev,
213 qdf_nbuf_t wbuf,
214 uint8_t *macaddr,
215 uint8_t tid);
216
217 /**
218 * wlan_crypto_enmic() - called by mgmt for adding mic in frame based on cipher
219 * @vdev: vdev
220 * @wbuf: wbuf
221 * @macaddr: macaddr
222 * @encapdone: is encapdone already or not.
223 *
224 * This function gets called from mgmt txrx to adding mic to the frame.
225 *
226 * Return: QDF_STATUS_SUCCESS - in case of success
227 */
228 QDF_STATUS wlan_crypto_enmic(struct wlan_objmgr_vdev *vdev,
229 qdf_nbuf_t wbuf,
230 uint8_t *macaddr,
231 uint8_t encapdone);
232
233 /**
234 * wlan_crypto_demic() - called by mgmt for remove and check mic for
235 * the frame based on cipher
236 * @vdev: vdev
237 * @wbuf: wbuf
238 * @macaddr: macaddr
239 * @tid: tid of the frame
240 * @keyid: keyid in the received frame
241 *
242 * This function gets called from mgmt txrx to decap frame.
243 *
244 * Return: QDF_STATUS_SUCCESS - in case of success
245 */
246 QDF_STATUS wlan_crypto_demic(struct wlan_objmgr_vdev *vdev,
247 qdf_nbuf_t wbuf,
248 uint8_t *macaddr,
249 uint8_t tid,
250 uint8_t keyid);
251
252 /**
253 * wlan_crypto_vdev_is_pmf_enabled() - called to check is pmf enabled in vdev
254 * @vdev: vdev
255 *
256 * This function gets called to check is pmf enabled or not in vdev.
257 *
258 * Return: true or false
259 */
260 bool wlan_crypto_vdev_is_pmf_enabled(struct wlan_objmgr_vdev *vdev);
261
262 /**
263 * wlan_crypto_vdev_is_pmf_required() - called to check is pmf required in vdev
264 * @vdev: vdev
265 *
266 * This function gets called to check is pmf required or not in vdev.
267 *
268 * Return: true or false
269 */
270 bool wlan_crypto_vdev_is_pmf_required(struct wlan_objmgr_vdev *vdev);
271
272 /**
273 * wlan_crypto_is_pmf_enabled() - called by mgmt txrx to check is pmf enabled
274 * @vdev: vdev
275 * @peer: peer
276 *
277 * This function gets called by mgmt txrx to check is pmf enabled or not.
278 *
279 * Return: true or false
280 */
281 bool wlan_crypto_is_pmf_enabled(struct wlan_objmgr_vdev *vdev,
282 struct wlan_objmgr_peer *peer);
283
284 /**
285 * wlan_crypto_is_key_valid() - called by mgmt txrx to check if key is valid
286 * @vdev: vdev
287 * @peer: peer
288 * @keyidx : key index
289 *
290 * This function gets called by mgmt txrx to check if key is valid
291 *
292 * Return: true or false
293 */
294 bool wlan_crypto_is_key_valid(struct wlan_objmgr_vdev *vdev,
295 struct wlan_objmgr_peer *peer,
296 uint16_t keyidx);
297
298 /**
299 * wlan_crypto_add_mmie() - called by mgmt txrx to add mmie in frame
300 * @vdev: vdev
301 * @frm: frame starting pointer
302 * @len: length of the frame
303 *
304 * This function gets called by mgmt txrx to add mmie in frame
305 *
306 * Return: end of frame or NULL in case failure
307 */
308 uint8_t *wlan_crypto_add_mmie(struct wlan_objmgr_vdev *vdev,
309 uint8_t *frm,
310 uint32_t len);
311
312 /**
313 * wlan_crypto_is_mmie_valid() - called by mgmt txrx to check mmie of the frame
314 * @vdev: vdev
315 * @frm: frame starting pointer
316 * @efrm: end of frame pointer
317 *
318 * This function gets called by mgmt txrx to check mmie of the frame
319 *
320 * Return: true or false
321 */
322 bool wlan_crypto_is_mmie_valid(struct wlan_objmgr_vdev *vdev,
323 uint8_t *frm,
324 uint8_t *efrm);
325
326 /**
327 * wlan_crypto_wpaie_check() - called by mlme to check the wpaie
328 * @crypto_params: crypto params
329 * @frm: ie buffer
330 *
331 * This function gets called by mlme to check the contents of wpa is
332 * matching with given crypto params
333 *
334 * Return: QDF_STATUS_SUCCESS - in case of success
335 */
336 QDF_STATUS wlan_crypto_wpaie_check(struct wlan_crypto_params *crypto_params,
337 const uint8_t *frm);
338
339 /**
340 * wlan_crypto_rsnie_check() - called by mlme to check the rsnie
341 * @crypto_params: crypto params
342 * @frm: ie buffer
343 *
344 * This function gets called by mlme to check the contents of rsn is
345 * matching with given crypto params
346 *
347 * Return: QDF_STATUS_SUCCESS - in case of success
348 */
349 QDF_STATUS wlan_crypto_rsnie_check(struct wlan_crypto_params *crypto_params,
350 const uint8_t *frm);
351
352 /**
353 * wlan_crypto_rsnxie_check() - called by mlme to parse rsnx capabilities
354 * @crypto_params: crypto params
355 * @rsnxe: rsnx ie buffer
356 *
357 * This function gets called by mlme to extract rsnx capabilities
358 *
359 * Return: None
360 */
361 void wlan_crypto_rsnxie_check(struct wlan_crypto_params *crypto_params,
362 const uint8_t *rsnxe);
363
364 /**
365 * wlan_crypto_build_wpaie() - called by mlme to build wpaie
366 * @vdev: vdev
367 * @iebuf: ie buffer
368 *
369 * This function gets called by mlme to build wpaie from given vdev
370 *
371 * Return: end of buffer
372 */
373 uint8_t *wlan_crypto_build_wpaie(struct wlan_objmgr_vdev *vdev,
374 uint8_t *iebuf);
375
376 /**
377 * wlan_crypto_build_rsnie_with_pmksa() - called by mlme to build rsnie
378 * @vdev: vdev
379 * @iebuf: ie buffer
380 * @pmksa: pmksa struct
381 *
382 * This function gets called by mlme to build rsnie from given vdev
383 *
384 * Return: end of buffer
385 */
386 uint8_t *wlan_crypto_build_rsnie_with_pmksa(struct wlan_objmgr_vdev *vdev,
387 uint8_t *iebuf,
388 struct wlan_crypto_pmksa *pmksa);
389
390 /**
391 * wlan_crypto_build_rsnie() - called by mlme to build rsnie
392 * @vdev: vdev
393 * @iebuf: ie buffer
394 * @bssid: bssid mac address to add pmkid in rsnie
395 *
396 * This function gets called by mlme to build rsnie from given vdev
397 *
398 * Return: end of buffer
399 */
400 uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev,
401 uint8_t *iebuf,
402 struct qdf_mac_addr *bssid);
403
404 /**
405 * wlan_crypto_wapiie_check() - called by mlme to check the wapiie
406 * @crypto_params: crypto params
407 * @frm: ie buffer
408 *
409 * This function gets called by mlme to check the contents of wapi is
410 * matching with given crypto params
411 *
412 * Return: QDF_STATUS_SUCCESS - in case of success
413 */
414 QDF_STATUS wlan_crypto_wapiie_check(struct wlan_crypto_params *crypto_params,
415 const uint8_t *frm);
416
417 /**
418 * wlan_crypto_build_wapiie() - called by mlme to build wapi ie
419 * @vdev: vdev
420 * @iebuf: ie buffer
421 *
422 * This function gets called by mlme to build wapi ie from given vdev
423 *
424 * Return: end of buffer
425 */
426 uint8_t *wlan_crypto_build_wapiie(struct wlan_objmgr_vdev *vdev,
427 uint8_t *iebuf);
428
429 /**
430 * wlan_crypto_rsn_info() - check is given params matching with vdev params.
431 * @vdev: vdev
432 * @crypto_params: crypto params
433 *
434 * This function gets called by mlme to check is given params matching with
435 * vdev params.
436 *
437 * Return: true success or false for failure.
438 */
439 bool wlan_crypto_rsn_info(struct wlan_objmgr_vdev *vdev,
440 struct wlan_crypto_params *crypto_params);
441
442 /**
443 * wlan_crypto_pn_check() - called by data patch for PN check
444 * @vdev: vdev
445 * @wbuf: wbuf
446 *
447 * This function gets called by data patch for PN check
448 *
449 * Return: QDF_STATUS
450 */
451 QDF_STATUS wlan_crypto_pn_check(struct wlan_objmgr_vdev *vdev,
452 qdf_nbuf_t wbuf);
453
454 /**
455 * wlan_crypto_vdev_get_crypto_params() - called by mlme to get crypto params
456 * @vdev:vdev
457 *
458 * This function gets called by mlme to get crypto params
459 *
460 * Return: wlan_crypto_params or NULL in case of failure
461 */
462 struct wlan_crypto_params *wlan_crypto_vdev_get_crypto_params(
463 struct wlan_objmgr_vdev *vdev);
464
465 /**
466 * wlan_crypto_peer_get_crypto_params() - called by mlme to get crypto params
467 * @peer:peer
468 *
469 * This function gets called by mlme to get crypto params
470 *
471 * Return: wlan_crypto_params or NULL in case of failure
472 */
473 struct wlan_crypto_params *wlan_crypto_peer_get_crypto_params(
474 struct wlan_objmgr_peer *peer);
475
476 /**
477 * wlan_crypto_set_peer_wep_keys() - set wep keys into peer entries
478 * @vdev:vdev
479 * @peer:peer
480 *
481 * This function gets called by mlme, when auth frame is received.
482 * this helps in setting wep keys into peer data structure.
483 *
484 * Return: QDF_STATUS
485 */
486 QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev,
487 struct wlan_objmgr_peer *peer);
488
489 /**
490 * wlan_crypto_register_crypto_rx_ops() - set crypto_rx_ops
491 * @crypto_rx_ops: crypto_rx_ops
492 *
493 * This function gets called by object manager to register crypto rx ops.
494 *
495 * Return: QDF_STATUS
496 */
497 QDF_STATUS wlan_crypto_register_crypto_rx_ops(
498 struct wlan_lmac_if_crypto_rx_ops *crypto_rx_ops);
499
500 /**
501 * wlan_crypto_get_crypto_rx_ops() - get crypto_rx_ops from psoc
502 * @psoc: psoc
503 *
504 * This function gets called by umac to get the crypto_rx_ops
505 *
506 * Return: crypto_rx_ops
507 */
508 struct wlan_lmac_if_crypto_rx_ops *wlan_crypto_get_crypto_rx_ops(
509 struct wlan_objmgr_psoc *psoc);
510
511 /**
512 * wlan_crypto_vdev_has_auth_mode() - check authmode for vdev
513 * @vdev: vdev
514 * @authmode: authmode value to be checked
515 *
516 * This function checks if authmode passed is set in vdev or not
517 *
518 * Return: true or false
519 */
520 bool wlan_crypto_vdev_has_auth_mode(struct wlan_objmgr_vdev *vdev,
521 wlan_crypto_auth_mode authmode);
522
523 /**
524 * wlan_crypto_peer_has_auth_mode() - check authmode for peer
525 * @peer: peer
526 * @authvalue: authvalue to be checked
527 *
528 * This function check is authvalue passed is set in peer or not
529 *
530 * Return: true or false
531 */
532 bool wlan_crypto_peer_has_auth_mode(struct wlan_objmgr_peer *peer,
533 wlan_crypto_auth_mode authvalue);
534
535 /**
536 * wlan_crypto_vdev_has_ucastcipher() - check ucastcipher for vdev
537 * @vdev: vdev
538 * @ucastcipher: ucastcipher to be checked
539 *
540 * This function check is ucastcipher passed is set in vdev or not
541 *
542 * Return: true or false
543 */
544 bool wlan_crypto_vdev_has_ucastcipher(struct wlan_objmgr_vdev *vdev,
545 wlan_crypto_cipher_type ucastcipher);
546
547 /**
548 * wlan_crypto_peer_has_ucastcipher() - check ucastcipher for peer
549 * @peer: peer
550 * @ucastcipher: ucastcipher to be checked
551 *
552 * This function check is ucastcipher passed is set in peer or not
553 *
554 * Return: true or false
555 */
556 bool wlan_crypto_peer_has_ucastcipher(struct wlan_objmgr_peer *peer,
557 wlan_crypto_cipher_type ucastcipher);
558
559
560 /**
561 * wlan_crypto_vdev_has_mcastcipher() - check mcastcipher for vdev
562 * @vdev: vdev
563 * @mcastcipher: mcastcipher to be checked
564 *
565 * This function check is mcastcipher passed is set in vdev or not
566 *
567 * Return: true or false
568 */
569 bool wlan_crypto_vdev_has_mcastcipher(struct wlan_objmgr_vdev *vdev,
570 wlan_crypto_cipher_type mcastcipher);
571
572 /**
573 * wlan_crypto_peer_has_mcastcipher() - check mcastcipher for peer
574 * @peer: peer
575 * @mcastcipher: mcastcipher to be checked
576 *
577 * This function check is mcastcipher passed is set in peer or not
578 *
579 * Return: true or false
580 */
581 bool wlan_crypto_peer_has_mcastcipher(struct wlan_objmgr_peer *peer,
582 wlan_crypto_cipher_type mcastcipher);
583
584 /**
585 * wlan_crypto_vdev_has_mgmtcipher() - check mgmtcipher for vdev
586 * @vdev: vdev
587 * @mgmtcipher: mgmtcipher to be checked
588 *
589 * This function checks any one of mgmtciphers are supported by vdev or not.
590 *
591 * Return: true or false
592 */
593 bool wlan_crypto_vdev_has_mgmtcipher(struct wlan_objmgr_vdev *vdev,
594 uint32_t mgmtcipher);
595
596 /**
597 * wlan_crypto_peer_has_mgmtcipher() - check mgmtcipher for peer
598 * @peer: peer
599 * @mgmtcipher: mgmtcipher to be checked
600 *
601 * This function checks any one of mgmtciphers are supported by peer or not.
602 *
603 * Return: true or false
604 */
605 bool wlan_crypto_peer_has_mgmtcipher(struct wlan_objmgr_peer *peer,
606 uint32_t mgmtcipher);
607
608 /**
609 * wlan_crypto_get_key_type() - get keytype
610 * @key: key
611 *
612 * This function gets keytype from key
613 *
614 * Return: keytype
615 */
616 wlan_crypto_cipher_type wlan_crypto_get_key_type(struct wlan_crypto_key *key);
617
618 /**
619 * wlan_crypto_vdev_getkey() - get key from vdev
620 * @vdev: vdev
621 * @keyix: keyix
622 *
623 * This function gets key from vdev
624 *
625 * Return: key or NULL
626 */
627 struct wlan_crypto_key *wlan_crypto_vdev_getkey(struct wlan_objmgr_vdev *vdev,
628 uint16_t keyix);
629
630 /**
631 * wlan_crypto_peer_getkey() - get key from peer
632 * @peer: peer
633 * @keyix: keyix
634 *
635 * This function gets key from peer
636 *
637 * Return: key or NULL
638 */
639 struct wlan_crypto_key *wlan_crypto_peer_getkey(struct wlan_objmgr_peer *peer,
640 uint16_t keyix);
641
642 /**
643 * wlan_crypto_get_peer_fils_aead() - Get peer fils aead set flag
644 * @peer: Peer object
645 *
646 * This function returns the peer fils aead set flag value.
647 *
648 * Return: 1 for enabled, 0 for disabled
649 */
650 uint8_t wlan_crypto_get_peer_fils_aead(struct wlan_objmgr_peer *peer);
651
652 /**
653 * wlan_crypto_set_peer_fils_aead() - Set peer fils aead set flag
654 * @peer: Peer object
655 * @value: Value to set the flag
656 *
657 * This function set the peer fils aead set flag once FILS AUTH received.
658 *
659 * Return: None
660 */
661 void wlan_crypto_set_peer_fils_aead(
662 struct wlan_objmgr_peer *peer, uint8_t value);
663
664 /**
665 * wlan_crypto_get_key_header() - get header length
666 * @key: key
667 *
668 * This function gets header length based on keytype
669 *
670 * Return: header length
671 */
672 uint8_t wlan_crypto_get_key_header(struct wlan_crypto_key *key);
673
674 /**
675 * wlan_crypto_get_key_trailer() - get cipher trailer length
676 * @key: key
677 *
678 * This function gets cipher trailer length based on keytype
679 *
680 * Return: cipher trailer length
681 */
682 uint8_t wlan_crypto_get_key_trailer(struct wlan_crypto_key *key);
683
684 /**
685 * wlan_crypto_get_key_miclen() - get cipher miclen length
686 * @key: key
687 *
688 * This function gets cipher miclen length based on keytype
689 *
690 * Return: cipher miclen length
691 */
692 uint8_t wlan_crypto_get_key_miclen(struct wlan_crypto_key *key);
693
694 /**
695 * wlan_crypto_get_keyid() - get keyid from frame
696 * @data: frame
697 * @hdrlen: 802.11 header length
698 *
699 * This function parse frame and returns keyid
700 *
701 * Return: keyid
702 */
703 uint16_t wlan_crypto_get_keyid(uint8_t *data, int hdrlen);
704
705 /**
706 * wlan_crypto_restore_keys() - restore crypto keys in hw keycache
707 * @vdev: vdev
708 *
709 * This function restores keys in hw keycache
710 *
711 * Return: void
712 */
713 void wlan_crypto_restore_keys(struct wlan_objmgr_vdev *vdev);
714
715 /**
716 * wlan_crypto_check_rsn_match() - called by ucfg to check for RSN match
717 * @psoc: psoc pointer
718 * @vdev_id: vdev id
719 * @ie_ptr: pointer to IEs
720 * @ie_len: IE length
721 * @peer_crypto_params: return peer crypto parameters
722 *
723 * This function gets called from ucfg to check RSN match.
724 *
725 * Return: true or false
726 */
727 bool wlan_crypto_check_rsn_match(struct wlan_objmgr_psoc *psoc,
728 uint8_t vdev_id, uint8_t *ie_ptr,
729 uint16_t ie_len, struct wlan_crypto_params *
730 peer_crypto_params);
731
732 /**
733 * wlan_crypto_check_wpa_match() - called by ucfg to check for WPA match
734 * @psoc: psoc pointer
735 * @vdev_id: vdev id
736 * @ie_ptr: pointer to IEs
737 * @ie_len: IE length
738 * @peer_crypto_params: return peer crypto parameters
739 *
740 * This function gets called from ucfg to check WPA match.
741 *
742 * Return: true or false
743 */
744 bool wlan_crypto_check_wpa_match(struct wlan_objmgr_psoc *psoc,
745 uint8_t vdev_id, uint8_t *ie_ptr,
746 uint16_t ie_len, struct wlan_crypto_params *
747 peer_crypto_params);
748
749 /**
750 * wlan_crypto_parse_rsnxe_ie() - parse RSNXE IE
751 * @rsnxe_ie: RSNXE IE pointer
752 * @cap_len: pointer to hold len of ext capability
753 *
754 * Return: pointer to RSNXE capability or NULL
755 */
756 const uint8_t *
757 wlan_crypto_parse_rsnxe_ie(const uint8_t *rsnxe_ie, uint8_t *cap_len);
758
759 /**
760 * wlan_get_crypto_params_from_wapi_ie() - Function to get crypto params
761 * from wapi ie
762 * @crypto_params: return crypto parameters
763 * @ie_ptr: pointer to IEs
764 * @ie_len: IE length
765 *
766 * This function is used to get the crypto parameters from wapi ie
767 *
768 * Context: Any context.
769 * Return: QDF_STATUS
770 */
771 #ifdef FEATURE_WLAN_WAPI
772 QDF_STATUS
773 wlan_get_crypto_params_from_wapi_ie(struct wlan_crypto_params *crypto_params,
774 const uint8_t *ie_ptr, uint16_t ie_len);
775
776 #else
777 static inline QDF_STATUS
wlan_get_crypto_params_from_wapi_ie(struct wlan_crypto_params * crypto_params,const uint8_t * ie_ptr,uint16_t ie_len)778 wlan_get_crypto_params_from_wapi_ie(struct wlan_crypto_params *crypto_params,
779 const uint8_t *ie_ptr, uint16_t ie_len)
780 {
781 return QDF_STATUS_E_NOSUPPORT;
782 }
783 #endif
784
785 /**
786 * wlan_get_crypto_params_from_wpa_ie() - Function to get crypto params
787 * from wpa ie
788 * @crypto_params: return crypto parameters
789 * @ie_ptr: pointer to IEs
790 * @ie_len: IE length
791 *
792 * This function is used to get the crypto parameters from wpa ie
793 *
794 * Context: Any context.
795 * Return: QDF_STATUS
796 */
797 QDF_STATUS
798 wlan_get_crypto_params_from_wpa_ie(struct wlan_crypto_params *crypto_params,
799 const uint8_t *ie_ptr, uint16_t ie_len);
800
801 /**
802 * wlan_get_crypto_params_from_rsn_ie() - Function to get crypto params
803 * from rsn ie
804 * @crypto_params: return crypto parameters
805 * @ie_ptr: pointer to IEs
806 * @ie_len: IE length
807 *
808 * This function is used to get the crypto parameters from rsn ie
809 *
810 * Context: Any context.
811 * Return: QDF_STATUS
812 */
813 QDF_STATUS
814 wlan_get_crypto_params_from_rsn_ie(struct wlan_crypto_params *crypto_params,
815 const uint8_t *ie_ptr, uint16_t ie_len);
816
817 /**
818 * wlan_set_vdev_crypto_prarams_from_ie() - Sets vdev crypto params from IE info
819 * @vdev: vdev pointer
820 * @ie_ptr: pointer to IE
821 * @ie_len: IE length
822 *
823 * This function gets called from ucfg to set crypto params from IE data.
824 *
825 * Return: QDF_STATUS_SUCCESS or error code
826 */
827 QDF_STATUS wlan_set_vdev_crypto_prarams_from_ie(struct wlan_objmgr_vdev *vdev,
828 uint8_t *ie_ptr,
829 uint16_t ie_len);
830 #ifdef WLAN_CRYPTO_GCM_OS_DERIVATIVE
wlan_crypto_aes_gmac(const uint8_t * key,size_t key_len,uint8_t * iv,size_t iv_len,const uint8_t * aad,size_t aad_len,uint8_t * tag)831 static inline int wlan_crypto_aes_gmac(const uint8_t *key, size_t key_len,
832 uint8_t *iv, size_t iv_len,
833 const uint8_t *aad, size_t aad_len,
834 uint8_t *tag)
835 {
836 return qdf_crypto_aes_gmac(key, key_len, iv, aad,
837 aad + AAD_LEN,
838 aad_len - AAD_LEN -
839 IEEE80211_MMIE_GMAC_MICLEN,
840 tag);
841 }
842 #endif
843 #ifdef WLAN_CRYPTO_OMAC1_OS_DERIVATIVE
omac1_aes_128(const uint8_t * key,const uint8_t * data,size_t data_len,uint8_t * mac)844 static inline int omac1_aes_128(const uint8_t *key, const uint8_t *data,
845 size_t data_len, uint8_t *mac)
846 {
847 return qdf_crypto_aes_128_cmac(key, data, data_len, mac);
848 }
849
omac1_aes_256(const uint8_t * key,const uint8_t * data,size_t data_len,uint8_t * mac)850 static inline int omac1_aes_256(const uint8_t *key, const uint8_t *data,
851 size_t data_len, uint8_t *mac)
852 {
853 return 0;
854 }
855 #endif
856
857 /**
858 * ucfg_crypto_set_key_req() - Set key request to UCFG
859 * @vdev: vdev object
860 * @req: key request information
861 * @key_type: indicates the type of key to be set, unicast or group key
862 *
863 * Return: None
864 */
865 QDF_STATUS ucfg_crypto_set_key_req(struct wlan_objmgr_vdev *vdev,
866 struct wlan_crypto_key *req,
867 enum wlan_crypto_key_type key_type);
868
869 /**
870 * wlan_crypto_get_default_key_idx() - Get the default key index
871 * @vdev: vdev object
872 * @igtk: denotes if the request is for igtk key type or not
873 *
874 * Return: Index of the requested key
875 */
876 int8_t wlan_crypto_get_default_key_idx(struct wlan_objmgr_vdev *vdev,
877 bool igtk);
878
879 /**
880 * wlan_crypto_get_cipher() - Get the cipher type for the vdev
881 * @vdev: vdev object
882 * @pairwise: denotes if the request is for pairwise cipher or not
883 * @key_index: Index of the key whose cipher type has to be returned
884 *
885 * Return: enum wlan_crypto_cipher_type
886 */
887 enum wlan_crypto_cipher_type
888 wlan_crypto_get_cipher(struct wlan_objmgr_vdev *vdev,
889 bool pairwise, uint8_t key_index);
890
891 /**
892 * wlan_crypto_get_secure_akm_available() - Search the AKM bitmap to
893 * find the most secure AKM.
894 * @akm: Bitmap of available AKMs.
895 *
896 * Search in the decreasing order of AKM security and return the
897 * first matching AKM available in @akm bitmap.
898 *
899 * Return: enum wlan_crypto_key_mgmt
900 */
901 wlan_crypto_key_mgmt wlan_crypto_get_secure_akm_available(uint32_t akm);
902 #ifdef CRYPTO_SET_KEY_CONVERGED
903 /**
904 * wlan_crypto_update_set_key_peer() - Update the peer for set key
905 * @vdev: vdev object
906 * @pairwise: denotes if the request is for pairwise cipher or not
907 * @key_index: Index of the key whose peer has to be set
908 * @peer_mac: MAC address of the peer
909 *
910 * Return: None
911 */
912 void wlan_crypto_update_set_key_peer(struct wlan_objmgr_vdev *vdev,
913 bool pairwise, uint8_t key_index,
914 struct qdf_mac_addr *peer_mac);
915
916 /**
917 * wlan_crypto_validate_key_params() - validates key parameters
918 * @cipher: cipher type
919 * @key_index: the index of the key
920 * @key_len: key length
921 * @seq_len: sequence counter length
922 *
923 * Return: QDF_STATUS
924 */
925 QDF_STATUS wlan_crypto_validate_key_params(enum wlan_crypto_cipher_type cipher,
926 uint8_t key_index, uint8_t key_len,
927 uint8_t seq_len);
928 /**
929 * wlan_crypto_save_ml_sta_key - Allocate memory for ml sta key
930 * @psoc: psoc handler
931 * @key_index: key index
932 * @crypto_key: crypto key
933 * @link_addr: link addr
934 * @link_id: link id
935 *
936 * Return: zero on success
937 */
938 QDF_STATUS
939 wlan_crypto_save_ml_sta_key(struct wlan_objmgr_psoc *psoc,
940 uint8_t key_index,
941 struct wlan_crypto_key *crypto_key,
942 struct qdf_mac_addr *link_addr, uint8_t link_id);
943
944 /**
945 * wlan_crypto_save_key() - Allocate memory for storing key
946 * @vdev: vdev object
947 * @key_index: the index of the key that needs to be allocated
948 * @crypto_key: Pointer to crypto key
949 *
950 * Return: QDF_STATUS
951 */
952 QDF_STATUS wlan_crypto_save_key(struct wlan_objmgr_vdev *vdev,
953 uint8_t key_index,
954 struct wlan_crypto_key *crypto_key);
955
956 /**
957 * wlan_crypto_get_ml_sta_link_key() - Get the stored key info
958 * by link id
959 * @psoc: psoc handler
960 * @key_index: key index
961 * @link_addr: link address
962 * @link_id: link id
963 */
964 struct wlan_crypto_key *wlan_crypto_get_ml_sta_link_key(
965 struct wlan_objmgr_psoc *psoc,
966 uint8_t key_index,
967 struct qdf_mac_addr *link_addr,
968 uint8_t link_id);
969 /**
970 * wlan_crypto_get_key() - Get the stored key information
971 * @vdev: vdev object
972 * @key_index: the index of the key that needs to be retrieved
973 *
974 * Return: Key material
975 */
976 struct wlan_crypto_key *wlan_crypto_get_key(struct wlan_objmgr_vdev *vdev,
977 uint8_t key_index);
978
979 /**
980 * wlan_crypto_set_key_req() - Set key request
981 * @vdev: vdev object
982 * @req: key request information
983 * @key_type: indicates the type of key to be set, unicast or group key
984 *
985 * Return: QDF status
986 */
987 QDF_STATUS wlan_crypto_set_key_req(struct wlan_objmgr_vdev *vdev,
988 struct wlan_crypto_key *req,
989 enum wlan_crypto_key_type key_type);
990
991 /**
992 * wlan_crypto_free_key() - Free the given key
993 * @crypto_key: pointer to the key
994 *
995 * This function frees keys stored in vdev crypto object.
996 *
997 * Return: None
998 */
999 void wlan_crypto_free_key(struct wlan_crypto_keys *crypto_key);
1000
1001 /**
1002 * wlan_crypto_free_vdev_key() - Free keys for vdev
1003 * @vdev: vdev object
1004 *
1005 * This function frees keys stored in vdev crypto object.
1006 *
1007 * Return: None
1008 */
1009 void wlan_crypto_free_vdev_key(struct wlan_objmgr_vdev *vdev);
1010
1011 /**
1012 * wlan_crypto_reset_vdev_params() - Reset params for vdev
1013 * @vdev: vdev object
1014 *
1015 * This function reset params stored in vdev crypto object.
1016 *
1017 * Return: None
1018 */
1019 void wlan_crypto_reset_vdev_params(struct wlan_objmgr_vdev *vdev);
1020 #else
wlan_crypto_update_set_key_peer(struct wlan_objmgr_vdev * vdev,bool pairwise,uint8_t key_index,struct qdf_mac_addr * peer_mac)1021 static inline void wlan_crypto_update_set_key_peer(
1022 struct wlan_objmgr_vdev *vdev,
1023 bool pairwise,
1024 uint8_t key_index,
1025 struct qdf_mac_addr *peer_mac)
1026 {
1027 }
1028
1029 static inline QDF_STATUS
wlan_crypto_save_key(struct wlan_objmgr_vdev * vdev,uint8_t key_index,struct wlan_crypto_key * crypto_key)1030 wlan_crypto_save_key(struct wlan_objmgr_vdev *vdev, uint8_t key_index,
1031 struct wlan_crypto_key *crypto_key)
1032 {
1033 return QDF_STATUS_SUCCESS;
1034 }
1035
1036 static inline struct wlan_crypto_key *
wlan_crypto_get_key(struct wlan_objmgr_vdev * vdev,uint8_t key_index)1037 wlan_crypto_get_key(struct wlan_objmgr_vdev *vdev, uint8_t key_index)
1038 {
1039 return NULL;
1040 }
1041
1042 static inline
wlan_crypto_set_key_req(struct wlan_objmgr_vdev * vdev,struct wlan_crypto_key * req,enum wlan_crypto_key_type key_type)1043 QDF_STATUS wlan_crypto_set_key_req(struct wlan_objmgr_vdev *vdev,
1044 struct wlan_crypto_key *req,
1045 enum wlan_crypto_key_type key_type)
1046 {
1047 return QDF_STATUS_SUCCESS;
1048 }
1049
wlan_crypto_free_vdev_key(struct wlan_objmgr_vdev * vdev)1050 static inline void wlan_crypto_free_vdev_key(struct wlan_objmgr_vdev *vdev)
1051 {
1052 }
1053
wlan_crypto_reset_vdev_params(struct wlan_objmgr_vdev * vdev)1054 static inline void wlan_crypto_reset_vdev_params(struct wlan_objmgr_vdev *vdev)
1055 {
1056 }
1057 #endif /* CRYPTO_SET_KEY_CONVERGED */
1058
1059 /**
1060 * wlan_crypto_vdev_set_param() - Send vdev set param to firmware.
1061 * @psoc: Pointer to PSOC object
1062 * @vdev_id: vdev id
1063 * @param_id: Param id
1064 * @param_value: Param value
1065 *
1066 * Return: QDF_STATUS
1067 */
1068 QDF_STATUS
1069 wlan_crypto_vdev_set_param(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id,
1070 uint32_t param_id, uint32_t param_value);
1071
1072 /**
1073 * wlan_crypto_get_peer_pmksa() - called to get pmksa based on pmksa parameter
1074 * @vdev: vdev
1075 * @pmksa: bssid
1076 *
1077 * This function is to get pmksa based on pmksa parameter
1078 *
1079 * Return: wlan_crypto_pmksa when match found else NULL.
1080 */
1081 struct wlan_crypto_pmksa *
1082 wlan_crypto_get_peer_pmksa(struct wlan_objmgr_vdev *vdev,
1083 struct wlan_crypto_pmksa *pmksa);
1084
1085 /**
1086 * wlan_crypto_get_pmksa() - called to get pmksa of bssid passed.
1087 * @vdev: vdev
1088 * @bssid: bssid
1089 *
1090 * This function gets called from to get pmksa for the bssid.
1091 *
1092 * Return: wlan_crypto_pmksa when match found else NULL.
1093 */
1094 struct wlan_crypto_pmksa *
1095 wlan_crypto_get_pmksa(struct wlan_objmgr_vdev *vdev,
1096 struct qdf_mac_addr *bssid);
1097
1098 /**
1099 * wlan_crypto_get_fils_pmksa() - Get the PMKSA for FILS
1100 * SSID, if the SSID and cache id matches
1101 * @vdev: Pointer with VDEV object
1102 * @cache_id: Cache id
1103 * @ssid: Pointer to ssid
1104 * @ssid_len: SSID length
1105 *
1106 * Return: PMKSA entry if the cache id and SSID matches
1107 */
1108 struct wlan_crypto_pmksa *
1109 wlan_crypto_get_fils_pmksa(struct wlan_objmgr_vdev *vdev,
1110 uint8_t *cache_id, uint8_t *ssid,
1111 uint8_t ssid_len);
1112
1113 /**
1114 * wlan_crypto_pmksa_flush() - called to flush saved pmksa
1115 * @crypto_params: crypto_params
1116 *
1117 * This function flush saved pmksa from crypto params.
1118 *
1119 * Return: QDF_STATUS_SUCCESS - in case of success
1120 */
1121 QDF_STATUS wlan_crypto_pmksa_flush(struct wlan_crypto_params *crypto_params);
1122
1123 /**
1124 * wlan_crypto_set_del_pmksa() - called by ucfg to set/delete PMKSA
1125 * @vdev: vdev
1126 * @pmksa: pmksa to be set/del.
1127 * @set: set(set=1) or del(set=0) pmksa from the list.
1128 *
1129 * This function gets called from ucfg to set or del pmksa.
1130 * when given pmksa is NULL and set is 0, it is for flush all entries.
1131 *
1132 * Return: QDF_STATUS_SUCCESS - in case of success
1133 */
1134 QDF_STATUS wlan_crypto_set_del_pmksa(struct wlan_objmgr_vdev *vdev,
1135 struct wlan_crypto_pmksa *pmksa,
1136 bool set);
1137
1138 /**
1139 * wlan_crypto_update_pmk_cache_ft() - Updates the mobility domain information
1140 * for a BSSID in the PMKSA Cache table.
1141 * @vdev: vdev
1142 * @pmksa: pmksa to be updated.
1143 *
1144 * This function gets called from ucfg to update pmksa with mdid.
1145 * And flush the matching mdid entries.
1146 *
1147 * Return: QDF_STATUS_SUCCESS - in case of success
1148 */
1149 QDF_STATUS wlan_crypto_update_pmk_cache_ft(struct wlan_objmgr_vdev *vdev,
1150 struct wlan_crypto_pmksa *pmksa);
1151
1152 #if defined(WLAN_SAE_SINGLE_PMK) && defined(WLAN_FEATURE_ROAM_OFFLOAD)
1153 /**
1154 * wlan_crypto_selective_clear_sae_single_pmk_entries() - Clear the PMK entries
1155 * for BSS which have the single PMK flag set other than the current connected
1156 * AP
1157 * @vdev: Vdev
1158 * @conn_bssid: Connected bssid
1159 */
1160 void
1161 wlan_crypto_selective_clear_sae_single_pmk_entries(
1162 struct wlan_objmgr_vdev *vdev, struct qdf_mac_addr *conn_bssid);
1163
1164 /**
1165 * wlan_crypto_set_sae_single_pmk_bss_cap() - Set the peer SAE single pmk
1166 * feature supported status
1167 * @vdev: Vdev
1168 * @bssid: BSSID for which the flag is to be set
1169 * @single_pmk_capable_bss: Flag to indicate Sae single pmk supported BSSID or
1170 * not
1171 */
1172 void wlan_crypto_set_sae_single_pmk_bss_cap(struct wlan_objmgr_vdev *vdev,
1173 struct qdf_mac_addr *bssid,
1174 bool single_pmk_capable_bss);
1175
1176 /**
1177 * wlan_crypto_set_sae_single_pmk_info() - Set the peer SAE single pmk info
1178 * @vdev: Vdev
1179 * @roam_sync_pmksa: pmk info for roamed AP
1180 */
1181 void
1182 wlan_crypto_set_sae_single_pmk_info(struct wlan_objmgr_vdev *vdev,
1183 struct wlan_crypto_pmksa *roam_sync_pmksa);
1184
1185 #else
1186 static inline void
wlan_crypto_selective_clear_sae_single_pmk_entries(struct wlan_objmgr_vdev * vdev,struct qdf_mac_addr * conn_bssid)1187 wlan_crypto_selective_clear_sae_single_pmk_entries(
1188 struct wlan_objmgr_vdev *vdev, struct qdf_mac_addr *conn_bssid)
1189 {
1190 }
1191
1192 static inline
wlan_crypto_set_sae_single_pmk_bss_cap(struct wlan_objmgr_vdev * vdev,struct qdf_mac_addr * bssid,bool single_pmk_capable_bss)1193 void wlan_crypto_set_sae_single_pmk_bss_cap(struct wlan_objmgr_vdev *vdev,
1194 struct qdf_mac_addr *bssid,
1195 bool single_pmk_capable_bss)
1196 {
1197 }
1198
1199 static inline void
wlan_crypto_set_sae_single_pmk_info(struct wlan_objmgr_vdev * vdev,struct wlan_crypto_pmksa * roam_sync_pmksa)1200 wlan_crypto_set_sae_single_pmk_info(struct wlan_objmgr_vdev *vdev,
1201 struct wlan_crypto_pmksa *roam_sync_pmksa)
1202 {
1203 }
1204 #endif
1205
1206 #if defined(WIFI_POS_CONVERGED) && defined(WLAN_FEATURE_RTT_11AZ_SUPPORT)
1207 QDF_STATUS
1208 wlan_crypto_set_ltf_keyseed(struct wlan_objmgr_psoc *psoc,
1209 struct wlan_crypto_ltf_keyseed_data *data);
1210 #else
1211 static inline QDF_STATUS
wlan_crypto_set_ltf_keyseed(struct wlan_objmgr_psoc * psoc,struct wlan_crypto_ltf_keyseed_data * data)1212 wlan_crypto_set_ltf_keyseed(struct wlan_objmgr_psoc *psoc,
1213 struct wlan_crypto_ltf_keyseed_data *data)
1214 {
1215 return QDF_STATUS_SUCCESS;
1216 }
1217 #endif
1218
1219 #ifdef WLAN_FEATURE_FILS_SK
1220 /**
1221 * wlan_crypto_create_fils_rik() - This API create rik using rrk coming from
1222 * supplicant.
1223 * @rrk: input rrk
1224 * @rrk_len: rrk length
1225 * @rik: Created rik
1226 * @rik_len: rik length to be filled
1227 *
1228 * rIK = KDF (K, S), where
1229 * K = rRK and
1230 * S = rIK Label + "\0" + cryptosuite + length
1231 * The rIK Label is the 8-bit ASCII string:
1232 * Re-authentication Integrity Key@ietf.org
1233 *
1234 * Return: QDF_STATUS
1235 */
1236 QDF_STATUS wlan_crypto_create_fils_rik(uint8_t *rrk, uint8_t rrk_len,
1237 uint8_t *rik, uint32_t *rik_len);
1238 /**
1239 * wlan_crypto_aquire_lock() - Acquire the crypto lock before crypto set/get
1240 */
1241 void wlan_crypto_aquire_lock(void);
1242
1243 /**
1244 * wlan_crypto_release_lock() - Release the crypto lock after crypto set/get
1245 */
1246 void wlan_crypto_release_lock(void);
1247 #endif /* WLAN_FEATURE_FILS_SK */
1248
1249 /**
1250 * crypto_flush_entries - This API will flush crypto keys
1251 * @psoc: psoc handler
1252 *
1253 * Return: None
1254 */
1255 void crypto_flush_entries(struct wlan_objmgr_psoc *psoc);
1256
1257 /**
1258 * ucfg_crypto_flush_entries - wrapper API for "crypto_flush_entries"
1259 * @psoc: psoc handler
1260 *
1261 * Return: None
1262 */
1263 void ucfg_crypto_flush_entries(struct wlan_objmgr_psoc *psoc);
1264
1265 /**
1266 * ucfg_crypto_free_key_by_link_id - free key by link id
1267 * @psoc: psoc handler
1268 * @link_addr: link address
1269 * @link_id: link id
1270 *
1271 * Return: None
1272 */
1273 void ucfg_crypto_free_key_by_link_id(struct wlan_objmgr_psoc *psoc,
1274 struct qdf_mac_addr *link_addr,
1275 uint8_t link_id);
1276 #endif /* end of _WLAN_CRYPTO_GLOBAL_API_H_ */
1277