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_is_key_valid - called by mgmt txrx to check if key is valid 249 * @vdev: vdev 250 * @peer: peer 251 * @keyidx : key index 252 * 253 * This function gets called by mgmt txrx to check if key is valid 254 * 255 * Return: true or false 256 */ 257 bool wlan_crypto_is_key_valid(struct wlan_objmgr_vdev *vdev, 258 struct wlan_objmgr_peer *peer, 259 uint16_t keyidx); 260 261 /** 262 * wlan_crypto_add_mmie - called by mgmt txrx to add mmie in frame 263 * @vdev: vdev 264 * @frm: frame starting pointer 265 * @len: length of the frame 266 * 267 * This function gets called by mgmt txrx to add mmie in frame 268 * 269 * Return: end of frame or NULL in case failure 270 */ 271 uint8_t *wlan_crypto_add_mmie(struct wlan_objmgr_vdev *vdev, 272 uint8_t *frm, 273 uint32_t len); 274 275 /** 276 * wlan_crypto_is_mmie_valid - called by mgmt txrx to check mmie of the frame 277 * @vdev: vdev 278 * @frm: frame starting pointer 279 * @efrm: end of frame pointer 280 * 281 * This function gets called by mgmt txrx to check mmie of the frame 282 * 283 * Return: true or false 284 */ 285 bool wlan_crypto_is_mmie_valid(struct wlan_objmgr_vdev *vdev, 286 uint8_t *frm, 287 uint8_t *efrm); 288 289 /** 290 * wlan_crypto_wpaie_check - called by mlme to check the wpaie 291 * @crypto params: crypto params 292 * @iebuf: ie buffer 293 * 294 * This function gets called by mlme to check the contents of wpa is 295 * matching with given crypto params 296 * 297 * Return: QDF_STATUS_SUCCESS - in case of success 298 */ 299 QDF_STATUS wlan_crypto_wpaie_check(struct wlan_crypto_params *, uint8_t *frm); 300 301 /** 302 * wlan_crypto_rsnie_check - called by mlme to check the rsnie 303 * @crypto params: crypto params 304 * @iebuf: ie buffer 305 * 306 * This function gets called by mlme to check the contents of rsn is 307 * matching with given crypto params 308 * 309 * Return: QDF_STATUS_SUCCESS - in case of success 310 */ 311 QDF_STATUS wlan_crypto_rsnie_check(struct wlan_crypto_params *, uint8_t *frm); 312 /** 313 * wlan_crypto_build_wpaie - called by mlme to build wpaie 314 * @vdev: vdev 315 * @iebuf: ie buffer 316 * 317 * This function gets called by mlme to build wpaie from given vdev 318 * 319 * Return: end of buffer 320 */ 321 uint8_t *wlan_crypto_build_wpaie(struct wlan_objmgr_vdev *vdev, 322 uint8_t *iebuf); 323 /** 324 * wlan_crypto_build_rsnie - called by mlme to build rsnie 325 * @vdev: vdev 326 * @iebuf: ie buffer 327 * @bssid: bssid mac address to add pmkid in rsnie 328 * 329 * This function gets called by mlme to build rsnie from given vdev 330 * 331 * Return: end of buffer 332 */ 333 uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev, 334 uint8_t *iebuf, 335 struct qdf_mac_addr *bssid); 336 337 /** 338 * wlan_crypto_wapiie_check - called by mlme to check the wapiie 339 * @crypto params: crypto params 340 * @iebuf: ie buffer 341 * 342 * This function gets called by mlme to check the contents of wapi is 343 * matching with given crypto params 344 * 345 * Return: QDF_STATUS_SUCCESS - in case of success 346 */ 347 QDF_STATUS wlan_crypto_wapiie_check(struct wlan_crypto_params *crypto_params, 348 uint8_t *frm); 349 350 /** 351 * wlan_crypto_build_wapiie - called by mlme to build wapi ie 352 * @vdev: vdev 353 * @iebuf: ie buffer 354 * 355 * This function gets called by mlme to build wapi ie from given vdev 356 * 357 * Return: end of buffer 358 */ 359 uint8_t *wlan_crypto_build_wapiie(struct wlan_objmgr_vdev *vdev, 360 uint8_t *iebuf); 361 /** 362 * wlan_crypto_rsn_info - check is given params matching with vdev params. 363 * @vdev: vdev 364 * @crypto params: crypto params 365 * 366 * This function gets called by mlme to check is given params matching with 367 * vdev params. 368 * 369 * Return: true success or false for failure. 370 */ 371 bool wlan_crypto_rsn_info(struct wlan_objmgr_vdev *vdev, 372 struct wlan_crypto_params *crypto_params); 373 /** 374 * wlan_crypto_pn_check - called by data patch for PN check 375 * @vdev: vdev 376 * @wbuf: wbuf 377 * 378 * This function gets called by data patch for PN check 379 * 380 * Return: QDF_STATUS 381 */ 382 QDF_STATUS wlan_crypto_pn_check(struct wlan_objmgr_vdev *vdev, 383 qdf_nbuf_t wbuf); 384 /** 385 * wlan_crypto_vdev_get_crypto_params - called by mlme to get crypto params 386 * @vdev:vdev 387 * 388 * This function gets called by mlme to get crypto params 389 * 390 * Return: wlan_crypto_params or NULL in case of failure 391 */ 392 struct wlan_crypto_params *wlan_crypto_vdev_get_crypto_params( 393 struct wlan_objmgr_vdev *vdev); 394 /** 395 * wlan_crypto_peer_get_crypto_params - called by mlme to get crypto params 396 * @peer:peer 397 * 398 * This function gets called by mlme to get crypto params 399 * 400 * Return: wlan_crypto_params or NULL in case of failure 401 */ 402 struct wlan_crypto_params *wlan_crypto_peer_get_crypto_params( 403 struct wlan_objmgr_peer *peer); 404 405 /** 406 * wlan_crypto_set_peer_wep_keys - set wep keys into peer entries 407 * @vdev:vdev 408 * @peer:peer 409 * 410 * This function gets called by mlme, when auth frame is received. 411 * this helps in setting wep keys into peer data structure. 412 * 413 * Return: QDF_STATUS 414 */ 415 QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev, 416 struct wlan_objmgr_peer *peer); 417 418 /** 419 * wlan_crypto_register_crypto_rx_ops - set crypto_rx_ops 420 * @crypto_rx_ops: crypto_rx_ops 421 * 422 * This function gets called by object manger to register crypto rx ops. 423 * 424 * Return: QDF_STATUS 425 */ 426 QDF_STATUS wlan_crypto_register_crypto_rx_ops( 427 struct wlan_lmac_if_crypto_rx_ops *crypto_rx_ops); 428 429 /** 430 * wlan_crypto_get_crypto_rx_ops - get crypto_rx_ops from psoc 431 * @psoc: psoc 432 * 433 * This function gets called by umac to get the crypto_rx_ops 434 * 435 * Return: crypto_rx_ops 436 */ 437 struct wlan_lmac_if_crypto_rx_ops *wlan_crypto_get_crypto_rx_ops( 438 struct wlan_objmgr_psoc *psoc); 439 /** 440 * wlan_crypto_vdev_has_auth_mode - check authmode for vdev 441 * @vdev: vdev 442 * @authvalue: authvalue to be checked 443 * 444 * This function check is authvalue passed is set in vdev or not 445 * 446 * Return: true or false 447 */ 448 bool wlan_crypto_vdev_has_auth_mode(struct wlan_objmgr_vdev *vdev, 449 wlan_crypto_auth_mode authmode); 450 451 /** 452 * wlan_crypto_peer_has_auth_mode - check authmode for peer 453 * @peer: peer 454 * @authvalue: authvalue to be checked 455 * 456 * This function check is authvalue passed is set in peer or not 457 * 458 * Return: true or false 459 */ 460 bool wlan_crypto_peer_has_auth_mode(struct wlan_objmgr_peer *peer, 461 wlan_crypto_auth_mode authvalue); 462 463 /** 464 * wlan_crypto_vdev_has_ucastcipher - check ucastcipher for vdev 465 * @vdev: vdev 466 * @ucastcipher: ucastcipher to be checked 467 * 468 * This function check is ucastcipher passed is set in vdev or not 469 * 470 * Return: true or false 471 */ 472 bool wlan_crypto_vdev_has_ucastcipher(struct wlan_objmgr_vdev *vdev, 473 wlan_crypto_cipher_type ucastcipher); 474 475 /** 476 * wlan_crypto_peer_has_ucastcipher - check ucastcipher for peer 477 * @peer: peer 478 * @ucastcipher: ucastcipher to be checked 479 * 480 * This function check is ucastcipher passed is set in peer or not 481 * 482 * Return: true or false 483 */ 484 bool wlan_crypto_peer_has_ucastcipher(struct wlan_objmgr_peer *peer, 485 wlan_crypto_cipher_type ucastcipher); 486 487 488 /** 489 * wlan_crypto_vdev_has_mcastcipher - check mcastcipher for vdev 490 * @vdev: vdev 491 * @mcastcipher: mcastcipher to be checked 492 * 493 * This function check is mcastcipher passed is set in vdev or not 494 * 495 * Return: true or false 496 */ 497 bool wlan_crypto_vdev_has_mcastcipher(struct wlan_objmgr_vdev *vdev, 498 wlan_crypto_cipher_type mcastcipher); 499 500 /** 501 * wlan_crypto_peer_has_mcastcipher - check mcastcipher for peer 502 * @peer: peer 503 * @mcastcipher: mcastcipher to be checked 504 * 505 * This function check is mcastcipher passed is set in peer or not 506 * 507 * Return: true or false 508 */ 509 bool wlan_crypto_peer_has_mcastcipher(struct wlan_objmgr_peer *peer, 510 wlan_crypto_cipher_type mcastcipher); 511 512 /** 513 * wlan_crypto_vdev_has_mgmtcipher - check mgmtcipher for vdev 514 * @vdev: vdev 515 * @mgmtcipher: mgmtcipher to be checked 516 * 517 * This function checks any one of mgmtciphers are supported by vdev or not. 518 * 519 * Return: true or false 520 */ 521 bool wlan_crypto_vdev_has_mgmtcipher(struct wlan_objmgr_vdev *vdev, 522 uint32_t mgmtcipher); 523 524 /** 525 * wlan_crypto_peer_has_mgmtcipher - check mgmtcipher for peer 526 * @peer: peer 527 * @mgmtcipher: mgmtcipher to be checked 528 * 529 * This function checks any one of mgmtciphers are supported by peer or not. 530 * 531 * Return: true or false 532 */ 533 bool wlan_crypto_peer_has_mgmtcipher(struct wlan_objmgr_peer *peer, 534 uint32_t mgmtcipher); 535 536 /** 537 * wlan_crypto_get_keytype - get keytype 538 * @key: key 539 * 540 * This function gets keytype from key 541 * 542 * Return: keytype 543 */ 544 wlan_crypto_cipher_type wlan_crypto_get_key_type( 545 struct wlan_crypto_key *key); 546 547 /** 548 * wlan_crypto_vdev_getkey - get key from vdev 549 * @vdev: vdev 550 * @keyix: keyix 551 * 552 * This function gets key from vdev 553 * 554 * Return: key or NULL 555 */ 556 struct wlan_crypto_key *wlan_crypto_vdev_getkey(struct wlan_objmgr_vdev *vdev, 557 uint16_t keyix); 558 /** 559 * wlan_crypto_peer_getkey - get key from peer 560 * @peer: peer 561 * @keyix: keyix 562 * 563 * This function gets key from peer 564 * 565 * Return: key or NULL 566 */ 567 struct wlan_crypto_key *wlan_crypto_peer_getkey(struct wlan_objmgr_peer *peer, 568 uint16_t keyix); 569 /** 570 * wlan_crypto_get_peer_fils_aead - Get peer fils aead set flag 571 * @peer: Peer object 572 * 573 * This function returns the peer fils aead set flag value. 574 * 575 * Return: 1 for enabled, 0 for disabled 576 */ 577 uint8_t wlan_crypto_get_peer_fils_aead(struct wlan_objmgr_peer *peer); 578 579 /** 580 * wlan_crypto_set_peer_fils_aead - Set peer fils aead set flag 581 * @peer: Peer object 582 * @value: Value to set the flag 583 * 584 * This function set the peer fils aead set flag once FILS AUTH received. 585 * 586 * Return: None 587 */ 588 void wlan_crypto_set_peer_fils_aead( 589 struct wlan_objmgr_peer *peer, uint8_t value); 590 591 /** 592 * wlan_crypto_get_key_header - get header length 593 * @key: key 594 * 595 * This function gets header length based on keytype 596 * 597 * Return: header length 598 */ 599 uint8_t wlan_crypto_get_key_header(struct wlan_crypto_key *key); 600 601 /** 602 * wlan_crypto_get_key_trailer - get cipher trailer length 603 * @key: key 604 * 605 * This function gets cipher trailer length based on keytype 606 * 607 * Return: cipher trailer length 608 */ 609 uint8_t wlan_crypto_get_key_trailer(struct wlan_crypto_key *key); 610 611 /** 612 * wlan_crypto_get_key_miclen - get cipher miclen length 613 * @key: key 614 * 615 * This function gets cipher miclen length based on keytype 616 * 617 * Return: cipher miclen length 618 */ 619 uint8_t wlan_crypto_get_key_miclen(struct wlan_crypto_key *key); 620 621 /** 622 * wlan_crypto_get_keyid - get keyid from frame 623 * @data: frame 624 * @hdrlen: 802.11 header length 625 * 626 * This function parse frame and returns keyid 627 * 628 * Return: keyid 629 */ 630 uint16_t wlan_crypto_get_keyid(uint8_t *data, int hdrlen); 631 632 /** 633 * wlan_crypto_restore_keys - restore crypto keys in hw keycache 634 * @vdev: vdev 635 * 636 * This function restores keys in hw keycache 637 * 638 * Return: void 639 */ 640 void wlan_crypto_restore_keys(struct wlan_objmgr_vdev *vdev); 641 642 /** 643 * wlan_crypto_check_open_none - called by ucfg to check for open security 644 * @psoc: psoc pointer 645 * @vdev_id: vdev id 646 * 647 * This function gets called from ucfg to check open security. 648 * 649 * Return: true or false 650 */ 651 bool wlan_crypto_check_open_none(struct wlan_objmgr_psoc *psoc, 652 uint8_t vedv_id); 653 654 /** 655 * wlan_crypto_check_wep - called by ucfg to check for WEP security 656 * @psoc: psoc pointer 657 * @vdev_id: vdev id 658 * 659 * This function gets called from ucfg to check WEP security. 660 * 661 * Return: true or false 662 */ 663 bool wlan_crypto_check_wep(struct wlan_objmgr_psoc *psoc, uint8_t vedv_id); 664 665 /** 666 * wlan_crypto_check_rsn_match - called by ucfg to check for RSN match 667 * @psoc: psoc pointer 668 * @vdev_id: vdev id 669 * @ie_ptr: pointer to IEs 670 * @ie_len: IE length 671 * 672 * This function gets called from ucfg to check RSN match. 673 * 674 * Return: true or false 675 */ 676 bool wlan_crypto_check_rsn_match(struct wlan_objmgr_psoc *psoc, 677 uint8_t vedv_id, uint8_t *ie_ptr, 678 uint16_t ie_len); 679 680 /** 681 * wlan_crypto_check_rsn_match - called by ucfg to check for WPA match 682 * @psoc: psoc pointer 683 * @vdev_id: vdev id 684 * @ie_ptr: pointer to IEs 685 * @ie_len: IE length 686 * 687 * This function gets called from ucfg to check WPA match. 688 * 689 * Return: true or false 690 */ 691 bool wlan_crypto_check_wpa_match(struct wlan_objmgr_psoc *psoc, 692 uint8_t vedv_id, uint8_t *ie_ptr, 693 uint16_t ie_len); 694 695 /** 696 * wlan_set_vdev_crypto_prarams_from_ie - Sets vdev crypto params from IE info 697 * @vdev: vdev pointer 698 * @ie_ptr: pointer to IE 699 * @ie_len: IE length 700 * 701 * This function gets called from ucfg to set crypto params from IE data. 702 * 703 * Return: QDF_STATUS_SUCCESS or error code 704 */ 705 QDF_STATUS wlan_set_vdev_crypto_prarams_from_ie(struct wlan_objmgr_vdev *vdev, 706 uint8_t *ie_ptr, 707 uint16_t ie_len); 708 #ifdef WLAN_CRYPTO_GCM_OS_DERIVATIVE 709 static inline int wlan_crypto_aes_gmac(const uint8_t *key, size_t key_len, 710 const uint8_t *iv, size_t iv_len, 711 const uint8_t *aad, size_t aad_len, 712 uint8_t *tag) 713 { 714 return 0; 715 } 716 #endif 717 #ifdef WLAN_CRYPTO_OMAC1_OS_DERIVATIVE 718 static inline int omac1_aes_128(const uint8_t *key, const uint8_t *data, 719 size_t data_len, uint8_t *mac) 720 { 721 return 0; 722 } 723 724 static inline int omac1_aes_256(const uint8_t *key, const uint8_t *data, 725 size_t data_len, uint8_t *mac) 726 { 727 return 0; 728 } 729 #endif 730 731 /** 732 * ucfg_crypto_set_key_req() - Set key request to UCFG 733 * @vdev: vdev object 734 * @req: key request information 735 * @key_type: indicates the type of key to be set, unicast or group key 736 * 737 * Return: None 738 */ 739 QDF_STATUS ucfg_crypto_set_key_req(struct wlan_objmgr_vdev *vdev, 740 struct wlan_crypto_key *req, 741 enum wlan_crypto_key_type key_type); 742 743 /** 744 * wlan_crypto_get_default_key_idx() - Get the default key index 745 * @vdev: vdev object 746 * @igtk: denotes if the request is for igtk key type or not 747 * 748 * Return: Index of the requested key 749 */ 750 int8_t wlan_crypto_get_default_key_idx(struct wlan_objmgr_vdev *vdev, 751 bool igtk); 752 753 /** 754 * wlan_crypto_get_cipher() - Get the cipher type for the vdev 755 * @vdev: vdev object 756 * @pairwise: denotes if the request is for pairwise cipher or not 757 * @key_index: Index of the key whose cipher type has to be returned 758 * 759 * Return: enum wlan_crypto_cipher_type 760 */ 761 enum wlan_crypto_cipher_type 762 wlan_crypto_get_cipher(struct wlan_objmgr_vdev *vdev, 763 bool pairwise, uint8_t key_index); 764 765 #ifdef CRYPTO_SET_KEY_CONVERGED 766 /** 767 * wlan_crypto_update_set_key_peer() - Update the peer for set key 768 * @vdev: vdev object 769 * @pairwise: denotes if the request is for pairwise cipher or not 770 * @key_index: Index of the key whose peer has to be set 771 * @peer_mac: MAC address of the peer 772 * 773 * Return: None 774 */ 775 void wlan_crypto_update_set_key_peer(struct wlan_objmgr_vdev *vdev, 776 bool pairwise, uint8_t key_index, 777 struct qdf_mac_addr *peer_mac); 778 779 /** 780 * wlan_crypto_validate_key_params() - validates key parameters 781 * @cipher: cipher type 782 * @key_index: the index of the key 783 * @key_len: key length 784 * @seq_len: sequence counter length 785 * 786 * Return: QDF_STATUS 787 */ 788 QDF_STATUS wlan_crypto_validate_key_params(enum wlan_crypto_cipher_type cipher, 789 uint8_t key_index, uint8_t key_len, 790 uint8_t seq_len); 791 792 /** 793 * wlan_crypto_save_key() - Allocate memory for storing key 794 * @vdev: vdev object 795 * @key_index: the index of the key that needs to be allocated 796 * @crypto_key: Pointer to crypto key 797 * 798 * Return: QDF_STATUS 799 */ 800 QDF_STATUS wlan_crypto_save_key(struct wlan_objmgr_vdev *vdev, 801 uint8_t key_index, 802 struct wlan_crypto_key *crypto_key); 803 804 /** 805 * wlan_crypto_get_key() - Get the stored key information 806 * @vdev: vdev object 807 * @key_index: the index of the key that needs to be retrieved 808 * 809 * Return: Key material 810 */ 811 struct wlan_crypto_key *wlan_crypto_get_key(struct wlan_objmgr_vdev *vdev, 812 uint8_t key_index); 813 814 /** 815 * wlan_crypto_set_key_req() - Set key request 816 * @vdev: vdev object 817 * @req: key request information 818 * @key_type: indicates the type of key to be set, unicast or group key 819 * 820 * Return: QDF status 821 */ 822 QDF_STATUS wlan_crypto_set_key_req(struct wlan_objmgr_vdev *vdev, 823 struct wlan_crypto_key *req, 824 enum wlan_crypto_key_type key_type); 825 #else 826 static inline void wlan_crypto_update_set_key_peer( 827 struct wlan_objmgr_vdev *vdev, 828 bool pairwise, 829 uint8_t key_index, 830 struct qdf_mac_addr *peer_mac) 831 { 832 } 833 834 static inline QDF_STATUS 835 wlan_crypto_save_key(struct wlan_objmgr_vdev *vdev, uint8_t key_index, 836 struct wlan_crypto_key *crypto_key) 837 { 838 return QDF_STATUS_SUCCESS; 839 } 840 841 static inline struct wlan_crypto_key * 842 wlan_crypto_get_key(struct wlan_objmgr_vdev *vdev, uint8_t key_index) 843 { 844 return NULL; 845 } 846 847 static inline 848 QDF_STATUS wlan_crypto_set_key_req(struct wlan_objmgr_vdev *vdev, 849 struct wlan_crypto_key *req, 850 enum wlan_crypto_key_type key_type) 851 { 852 return QDF_STATUS_SUCCESS; 853 } 854 #endif /* CRYPTO_SET_KEY_CONVERGED */ 855 /** 856 * wlan_crypto_get_pmksa - called to get pmksa of bssid passed. 857 * @vdev: vdev 858 * @bssid: bssid 859 * 860 * This function gets called from to get pmksa for the bssid. 861 * 862 * Return: wlan_crypto_pmksa when match found else NULL. 863 */ 864 struct wlan_crypto_pmksa * 865 wlan_crypto_get_pmksa(struct wlan_objmgr_vdev *vdev, 866 struct qdf_mac_addr *bssid); 867 868 /** 869 * wlan_crypto_pmksa_flush - called to flush saved pmksa 870 * @crypto_params: crypto_params 871 * 872 * This function flush saved pmksa from crypto params. 873 * 874 * Return: QDF_STATUS_SUCCESS - in case of success 875 */ 876 QDF_STATUS wlan_crypto_pmksa_flush(struct wlan_crypto_params *crypto_params); 877 878 /** 879 * wlan_crypto_set_vdev_param - called by ucfg to set crypto param 880 * @vdev: vdev 881 * @pmksa: pmksa to be set/del. 882 * @set: set(set=1) or del(set=0) pmksa from the list. 883 * 884 * This function gets called from ucfg to set or del pmksa. 885 * when given pmksa is NULL and set is 0, it is for flush all entries. 886 * 887 * Return: QDF_STATUS_SUCCESS - in case of success 888 */ 889 QDF_STATUS wlan_crypto_set_del_pmksa(struct wlan_objmgr_vdev *vdev, 890 struct wlan_crypto_pmksa *pmksa, 891 bool set); 892 893 #endif /* end of _WLAN_CRYPTO_GLOBAL_API_H_ */ 894