<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>Chapter 8. Hardware crypto acceleration</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="The 802.11 subsystems – for kernel developers" /><link rel="up" href="advanced.html" title="Part II. Advanced driver interface" /><link rel="prev" href="API-ieee80211-create-tpt-led-trigger.html" title="ieee80211_create_tpt_led_trigger" /><link rel="next" href="API-enum-set-key-cmd.html" title="enum set_key_cmd" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 8. Hardware crypto acceleration</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-ieee80211-create-tpt-led-trigger.html">Prev</a> </td><th width="60%" align="center">Part II. Advanced driver interface</th><td width="20%" align="right"> <a accesskey="n" href="API-enum-set-key-cmd.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 8. Hardware crypto acceleration"><div class="titlepage"><div><div><h2 class="title"><a id="hardware-crypto-offload"></a>Chapter 8. Hardware crypto acceleration</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="refentrytitle"><a href="API-enum-set-key-cmd.html"><span>enum set_key_cmd</span></a></span><span class="refpurpose"> — key command </span></dt><dt><span class="refentrytitle"><a href="API-struct-ieee80211-key-conf.html"><span>struct ieee80211_key_conf</span></a></span><span class="refpurpose"> — key information </span></dt><dt><span class="refentrytitle"><a href="API-enum-ieee80211-key-flags.html"><span>enum ieee80211_key_flags</span></a></span><span class="refpurpose"> — key flags </span></dt><dt><span class="refentrytitle"><a href="API-enum-ieee80211-tkip-key-type.html"><span>enum ieee80211_tkip_key_type</span></a></span><span class="refpurpose"> — get tkip key </span></dt><dt><span class="refentrytitle"><a href="API-ieee80211-get-tkip-key.html"><span>ieee80211_get_tkip_key</span></a></span><span class="refpurpose"> — get a TKIP rc4 for skb </span></dt><dt><span class="refentrytitle"><a href="API-ieee80211-key-removed.html"><span>ieee80211_key_removed</span></a></span><span class="refpurpose"> — disable hw acceleration for key </span></dt></dl></div><p> </p><p> mac80211 is capable of taking advantage of many hardware acceleration designs for encryption and decryption operations. </p><p> The <code class="function">set_key</code> callback in the <span class="structname">struct ieee80211_ops</span> for a given device is called to enable hardware acceleration of encryption and decryption. The callback takes a <em class="parameter"><code>sta</code></em> parameter that will be NULL for default keys or keys used for transmission only, or point to the station information for the peer for individual keys. Multiple transmission keys with the same key index may be used when VLANs are configured for an access point. </p><p> When transmitting, the TX control data will use the <em class="parameter"><code>hw_key_idx</code></em> selected by the driver by modifying the <span class="structname">struct ieee80211_key_conf</span> pointed to by the <em class="parameter"><code>key</code></em> parameter to the <code class="function">set_key</code> function. </p><p> The <code class="function">set_key</code> call for the <code class="constant">SET_KEY</code> command should return 0 if the key is now in use, -<code class="constant">EOPNOTSUPP</code> or -<code class="constant">ENOSPC</code> if it couldn't be added; if you return 0 then hw_key_idx must be assigned to the hardware key index, you are free to use the full u8 range. </p><p> When the cmd is <code class="constant">DISABLE_KEY</code> then it must succeed. </p><p> Note that it is permissible to not decrypt a frame even if a key for it has been uploaded to hardware, the stack will not make any decision based on whether a key has been uploaded or not but rather based on the receive flags. </p><p> The <span class="structname">struct ieee80211_key_conf</span> structure pointed to by the <em class="parameter"><code>key</code></em> parameter is guaranteed to be valid until another call to <code class="function">set_key</code> removes it, but it can only be used as a cookie to differentiate keys. </p><p> In TKIP some HW need to be provided a phase 1 key, for RX decryption acceleration (i.e. iwlwifi). Those drivers should provide update_tkip_key handler. The <code class="function">update_tkip_key</code> call updates the driver with the new phase 1 key. This happens everytime the iv16 wraps around (every 65536 packets). The <code class="function">set_key</code> call will happen only once for each key (unless the AP did rekeying), it will not include a valid phase 1 key. The valid phase 1 key is provided by update_tkip_key only. The trigger that makes mac80211 call this handler is software decryption with wrap around of iv16. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-ieee80211-create-tpt-led-trigger.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="advanced.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-enum-set-key-cmd.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>ieee80211_create_tpt_led_trigger</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span>enum set_key_cmd</span></td></tr></table></div></body></html>