1 /* =========================================================================
2 * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_crypto.h $
7 * Synopsys Portability Library Software and documentation
8 * (hereinafter, "Software") is an Unsupported proprietary work of
9 * Synopsys, Inc. unless otherwise expressly agreed to in writing
10 * between Synopsys and you.
12 * The Software IS NOT an item of Licensed Software or Licensed Product
13 * under any End User Software License Agreement or Agreement for
14 * Licensed Product with Synopsys or any supplement thereto. You are
15 * permitted to use and redistribute this Software in source and binary
16 * forms, with or without modification, provided that redistributions
17 * of source code must retain this notice. You may not view, use,
18 * disclose, copy or distribute this file or any information contained
19 * herein except pursuant to this license grant from Synopsys. If you
20 * do not agree with this notice, including the disclaimer below, then
21 * you are not authorized to use the Software.
23 * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
24 * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL
27 * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
31 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
33 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
35 * ========================================================================= */
37 #ifndef _DWC_CRYPTO_H_
38 #define _DWC_CRYPTO_H_
46 * This file contains declarations for the WUSB Cryptographic routines as
47 * defined in the WUSB spec. They are only to be used internally by the DWC UWB
53 int dwc_wusb_aes_encrypt(u8 *src, u8 *key, u8 *dst);
55 void dwc_wusb_cmf(u8 *key, u8 *nonce,
56 char *label, u8 *bytes, int len, u8 *result);
57 void dwc_wusb_prf(int prf_len, u8 *key,
58 u8 *nonce, char *label, u8 *bytes, int len, u8 *result);
61 * The PRF-64 function described in section 6.5 of the WUSB spec.
63 * @param key, nonce, label, bytes, len, result Same as for dwc_prf().
65 static inline void dwc_wusb_prf_64(u8 *key, u8 *nonce,
66 char *label, u8 *bytes, int len, u8 *result)
68 dwc_wusb_prf(64, key, nonce, label, bytes, len, result);
72 * The PRF-128 function described in section 6.5 of the WUSB spec.
74 * @param key, nonce, label, bytes, len, result Same as for dwc_prf().
76 static inline void dwc_wusb_prf_128(u8 *key, u8 *nonce,
77 char *label, u8 *bytes, int len, u8 *result)
79 dwc_wusb_prf(128, key, nonce, label, bytes, len, result);
83 * The PRF-256 function described in section 6.5 of the WUSB spec.
85 * @param key, nonce, label, bytes, len, result Same as for dwc_prf().
87 static inline void dwc_wusb_prf_256(u8 *key, u8 *nonce,
88 char *label, u8 *bytes, int len, u8 *result)
90 dwc_wusb_prf(256, key, nonce, label, bytes, len, result);
94 void dwc_wusb_fill_ccm_nonce(uint16_t haddr, uint16_t daddr, uint8_t *tkid,
96 void dwc_wusb_gen_nonce(uint16_t addr,
99 void dwc_wusb_gen_key(uint8_t *ccm_nonce, uint8_t *mk,
100 uint8_t *hnonce, uint8_t *dnonce,
101 uint8_t *kck, uint8_t *ptk);
104 void dwc_wusb_gen_mic(uint8_t *ccm_nonce, uint8_t
105 *kck, uint8_t *data, uint8_t *mic);
111 #endif /* _DWC_CRYPTO_H_ */