blob: 9b8096672fb485abfaa132c2049b797f17b5e528 [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2016
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS (""MEDIATEK SOFTWARE"")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN ""AS-IS"" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35#ifndef _SEC_DEF_H_
36#define _SEC_DEF_H_
37/*****************************************************************************
38*
39* FILE NAME : secdef.h
40*
41* DESCRIPTION : This file contains function prototypes and other definitions
42* for the SEC component, which are shared between other
43* components within SEC.
44*
45*
46* HISTORY :
47* See Log at end of file
48*
49*****************************************************************************/
50
51/*----------------------------------------------------------------------------
52* Include Files
53----------------------------------------------------------------------------*/
54#include "kal_public_api.h"
55#include "kal_public_defs.h"
56#include "sysapi.h"
57#include "hlpapi.h"
58#include "secapi.h"
59
60/*----------------------------------------------------------------------------
61 Global Defines And Macros
62----------------------------------------------------------------------------*/
63/*----------------------------------------------------------------------------
64 Local Defines And Macros
65----------------------------------------------------------------------------*/
66
67#ifdef CBP7_EHRPD
68/*----------------------------------------------------------------------------
69Global Typedefs
70----------------------------------------------------------------------------*/
71typedef struct {
72 kal_uint8 rand[HLP_AKA_RAND_LEN];
73 kal_uint8 autn[HLP_AKA_AUTN_LEN];
74 kal_uint8 rcvdMac[HLP_AKA_MACA_LEN];
75 kal_uint8 AMF[HLP_AKA_AMF_LEN];
76 kal_uint8 SQN[HLP_AKA_SQN_LEN];
77 kal_uint8 xMac[HLP_AKA_MACA_LEN];
78 kal_uint8 ik[EAP_AKA_IK_LEN];
79 kal_uint8 ck[EAP_AKA_CK_LEN];
80 kal_uint8 res[HLP_AKA_RES_LEN];
81} SecAkaAuthSpyT;
82
83typedef struct {
84 kal_uint8 identity[HLP_MN_NAI_MAX_SIZE];
85 kal_uint8 ck[EAP_AKA_CK_LEN];
86 kal_uint8 ik[EAP_AKA_IK_LEN];
87 kal_uint8 mk[EAP_AKA_PRIME_MK_LEN];
88} SecAkaDeriveMkSpyT;
89
90typedef struct {
91 kal_uint8 identity[HLP_MN_NAI_MAX_SIZE];
92 kal_uint8 counter[2];
93 kal_uint8 nonces[EAP_AKA_NONCE_S_LEN];
94 kal_uint8 mk[EAP_AKA_MK_LEN];
95 kal_uint8 Xkey[EAP_AKA_SHA1_MAC_LEN];
96} SecAkaDeriveReauthXkeySpyT;
97
98typedef struct {
99 kal_uint8 mk[EAP_AKA_MK_LEN];
100 kal_uint8 xOut[EAP_AKA_SHA1_MAC_LEN];
101} SecAkaDeriveMskSpyT;
102
103typedef struct {
104 kal_uint8 key[EAP_AKA_K_AUT_LEN];
105 kal_uint8 MsgBody[100];
106 kal_uint8 ExtraMsgBody[100];
107 kal_uint8 mac[EAP_AKA_MAC_LEN];
108} SecAkaDeriveMacSpyT;
109
110typedef struct {
111 kal_uint8 msk[EAP_AKA_K_AUT_LEN];
112 kal_uint8 key[EAP_AKA_K_AUT_LEN];
113 kal_uint8 pmk[EAP_AKA_MSK_DATA_LEN];
114} PACKED_POSTFIX SecAkaDerivePmkSpyT;
115
116typedef struct {
117 kal_bool bEncrypt; /*0 - encrypt, 1 - decrypt*/
118 kal_uint8 key[EAP_AKA_K_ENCR_LEN];
119 kal_uint8 iv[EAP_AKA_IV_LEN];
120 kal_uint8 data[100];
121} SecAkaAesCryptSpyT;
122#endif
123
124/*----------------------------------------------------------------------------
125 Global Function Prototypes
126----------------------------------------------------------------------------*/
127#ifdef CBP7_EHRPD
128extern void SecAkaAuthReqMsg(SecAkaAuthReqMsgT *MsgDataP);
129extern void SecAkaDeriveMkReqMsg(SecAkaDeriveMKReqMsgT *MsgDataP);
130extern void SecAkaDeriveMskReqMsg(SecAkaDeriveMskReqMsgT * MsgDataP);
131extern void SecAkaDeriveReauthXKeyReqMsg(SecAkaDeriveReauthXKeyReqMsgT *MsgDataP);
132extern void SecAkaDeriveMacReqMsg(SecAkaDeriveMacReqMsgT *MsgDataP);
133extern void SecAkaDerivePmkReqMsg(SecAkaDerivePmkReqMsgT *MsgDataP);
134extern void SecAkaAesCryptReqMsg(SecAkaAesCryptReqMsgT *MsgDataP);
135#if 0
136/* under construction !*/
137/* under construction !*/
138/* under construction !*/
139/* under construction !*/
140/* under construction !*/
141/* under construction !*/
142/* under construction !*/
143#endif
144void SecAkaSQNInitialization(void);
145#if EAP_AKA_PRIME
146void SecAkaPrimeDeriveMkReqMsg(SecAkaDeriveMKReqMsgT *MsgDataP);
147void SecAkaPrimeDeriveReauthMkReqMsg(SecAkaPrimeDeriveReauthMkReqMsgT *MsgDataP);
148#endif
149#endif
150extern void SecValAesCryptReqMsg(SecAkaAesCryptReqMsgT *MsgDataP);
151/*****************************************************************************
152* End of File
153*****************************************************************************/
154#endif
155
156
157
158