1 /* 2 * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * DOC: Public APIs for crypto service 21 */ 22 #ifndef _WLAN_CRYPTO_GLOBAL_API_H_ 23 #define _WLAN_CRYPTO_GLOBAL_API_H_ 24 25 #include "wlan_crypto_global_def.h" 26 /** 27 * wlan_crypto_set_vdev_param - called by ucfg to set crypto param 28 * @vdev: vdev 29 * @param: param to be set. 30 * @value: value 31 * 32 * This function gets called from ucfg to set param 33 * 34 * Return: QDF_STATUS_SUCCESS - in case of success 35 */ 36 QDF_STATUS wlan_crypto_set_vdev_param(struct wlan_objmgr_vdev *vdev, 37 wlan_crypto_param_type param, 38 uint32_t value); 39 40 /** 41 * wlan_crypto_set_peer_param - called by ucfg to set crypto param 42 * 43 * @peer: peer 44 * @param: param to be set. 45 * @value: value 46 * 47 * This function gets called from ucfg to set param 48 * 49 * Return: QDF_STATUS_SUCCESS - in case of success 50 */ 51 QDF_STATUS wlan_crypto_set_peer_param(struct wlan_objmgr_peer *peer, 52 wlan_crypto_param_type param, 53 uint32_t value); 54 55 /** 56 * wlan_crypto_get_param - called by ucfg to get crypto param 57 * @vdev: vdev 58 * @param: param to be get. 59 * 60 * This function gets called from ucfg to get param 61 * 62 * Return: value or -1 for failure 63 */ 64 int32_t wlan_crypto_get_param(struct wlan_objmgr_vdev *vdev, 65 wlan_crypto_param_type param); 66 /** 67 * wlan_crypto_get_peer_param - called by ucfg to get crypto peer param 68 * @peer: peer 69 * @param: param to be get. 70 * 71 * This function gets called from ucfg to get peer param 72 * 73 * Return: value or -1 for failure 74 */ 75 int32_t wlan_crypto_get_peer_param(struct wlan_objmgr_peer *peer, 76 wlan_crypto_param_type param); 77 78 /** 79 * wlan_crypto_is_htallowed - called by ucfg to check if HT rates is allowed 80 * @vdev: Vdev 81 * @peer: Peer 82 * 83 * This function is called to check if HT rates is allowed 84 * 85 * Return: 0 for not allowed and +ve for allowed 86 */ 87 uint8_t wlan_crypto_is_htallowed(struct wlan_objmgr_vdev *vdev, 88 struct wlan_objmgr_peer *peer); 89 /** 90 * wlan_crypto_setkey - called by ucfg to setkey 91 * @vdev: vdev 92 * @req_key: req_key with cipher type, key macaddress 93 * 94 * This function gets called from ucfg to sey key 95 * 96 * Return: QDF_STATUS_SUCCESS - in case of success 97 */ 98 QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev, 99 struct wlan_crypto_req_key *req_key); 100 101 /** 102 * wlan_crypto_getkey - called by ucfg to get key 103 * @vdev: vdev 104 * @req_key: key value will be copied in this req_key 105 * @mac_address: mac address of the peer for unicast key 106 * or broadcast address if group key is requested. 107 * 108 * This function gets called from ucfg to get key 109 * 110 * Return: QDF_STATUS_SUCCESS - in case of success 111 */ 112 QDF_STATUS wlan_crypto_getkey(struct wlan_objmgr_vdev *vdev, 113 struct wlan_crypto_req_key *req_key, 114 uint8_t *mac_addr); 115 116 /** 117 * wlan_crypto_delkey - called by ucfg to delete key 118 * @vdev: vdev 119 * @mac_address: mac address of the peer for unicast key 120 * or broadcast address if group key is deleted. 121 * @key_idx: key index to be deleted 122 * 123 * This function gets called from ucfg to delete key 124 * 125 * Return: QDF_STATUS_SUCCESS - in case of success 126 */ 127 QDF_STATUS wlan_crypto_delkey(struct wlan_objmgr_vdev *vdev, 128 uint8_t *macaddr, 129 uint8_t key_idx); 130 131 /** 132 * wlan_crypto_default_key - called by ucfg to set default tx key 133 * @vdev: vdev 134 * @mac_address: mac address of the peer for unicast key 135 * or broadcast address if group key need to made default. 136 * @key_idx: key index to be made as default key 137 * @unicast: is key was unicast or group key. 138 * 139 * This function gets called from ucfg to set default key 140 * 141 * Return: QDF_STATUS_SUCCESS - in case of success 142 */ 143 QDF_STATUS wlan_crypto_default_key(struct wlan_objmgr_vdev *vdev, 144 uint8_t *macaddr, 145 uint8_t key_idx, 146 bool unicast); 147 148 /** 149 * wlan_crypto_encap - called by mgmt for encap the frame based on cipher 150 * @vdev: vdev 151 * @wbuf: wbuf 152 * @macaddr: macaddr 153 * @encapdone: is encapdone already or not. 154 * 155 * This function gets called from mgmt txrx to encap frame. 156 * 157 * Return: QDF_STATUS_SUCCESS - in case of success 158 */ 159 QDF_STATUS wlan_crypto_encap(struct wlan_objmgr_vdev *vdev, 160 qdf_nbuf_t wbuf, 161 uint8_t *macaddr, 162 uint8_t encapdone); 163 164 /** 165 * wlan_crypto_decap - called by mgmt for decap the frame based on cipher 166 * @vdev: vdev 167 * @wbuf: wbuf 168 * @macaddr: macaddr 169 * @tid: tid of the packet. 170 * 171 * This function gets called from mgmt txrx to decap frame. 172 * 173 * Return: QDF_STATUS_SUCCESS - in case of success 174 */ 175 QDF_STATUS wlan_crypto_decap(struct wlan_objmgr_vdev *vdev, 176 qdf_nbuf_t wbuf, 177 uint8_t *macaddr, 178 uint8_t tid); 179 180 /** 181 * wlan_crypto_enmic - called by mgmt for adding mic in frame based on cipher 182 * @vdev: vdev 183 * @wbuf: wbuf 184 * @macaddr: macaddr 185 * @encapdone: is encapdone already or not. 186 * 187 * This function gets called from mgmt txrx to adding mic to the frame. 188 * 189 * Return: QDF_STATUS_SUCCESS - in case of success 190 */ 191 QDF_STATUS wlan_crypto_enmic(struct wlan_objmgr_vdev *vdev, 192 qdf_nbuf_t wbuf, 193 uint8_t *macaddr, 194 uint8_t encapdone); 195 196 /** 197 * wlan_crypto_demic - called by mgmt for remove and check mic for 198 * the frame based on cipher 199 * @vdev: vdev 200 * @wbuf: wbuf 201 * @macaddr: macaddr 202 * @tid: tid of the frame 203 * @keyid: keyid in the received frame 204 * 205 * This function gets called from mgmt txrx to decap frame. 206 * 207 * Return: QDF_STATUS_SUCCESS - in case of success 208 */ 209 QDF_STATUS wlan_crypto_demic(struct wlan_objmgr_vdev *vdev, 210 qdf_nbuf_t wbuf, 211 uint8_t *macaddr, 212 uint8_t tid, 213 uint8_t keyid); 214 215 /** 216 * wlan_crypto_vdev_is_pmf_enabled - called to check is pmf enabled in vdev 217 * @vdev: vdev 218 * 219 * This function gets called to check is pmf enabled or not in vdev. 220 * 221 * Return: true or false 222 */ 223 bool wlan_crypto_vdev_is_pmf_enabled(struct wlan_objmgr_vdev *vdev); 224 225 /** 226 * wlan_crypto_vdev_is_pmf_required - called to check is pmf required in vdev 227 * @vdev: vdev 228 * 229 * This function gets called to check is pmf required or not in vdev. 230 * 231 * Return: true or false 232 */ 233 bool wlan_crypto_vdev_is_pmf_required(struct wlan_objmgr_vdev *vdev); 234 235 /** 236 * wlan_crypto_is_pmf_enabled - called by mgmt txrx to check is pmf enabled 237 * @vdev: vdev 238 * @peer: peer 239 * 240 * This function gets called by mgmt txrx to check is pmf enabled or not. 241 * 242 * Return: true or false 243 */ 244 bool wlan_crypto_is_pmf_enabled(struct wlan_objmgr_vdev *vdev, 245 struct wlan_objmgr_peer *peer); 246 247 /** 248 * wlan_crypto_add_mmie - called by mgmt txrx to add mmie in frame 249 * @vdev: vdev 250 * @frm: frame starting pointer 251 * @len: length of the frame 252 * 253 * This function gets called by mgmt txrx to add mmie in frame 254 * 255 * Return: end of frame or NULL in case failure 256 */ 257 uint8_t *wlan_crypto_add_mmie(struct wlan_objmgr_vdev *vdev, 258 uint8_t *frm, 259 uint32_t len); 260 261 /** 262 * wlan_crypto_is_mmie_valid - called by mgmt txrx to check mmie of the frame 263 * @vdev: vdev 264 * @frm: frame starting pointer 265 * @efrm: end of frame pointer 266 * 267 * This function gets called by mgmt txrx to check mmie of the frame 268 * 269 * Return: true or false 270 */ 271 bool wlan_crypto_is_mmie_valid(struct wlan_objmgr_vdev *vdev, 272 uint8_t *frm, 273 uint8_t *efrm); 274 275 /** 276 * wlan_crypto_wpaie_check - called by mlme to check the wpaie 277 * @crypto params: crypto params 278 * @iebuf: ie buffer 279 * 280 * This function gets called by mlme to check the contents of wpa is 281 * matching with given crypto params 282 * 283 * Return: QDF_STATUS_SUCCESS - in case of success 284 */ 285 QDF_STATUS wlan_crypto_wpaie_check(struct wlan_crypto_params *, uint8_t *frm); 286 287 /** 288 * wlan_crypto_rsnie_check - called by mlme to check the rsnie 289 * @crypto params: crypto params 290 * @iebuf: ie buffer 291 * 292 * This function gets called by mlme to check the contents of rsn is 293 * matching with given crypto params 294 * 295 * Return: QDF_STATUS_SUCCESS - in case of success 296 */ 297 QDF_STATUS wlan_crypto_rsnie_check(struct wlan_crypto_params *, uint8_t *frm); 298 /** 299 * wlan_crypto_build_wpaie - called by mlme to build wpaie 300 * @vdev: vdev 301 * @iebuf: ie buffer 302 * 303 * This function gets called by mlme to build wpaie from given vdev 304 * 305 * Return: end of buffer 306 */ 307 uint8_t *wlan_crypto_build_wpaie(struct wlan_objmgr_vdev *vdev, 308 uint8_t *iebuf); 309 /** 310 * wlan_crypto_build_rsnie - called by mlme to build rsnie 311 * @vdev: vdev 312 * @iebuf: ie buffer 313 * @bssid: bssid mac address to add pmkid in rsnie 314 * 315 * This function gets called by mlme to build rsnie from given vdev 316 * 317 * Return: end of buffer 318 */ 319 uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev, 320 uint8_t *iebuf, 321 struct qdf_mac_addr *bssid); 322 323 /** 324 * wlan_crypto_wapiie_check - called by mlme to check the wapiie 325 * @crypto params: crypto params 326 * @iebuf: ie buffer 327 * 328 * This function gets called by mlme to check the contents of wapi is 329 * matching with given crypto params 330 * 331 * Return: QDF_STATUS_SUCCESS - in case of success 332 */ 333 QDF_STATUS wlan_crypto_wapiie_check(struct wlan_crypto_params *crypto_params, 334 uint8_t *frm); 335 336 /** 337 * wlan_crypto_build_wapiie - called by mlme to build wapi ie 338 * @vdev: vdev 339 * @iebuf: ie buffer 340 * 341 * This function gets called by mlme to build wapi ie from given vdev 342 * 343 * Return: end of buffer 344 */ 345 uint8_t *wlan_crypto_build_wapiie(struct wlan_objmgr_vdev *vdev, 346 uint8_t *iebuf); 347 /** 348 * wlan_crypto_rsn_info - check is given params matching with vdev params. 349 * @vdev: vdev 350 * @crypto params: crypto params 351 * 352 * This function gets called by mlme to check is given params matching with 353 * vdev params. 354 * 355 * Return: true success or false for failure. 356 */ 357 bool wlan_crypto_rsn_info(struct wlan_objmgr_vdev *vdev, 358 struct wlan_crypto_params *crypto_params); 359 /** 360 * wlan_crypto_pn_check - called by data patch for PN check 361 * @vdev: vdev 362 * @wbuf: wbuf 363 * 364 * This function gets called by data patch for PN check 365 * 366 * Return: QDF_STATUS 367 */ 368 QDF_STATUS wlan_crypto_pn_check(struct wlan_objmgr_vdev *vdev, 369 qdf_nbuf_t wbuf); 370 /** 371 * wlan_crypto_vdev_get_crypto_params - called by mlme to get crypto params 372 * @vdev:vdev 373 * 374 * This function gets called by mlme to get crypto params 375 * 376 * Return: wlan_crypto_params or NULL in case of failure 377 */ 378 struct wlan_crypto_params *wlan_crypto_vdev_get_crypto_params( 379 struct wlan_objmgr_vdev *vdev); 380 /** 381 * wlan_crypto_peer_get_crypto_params - called by mlme to get crypto params 382 * @peer:peer 383 * 384 * This function gets called by mlme to get crypto params 385 * 386 * Return: wlan_crypto_params or NULL in case of failure 387 */ 388 struct wlan_crypto_params *wlan_crypto_peer_get_crypto_params( 389 struct wlan_objmgr_peer *peer); 390 391 /** 392 * wlan_crypto_set_peer_wep_keys - set wep keys into peer entries 393 * @vdev:vdev 394 * @peer:peer 395 * 396 * This function gets called by mlme, when auth frame is received. 397 * this helps in setting wep keys into peer data structure. 398 * 399 * Return: QDF_STATUS 400 */ 401 QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev, 402 struct wlan_objmgr_peer *peer); 403 404 /** 405 * wlan_crypto_register_crypto_rx_ops - set crypto_rx_ops 406 * @crypto_rx_ops: crypto_rx_ops 407 * 408 * This function gets called by object manger to register crypto rx ops. 409 * 410 * Return: QDF_STATUS 411 */ 412 QDF_STATUS wlan_crypto_register_crypto_rx_ops( 413 struct wlan_lmac_if_crypto_rx_ops *crypto_rx_ops); 414 415 /** 416 * wlan_crypto_get_crypto_rx_ops - get crypto_rx_ops from psoc 417 * @psoc: psoc 418 * 419 * This function gets called by umac to get the crypto_rx_ops 420 * 421 * Return: crypto_rx_ops 422 */ 423 struct wlan_lmac_if_crypto_rx_ops *wlan_crypto_get_crypto_rx_ops( 424 struct wlan_objmgr_psoc *psoc); 425 /** 426 * wlan_crypto_vdev_has_auth_mode - check authmode for vdev 427 * @vdev: vdev 428 * @authvalue: authvalue to be checked 429 * 430 * This function check is authvalue passed is set in vdev or not 431 * 432 * Return: true or false 433 */ 434 bool wlan_crypto_vdev_has_auth_mode(struct wlan_objmgr_vdev *vdev, 435 wlan_crypto_auth_mode authmode); 436 437 /** 438 * wlan_crypto_peer_has_auth_mode - check authmode for peer 439 * @peer: peer 440 * @authvalue: authvalue to be checked 441 * 442 * This function check is authvalue passed is set in peer or not 443 * 444 * Return: true or false 445 */ 446 bool wlan_crypto_peer_has_auth_mode(struct wlan_objmgr_peer *peer, 447 wlan_crypto_auth_mode authvalue); 448 449 /** 450 * wlan_crypto_vdev_has_ucastcipher - check ucastcipher for vdev 451 * @vdev: vdev 452 * @ucastcipher: ucastcipher to be checked 453 * 454 * This function check is ucastcipher passed is set in vdev or not 455 * 456 * Return: true or false 457 */ 458 bool wlan_crypto_vdev_has_ucastcipher(struct wlan_objmgr_vdev *vdev, 459 wlan_crypto_cipher_type ucastcipher); 460 461 /** 462 * wlan_crypto_peer_has_ucastcipher - check ucastcipher for peer 463 * @peer: peer 464 * @ucastcipher: ucastcipher to be checked 465 * 466 * This function check is ucastcipher passed is set in peer or not 467 * 468 * Return: true or false 469 */ 470 bool wlan_crypto_peer_has_ucastcipher(struct wlan_objmgr_peer *peer, 471 wlan_crypto_cipher_type ucastcipher); 472 473 474 /** 475 * wlan_crypto_vdev_has_mcastcipher - check mcastcipher for vdev 476 * @vdev: vdev 477 * @mcastcipher: mcastcipher to be checked 478 * 479 * This function check is mcastcipher passed is set in vdev or not 480 * 481 * Return: true or false 482 */ 483 bool wlan_crypto_vdev_has_mcastcipher(struct wlan_objmgr_vdev *vdev, 484 wlan_crypto_cipher_type mcastcipher); 485 486 /** 487 * wlan_crypto_peer_has_mcastcipher - check mcastcipher for peer 488 * @peer: peer 489 * @mcastcipher: mcastcipher to be checked 490 * 491 * This function check is mcastcipher passed is set in peer or not 492 * 493 * Return: true or false 494 */ 495 bool wlan_crypto_peer_has_mcastcipher(struct wlan_objmgr_peer *peer, 496 wlan_crypto_cipher_type mcastcipher); 497 498 /** 499 * wlan_crypto_vdev_has_mgmtcipher - check mgmtcipher for vdev 500 * @vdev: vdev 501 * @mgmtcipher: mgmtcipher to be checked 502 * 503 * This function checks any one of mgmtciphers are supported by vdev or not. 504 * 505 * Return: true or false 506 */ 507 bool wlan_crypto_vdev_has_mgmtcipher(struct wlan_objmgr_vdev *vdev, 508 uint32_t mgmtcipher); 509 510 /** 511 * wlan_crypto_peer_has_mgmtcipher - check mgmtcipher for peer 512 * @peer: peer 513 * @mgmtcipher: mgmtcipher to be checked 514 * 515 * This function checks any one of mgmtciphers are supported by peer or not. 516 * 517 * Return: true or false 518 */ 519 bool wlan_crypto_peer_has_mgmtcipher(struct wlan_objmgr_peer *peer, 520 uint32_t mgmtcipher); 521 522 /** 523 * wlan_crypto_get_keytype - get keytype 524 * @key: key 525 * 526 * This function gets keytype from key 527 * 528 * Return: keytype 529 */ 530 wlan_crypto_cipher_type wlan_crypto_get_key_type( 531 struct wlan_crypto_key *key); 532 533 /** 534 * wlan_crypto_vdev_getkey - get key from vdev 535 * @vdev: vdev 536 * @keyix: keyix 537 * 538 * This function gets key from vdev 539 * 540 * Return: key or NULL 541 */ 542 struct wlan_crypto_key *wlan_crypto_vdev_getkey(struct wlan_objmgr_vdev *vdev, 543 uint16_t keyix); 544 /** 545 * wlan_crypto_peer_getkey - get key from peer 546 * @peer: peer 547 * @keyix: keyix 548 * 549 * This function gets key from peer 550 * 551 * Return: key or NULL 552 */ 553 struct wlan_crypto_key *wlan_crypto_peer_getkey(struct wlan_objmgr_peer *peer, 554 uint16_t keyix); 555 /** 556 * wlan_crypto_get_peer_fils_aead - Get peer fils aead set flag 557 * @peer: Peer object 558 * 559 * This function returns the peer fils aead set flag value. 560 * 561 * Return: 1 for enabled, 0 for disabled 562 */ 563 uint8_t wlan_crypto_get_peer_fils_aead(struct wlan_objmgr_peer *peer); 564 565 /** 566 * wlan_crypto_set_peer_fils_aead - Set peer fils aead set flag 567 * @peer: Peer object 568 * @value: Value to set the flag 569 * 570 * This function set the peer fils aead set flag once FILS AUTH received. 571 * 572 * Return: None 573 */ 574 void wlan_crypto_set_peer_fils_aead( 575 struct wlan_objmgr_peer *peer, uint8_t value); 576 577 /** 578 * wlan_crypto_get_key_header - get header length 579 * @key: key 580 * 581 * This function gets header length based on keytype 582 * 583 * Return: header length 584 */ 585 uint8_t wlan_crypto_get_key_header(struct wlan_crypto_key *key); 586 587 /** 588 * wlan_crypto_get_key_trailer - get cipher trailer length 589 * @key: key 590 * 591 * This function gets cipher trailer length based on keytype 592 * 593 * Return: cipher trailer length 594 */ 595 uint8_t wlan_crypto_get_key_trailer(struct wlan_crypto_key *key); 596 597 /** 598 * wlan_crypto_get_key_miclen - get cipher miclen length 599 * @key: key 600 * 601 * This function gets cipher miclen length based on keytype 602 * 603 * Return: cipher miclen length 604 */ 605 uint8_t wlan_crypto_get_key_miclen(struct wlan_crypto_key *key); 606 607 /** 608 * wlan_crypto_get_keyid - get keyid from frame 609 * @data: frame 610 * @hdrlen: 802.11 header length 611 * 612 * This function parse frame and returns keyid 613 * 614 * Return: keyid 615 */ 616 uint16_t wlan_crypto_get_keyid(uint8_t *data, int hdrlen); 617 618 /** 619 * wlan_crypto_restore_keys - restore crypto keys in hw keycache 620 * @vdev: vdev 621 * 622 * This function restores keys in hw keycache 623 * 624 * Return: void 625 */ 626 void wlan_crypto_restore_keys(struct wlan_objmgr_vdev *vdev); 627 628 /** 629 * wlan_crypto_check_open_none - called by ucfg to check for open security 630 * @psoc: psoc pointer 631 * @vdev_id: vdev id 632 * 633 * This function gets called from ucfg to check open security. 634 * 635 * Return: true or false 636 */ 637 bool wlan_crypto_check_open_none(struct wlan_objmgr_psoc *psoc, 638 uint8_t vedv_id); 639 640 /** 641 * wlan_crypto_check_wep - called by ucfg to check for WEP security 642 * @psoc: psoc pointer 643 * @vdev_id: vdev id 644 * 645 * This function gets called from ucfg to check WEP security. 646 * 647 * Return: true or false 648 */ 649 bool wlan_crypto_check_wep(struct wlan_objmgr_psoc *psoc, uint8_t vedv_id); 650 651 /** 652 * wlan_crypto_check_rsn_match - called by ucfg to check for RSN match 653 * @psoc: psoc pointer 654 * @vdev_id: vdev id 655 * @ie_ptr: pointer to IEs 656 * @ie_len: IE length 657 * 658 * This function gets called from ucfg to check RSN match. 659 * 660 * Return: true or false 661 */ 662 bool wlan_crypto_check_rsn_match(struct wlan_objmgr_psoc *psoc, 663 uint8_t vedv_id, uint8_t *ie_ptr, 664 uint16_t ie_len); 665 666 /** 667 * wlan_crypto_check_rsn_match - called by ucfg to check for WPA match 668 * @psoc: psoc pointer 669 * @vdev_id: vdev id 670 * @ie_ptr: pointer to IEs 671 * @ie_len: IE length 672 * 673 * This function gets called from ucfg to check WPA match. 674 * 675 * Return: true or false 676 */ 677 bool wlan_crypto_check_wpa_match(struct wlan_objmgr_psoc *psoc, 678 uint8_t vedv_id, uint8_t *ie_ptr, 679 uint16_t ie_len); 680 681 /** 682 * wlan_set_vdev_crypto_prarams_from_ie - Sets vdev crypto params from IE info 683 * @vdev: vdev pointer 684 * @ie_ptr: pointer to IE 685 * @ie_len: IE length 686 * 687 * This function gets called from ucfg to set crypto params from IE data. 688 * 689 * Return: QDF_STATUS_SUCCESS or error code 690 */ 691 QDF_STATUS wlan_set_vdev_crypto_prarams_from_ie(struct wlan_objmgr_vdev *vdev, 692 uint8_t *ie_ptr, 693 uint16_t ie_len); 694 #ifdef WLAN_CRYPTO_GCM_OS_DERIVATIVE 695 static inline int wlan_crypto_aes_gmac(const uint8_t *key, size_t key_len, 696 const uint8_t *iv, size_t iv_len, 697 const uint8_t *aad, size_t aad_len, 698 uint8_t *tag) 699 { 700 return 0; 701 } 702 #endif 703 #ifdef WLAN_CRYPTO_OMAC1_OS_DERIVATIVE 704 static inline int omac1_aes_128(const uint8_t *key, const uint8_t *data, 705 size_t data_len, uint8_t *mac) 706 { 707 return 0; 708 } 709 710 static inline int omac1_aes_256(const uint8_t *key, const uint8_t *data, 711 size_t data_len, uint8_t *mac) 712 { 713 return 0; 714 } 715 #endif 716 717 /** 718 * ucfg_crypto_set_key_req() - Set key request to UCFG 719 * @vdev: vdev object 720 * @req: key request information 721 * @key_type: indicates the type of key to be set, unicast or group key 722 * 723 * Return: None 724 */ 725 QDF_STATUS ucfg_crypto_set_key_req(struct wlan_objmgr_vdev *vdev, 726 struct wlan_crypto_key *req, 727 enum wlan_crypto_key_type key_type); 728 729 /** 730 * wlan_crypto_get_default_key_idx() - Get the default key index 731 * @vdev: vdev object 732 * @igtk: denotes if the request is for igtk key type or not 733 * 734 * Return: Index of the requested key 735 */ 736 int8_t wlan_crypto_get_default_key_idx(struct wlan_objmgr_vdev *vdev, 737 bool igtk); 738 739 /** 740 * wlan_crypto_get_cipher() - Get the cipher type for the vdev 741 * @vdev: vdev object 742 * @pairwise: denotes if the request is for pairwise cipher or not 743 * @key_index: Index of the key whose cipher type has to be returned 744 * 745 * Return: enum wlan_crypto_cipher_type 746 */ 747 enum wlan_crypto_cipher_type 748 wlan_crypto_get_cipher(struct wlan_objmgr_vdev *vdev, 749 bool pairwise, uint8_t key_index); 750 751 #ifdef CRYPTO_SET_KEY_CONVERGED 752 /** 753 * wlan_crypto_update_set_key_peer() - Update the peer for set key 754 * @vdev: vdev object 755 * @pairwise: denotes if the request is for pairwise cipher or not 756 * @key_index: Index of the key whose peer has to be set 757 * @peer_mac: MAC address of the peer 758 * 759 * Return: None 760 */ 761 void wlan_crypto_update_set_key_peer(struct wlan_objmgr_vdev *vdev, 762 bool pairwise, uint8_t key_index, 763 struct qdf_mac_addr *peer_mac); 764 765 /** 766 * wlan_crypto_validate_key_params() - validates key parameters 767 * @cipher: cipher type 768 * @key_index: the index of the key 769 * @key_len: key length 770 * @seq_len: sequence counter length 771 * 772 * Return: QDF_STATUS 773 */ 774 QDF_STATUS wlan_crypto_validate_key_params(enum wlan_crypto_cipher_type cipher, 775 uint8_t key_index, uint8_t key_len, 776 uint8_t seq_len); 777 778 /** 779 * wlan_crypto_save_key() - Allocate memory for storing key 780 * @vdev: vdev object 781 * @key_index: the index of the key that needs to be allocated 782 * @crypto_key: Pointer to crypto key 783 * 784 * Return: QDF_STATUS 785 */ 786 QDF_STATUS wlan_crypto_save_key(struct wlan_objmgr_vdev *vdev, 787 uint8_t key_index, 788 struct wlan_crypto_key *crypto_key); 789 790 /** 791 * wlan_crypto_get_key() - Get the stored key information 792 * @vdev: vdev object 793 * @key_index: the index of the key that needs to be retrieved 794 * 795 * Return: Key material 796 */ 797 struct wlan_crypto_key *wlan_crypto_get_key(struct wlan_objmgr_vdev *vdev, 798 uint8_t key_index); 799 800 /** 801 * wlan_crypto_set_key_req() - Set key request 802 * @vdev: vdev object 803 * @req: key request information 804 * @key_type: indicates the type of key to be set, unicast or group key 805 * 806 * Return: QDF status 807 */ 808 QDF_STATUS wlan_crypto_set_key_req(struct wlan_objmgr_vdev *vdev, 809 struct wlan_crypto_key *req, 810 enum wlan_crypto_key_type key_type); 811 #else 812 static inline void wlan_crypto_update_set_key_peer( 813 struct wlan_objmgr_vdev *vdev, 814 bool pairwise, 815 uint8_t key_index, 816 struct qdf_mac_addr *peer_mac) 817 { 818 } 819 820 static inline QDF_STATUS 821 wlan_crypto_save_key(struct wlan_objmgr_vdev *vdev, uint8_t key_index, 822 struct wlan_crypto_key *crypto_key) 823 { 824 return QDF_STATUS_SUCCESS; 825 } 826 827 static inline struct wlan_crypto_key * 828 wlan_crypto_get_key(struct wlan_objmgr_vdev *vdev, uint8_t key_index) 829 { 830 return NULL; 831 } 832 833 static inline 834 QDF_STATUS wlan_crypto_set_key_req(struct wlan_objmgr_vdev *vdev, 835 struct wlan_crypto_key *req, 836 enum wlan_crypto_key_type key_type) 837 { 838 return QDF_STATUS_SUCCESS; 839 } 840 #endif /* CRYPTO_SET_KEY_CONVERGED */ 841 /** 842 * wlan_crypto_get_pmksa - called to get pmksa of bssid passed. 843 * @vdev: vdev 844 * @bssid: bssid 845 * 846 * This function gets called from to get pmksa for the bssid. 847 * 848 * Return: wlan_crypto_pmksa when match found else NULL. 849 */ 850 struct wlan_crypto_pmksa * 851 wlan_crypto_get_pmksa(struct wlan_objmgr_vdev *vdev, 852 struct qdf_mac_addr *bssid); 853 854 /** 855 * wlan_crypto_pmksa_flush - called to flush saved pmksa 856 * @crypto_params: crypto_params 857 * 858 * This function flush saved pmksa from crypto params. 859 * 860 * Return: QDF_STATUS_SUCCESS - in case of success 861 */ 862 QDF_STATUS wlan_crypto_pmksa_flush(struct wlan_crypto_params *crypto_params); 863 864 /** 865 * wlan_crypto_set_vdev_param - called by ucfg to set crypto param 866 * @vdev: vdev 867 * @pmksa: pmksa to be set/del. 868 * @set: set(set=1) or del(set=0) pmksa from the list. 869 * 870 * This function gets called from ucfg to set or del pmksa. 871 * when given pmksa is NULL and set is 0, it is for flush all entries. 872 * 873 * Return: QDF_STATUS_SUCCESS - in case of success 874 */ 875 QDF_STATUS wlan_crypto_set_del_pmksa(struct wlan_objmgr_vdev *vdev, 876 struct wlan_crypto_pmksa *pmksa, 877 bool set); 878 879 #endif /* end of _WLAN_CRYPTO_GLOBAL_API_H_ */ 880