Changeset 58466 in vbox for trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg
- Timestamp:
- Oct 29, 2015 4:30:44 AM (9 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 96 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware
- Property svn:mergeinfo changed
/vendor/edk2/current merged: 103769-103776
- Property svn:mergeinfo changed
-
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/IfConfig6/IfConfig6.h
r48674 r58466 41 41 42 42 #define MACADDRMAXSIZE 32 43 #define PREFIXMAXLEN 16 43 #define PREFIXMAXLEN 16 44 44 45 45 typedef struct _IFCONFIG6_INTERFACE_CB { … … 47 47 LIST_ENTRY Link; 48 48 EFI_IP6_CONFIG_PROTOCOL *IfCfg; 49 EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo; 49 EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo; 50 50 EFI_IP6_CONFIG_INTERFACE_ID *IfId; 51 51 EFI_IP6_CONFIG_POLICY Policy; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/IfConfig6/IfConfig6.inf
r58459 r58466 40 40 MdeModulePkg/MdeModulePkg.dec 41 41 ShellPkg/ShellPkg.dec 42 42 43 43 [LibraryClasses] 44 44 BaseLib -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/IfConfig6/IfConfig6Strings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/IpsecConfig/IpSecConfig.inf
r58459 r58466 1 1 ## @file 2 2 # Shell application IpSecConfig. 3 # 3 # 4 4 # This application is used to set and retrieve security and policy related information 5 5 # for the EFI IPsec protocol driver. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/IpsecConfig/IpSecConfigStrings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/IpsecConfig/Match.h
r48674 r58466 1 1 /** @file 2 The internal structure and function declaration of 2 The internal structure and function declaration of 3 3 match policy entry function in IpSecConfig application. 4 4 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/Ping6/Ping6.c
r58459 r58466 260 260 } 261 261 262 if (!IP6_IS_MULTICAST (&Private->DstAddress) && 262 if (!IP6_IS_MULTICAST (&Private->DstAddress) && 263 263 !EFI_IP6_EQUAL (&RxData->Header->SourceAddress, &Private->DstAddress)) { 264 264 goto ON_EXIT; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/Ping6/Ping6Strings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Application/VConfig/VConfigStrings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/ComponentName.c
r58459 r58466 248 248 @param Dhcp6[in] A pointer to the EFI_DHCP6_PROTOCOL. 249 249 250 250 251 251 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 252 252 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 253 253 254 254 **/ 255 255 EFI_STATUS … … 273 273 return Status; 274 274 } 275 275 276 276 if (gDhcp6ControllerNameTable != NULL) { 277 277 FreeUnicodeStringTable (gDhcp6ControllerNameTable); 278 278 gDhcp6ControllerNameTable = NULL; 279 279 } 280 280 281 281 if (Dhcp6ModeData.Ia == NULL) { 282 282 HandleName = L"DHCPv6 (No configured IA)"; … … 287 287 HandleName = mDhcp6ControllerName[Dhcp6ModeData.Ia->State]; 288 288 } 289 289 290 290 Status = AddUnicodeString2 ( 291 291 "eng", … … 298 298 return Status; 299 299 } 300 300 301 301 return AddUnicodeString2 ( 302 302 "en", … … 395 395 return EFI_UNSUPPORTED; 396 396 } 397 398 // 399 // Make sure this driver produced ChildHandle 400 // 397 398 // 399 // Make sure this driver produced ChildHandle 400 // 401 401 Status = EfiTestChildHandle ( 402 402 ControllerHandle, 403 ChildHandle, 403 ChildHandle, 404 404 &gEfiUdp6ProtocolGuid 405 405 ); … … 414 414 ChildHandle, 415 415 &gEfiDhcp6ProtocolGuid, 416 (VOID **)&Dhcp6, 416 (VOID **)&Dhcp6, 417 417 NULL, 418 418 NULL, -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.c
r58459 r58466 329 329 /** 330 330 Callback function which provided by user to remove one node in NetDestroyLinkList process. 331 331 332 332 @param[in] Entry The entry to be removed. 333 333 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList. … … 353 353 Instance = NET_LIST_USER_STRUCT_S (Entry, DHCP6_INSTANCE, Link, DHCP6_INSTANCE_SIGNATURE); 354 354 ServiceBinding = (EFI_SERVICE_BINDING_PROTOCOL *) Context; 355 355 356 356 return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); 357 357 } … … 559 559 // 560 560 // Destroy all the children instances before destory the service. 561 // 561 // 562 562 List = &Service->Child; 563 563 Status = NetDestroyLinkList ( … … 592 592 Status = EFI_SUCCESS; 593 593 } 594 594 595 595 ON_EXIT: 596 596 return Status; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
r58459 r58466 1 1 ## @file 2 2 # Client-side DHCPv6 services. 3 # 3 # 4 4 # This driver produces EFI DHCPv6 Protocol which is used to get IPv6 addresses 5 5 # and other configuration parameters from DHCPv6 servers. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
r58459 r58466 226 226 Status = Instance->UdpSts; 227 227 } 228 228 229 229 ON_EXIT: 230 230 // … … 667 667 } 668 668 669 do { 669 do { 670 670 TimerStatus = gBS->CheckEvent (Timer); 671 671 if (!EFI_ERROR (TimerStatus)) { … … 683 683 } 684 684 } while (TimerStatus == EFI_NOT_READY); 685 685 686 686 gBS->CloseEvent (Timer); 687 687 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
r58459 r58466 252 252 // 253 253 // StartTime is used to calculate the 'elapsed-time' option. Refer to RFC3315, 254 // the elapsed-time is amount of time since the client began its current DHCP transaction. 254 // the elapsed-time is amount of time since the client began its current DHCP transaction. 255 255 // 256 256 UINT64 StartTime; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
r58459 r58466 372 372 @retval TRUE The control block is in Instance's retry list. 373 373 @retval FALSE The control block is NOT in Instance's retry list. 374 374 375 375 **/ 376 376 BOOLEAN … … 1769 1769 goto ON_ERROR; 1770 1770 } 1771 1771 1772 1772 gBS->RestoreTPL (OldTpl); 1773 1773 return EFI_SUCCESS; 1774 1774 1775 1775 ON_ERROR: 1776 gBS->RestoreTPL (OldTpl); 1776 gBS->RestoreTPL (OldTpl); 1777 1777 RemoveEntryList (&InfCb->Link); 1778 1778 FreePool (InfCb); … … 1898 1898 Packet->Length += (UINT32) (Cursor - Packet->Dhcp6.Option); 1899 1899 ASSERT (Packet->Size > Packet->Length + 8); 1900 1900 1901 1901 // 1902 1902 // Clear initial time for current transaction. … … 2234 2234 } else if (Status == EFI_NOT_FOUND) { 2235 2235 // 2236 // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message, 2236 // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message, 2237 2237 // the client sends a Renew or Rebind if the IA is not in the Reply message. 2238 2238 // Return EFI_SUCCESS so we can continue to restart the Renew/Rebind process. … … 2240 2240 return EFI_SUCCESS; 2241 2241 } 2242 2242 2243 2243 goto ON_EXIT; 2244 2244 2245 2245 } else if (Option != NULL) { 2246 2246 // … … 2291 2291 if (Instance->IaCb.Ia->State == Dhcp6Renewing || Instance->IaCb.Ia->State == Dhcp6Rebinding) { 2292 2292 // 2293 // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message, the client 2293 // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message, the client 2294 2294 // sends a Request message if the IA contained a Status Code option with the NoBinding status. 2295 2295 // … … 2310 2310 2311 2311 return EFI_SUCCESS; 2312 2312 2313 2313 ON_EXIT: 2314 2314 … … 2320 2320 ); 2321 2321 } 2322 2322 2323 2323 return Status; 2324 2324 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
r58459 r58466 68 68 // 69 69 // The format of DUID-UUID: 70 // 70 // 71 71 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 72 72 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ … … 91 91 // 92 92 Duid->Length = (UINT16) (18); 93 93 94 94 // 95 95 // Set the Duid-type and copy UUID. 96 96 // 97 97 WriteUnaligned16 ((UINT16 *) (Duid->Duid), HTONS (Dhcp6DuidTypeUuid)); 98 98 99 99 CopyMem (Duid->Duid + 2, &Uuid, sizeof(EFI_GUID)); 100 100 101 101 } else { 102 102 103 103 // 104 104 // … … 135 135 return NULL; 136 136 } 137 137 138 138 // 139 139 // sizeof (Duid-type + hardware-type + time) = 8 bytes 140 140 // 141 141 Duid->Length = (UINT16) (Mode->HwAddressSize + 8); 142 142 143 143 // 144 144 // Set the Duid-type, hardware-type, time and copy the hardware address. … … 687 687 // . . 688 688 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 689 689 690 690 // 691 691 // Fill the value of Ia Address option type … … 1000 1000 1001 1001 /** 1002 Check whether the incoming IPv6 address in IaAddr is one of the maintained 1002 Check whether the incoming IPv6 address in IaAddr is one of the maintained 1003 1003 addresses in the IA control blcok. 1004 1004 … … 1019 1019 1020 1020 ASSERT (IaAddr != NULL && CurrentIa != NULL); 1021 1021 1022 1022 for (Index = 0; Index < CurrentIa->IaAddressCount; Index++) { 1023 1023 if (EFI_IP6_EQUAL(&IaAddr->IpAddress, &CurrentIa->IaAddress[Index].IpAddress)) { … … 1303 1303 IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg, 1304 1304 OUT UINTN *TimeOut 1305 ) 1305 ) 1306 1306 { 1307 1307 EFI_STATUS Status; … … 1323 1323 return Status; 1324 1324 } 1325 1325 1326 1326 *TimeOut = TICKS_PER_SECOND * DadXmits.DupAddrDetectTransmits + DHCP6_DAD_ADDITIONAL_DELAY; 1327 1327 1328 1328 return EFI_SUCCESS; 1329 1329 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/ComponentName.c
r58459 r58466 107 107 @param[in] IScsiExtScsiPassThru A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. 108 108 @param[in] Ipv6Flag TRUE if IP6 network stack is used. 109 109 110 110 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 111 111 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 112 112 @retval EFI_UNSUPPORTED Can't get the corresponding NIC info from the Controller handle. 113 113 114 114 **/ 115 115 EFI_STATUS … … 127 127 return EFI_INVALID_PARAMETER; 128 128 } 129 129 130 130 Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (IScsiExtScsiPassThru); 131 131 NicIndex = Private->Session->ConfigData->NicIndex; 132 132 133 133 UnicodeSPrint ( 134 134 HandleName, … … 243 243 { 244 244 EFI_STATUS Status; 245 245 246 246 EFI_HANDLE IScsiController; 247 247 BOOLEAN Ipv6Flag; 248 248 EFI_GUID *IScsiPrivateGuid; 249 249 ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier; 250 250 251 251 EFI_EXT_SCSI_PASS_THRU_PROTOCOL *IScsiExtScsiPassThru; 252 252 253 253 if (ControllerHandle == NULL) { 254 254 return EFI_UNSUPPORTED; … … 310 310 } 311 311 } 312 312 313 313 // 314 314 // Retrieve an instance of a produced protocol from ChildHandle … … 325 325 return Status; 326 326 } 327 327 328 328 // 329 329 // Update the component name for this child handle. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiCHAP.c
r48674 r58466 17 17 /** 18 18 Initator caculates its own expected hash value. 19 19 20 20 @param[in] ChapIdentifier iSCSI CHAP identifier sent by authenticator. 21 21 @param[in] ChapSecret iSCSI CHAP secret of the authenticator. … … 24 24 @param[in] ChallengeLength The length of iSCSI CHAP challenge message. 25 25 @param[out] ChapResponse The calculation of the expected hash value. 26 26 27 27 @retval EFI_SUCCESS The expected hash value was caculatedly successfully. 28 28 @retval EFI_PROTOCOL_ERROR The length of the secret should be at least the … … 96 96 /** 97 97 The initator checks the CHAP response replied by target against its own 98 calculation of the expected hash value. 99 100 @param[in] AuthData iSCSI CHAP authentication data. 101 @param[in] TargetResponse The response from target. 98 calculation of the expected hash value. 99 100 @param[in] AuthData iSCSI CHAP authentication data. 101 @param[in] TargetResponse The response from target. 102 102 103 103 @retval EFI_SUCCESS The response from target passed authentication. … … 268 268 // Process the CHAP identifier and CHAP Challenge from Target. 269 269 // Calculate Response value. 270 // 270 // 271 271 Result = IScsiNetNtoi (Identifier); 272 272 if (Result > 0xFF) { 273 273 goto ON_EXIT; 274 } 275 274 } 275 276 276 AuthData->InIdentifier = (UINT32) Result; 277 277 AuthData->InChallengeLength = ISCSI_CHAP_AUTH_MAX_LEN; … … 332 332 if (KeyValueList != NULL) { 333 333 IScsiFreeKeyValueList (KeyValueList); 334 } 334 } 335 335 336 336 FreePool (Data); -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiCHAP.h
r48674 r58466 30 30 /// MD5_HASHSIZE 31 31 /// 32 #define ISCSI_CHAP_RSP_LEN 16 32 #define ISCSI_CHAP_RSP_LEN 16 33 33 34 34 #define ISCSI_CHAP_STEP_ONE 1 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiConfig.c
r58459 r58466 35 35 END_DEVICE_PATH_TYPE, 36 36 END_ENTIRE_DEVICE_PATH_SUBTYPE, 37 { 37 { 38 38 (UINT8) (END_DEVICE_PATH_LENGTH), 39 39 (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8) … … 494 494 NULL 495 495 ); 496 496 497 497 return EFI_INVALID_PARAMETER; 498 498 } … … 515 515 NULL 516 516 ); 517 517 518 518 return EFI_INVALID_PARAMETER; 519 519 } else if (!IP4_NET_EQUAL (HostIp.Addr[0], Gateway.Addr[0], SubnetMask.Addr[0])) { … … 524 524 NULL 525 525 ); 526 526 527 527 return EFI_INVALID_PARAMETER; 528 528 } … … 554 554 NULL 555 555 ); 556 556 557 557 return EFI_INVALID_PARAMETER; 558 558 } … … 566 566 L"Reverse CHAP Name or Reverse CHAP Secret is invalid!", 567 567 NULL 568 ); 568 ); 569 569 return EFI_INVALID_PARAMETER; 570 570 } … … 585 585 FreePool (AttemptName1); 586 586 return EFI_OUT_OF_RESOURCES; 587 } 588 587 } 588 589 589 AsciiStrToUnicodeStr (Attempt->AttemptName, AttemptName1); 590 590 if (StrLen (AttemptName1) > ATTEMPT_NAME_SIZE) { … … 610 610 mPrivate->PortString, 611 611 NULL 612 ); 612 ); 613 613 614 614 FreePool (AttemptName1); … … 747 747 // IScsiConfigProcessDefault. If input Attempt does not match any existing 748 748 // attempt, it should be a new created attempt. Save it to system now. 749 // 749 // 750 750 ASSERT (Attempt == mPrivate->NewAttempt); 751 751 … … 841 841 842 842 /** 843 Create Hii Extend Label OpCode as the start opcode and end opcode. It is 843 Create Hii Extend Label OpCode as the start opcode and end opcode. It is 844 844 a help function. 845 845 … … 852 852 @retval EFI_OUT_OF_RESOURCES Do not have sufficient resource to finish this 853 853 operation. 854 @retval EFI_INVALID_PARAMETER Any input parameter is invalid. 854 @retval EFI_INVALID_PARAMETER Any input parameter is invalid. 855 855 @retval EFI_SUCCESS The operation is completed successfully. 856 856 … … 902 902 goto Exit; 903 903 } 904 904 905 905 InternalStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 906 906 InternalStartLabel->Number = StartLabelNumber; … … 936 936 HiiFreeOpCodeHandle (*EndOpCodeHandle); 937 937 } 938 938 939 939 return Status; 940 940 } … … 1010 1010 if (PortTitleHelpToken == 0) { 1011 1011 Status = EFI_INVALID_PARAMETER; 1012 goto Exit; 1012 goto Exit; 1013 1013 } 1014 1014 … … 1034 1034 HiiFreeOpCodeHandle (StartOpCodeHandle); 1035 1035 HiiFreeOpCodeHandle (EndOpCodeHandle); 1036 1036 1037 1037 return Status; 1038 1038 } … … 1099 1099 StartOpCodeHandle, // Label for where to insert opcodes 1100 1100 EndOpCodeHandle // Replace data 1101 ); 1101 ); 1102 1102 1103 1103 HiiFreeOpCodeHandle (StartOpCodeHandle); … … 1268 1268 FreePool (AttemptNewOrder); 1269 1269 } 1270 1270 1271 1271 return Status; 1272 1272 } … … 1354 1354 StartOpCodeHandle, // Label for where to insert opcodes 1355 1355 EndOpCodeHandle // Replace data 1356 ); 1356 ); 1357 1357 1358 1358 HiiFreeOpCodeHandle (StartOpCodeHandle); … … 1385 1385 VOID *EndOpCodeHandle; 1386 1386 EFI_IFR_GUID_LABEL *EndLabel; 1387 VOID *OptionsOpCodeHandle; 1388 1387 VOID *OptionsOpCodeHandle; 1388 1389 1389 Status = IScsiCreateOpCode ( 1390 1390 ORDER_ENTRY_LABEL, … … 1438 1438 CONFIGURATION_VARSTORE_ID, // VarStore ID 1439 1439 DYNAMIC_ORDERED_LIST_VAR_OFFSET, // Offset in Buffer Storage 1440 STRING_TOKEN (STR_ORDER_ATTEMPT_ENTRY), // Question prompt text 1441 STRING_TOKEN (STR_ORDER_ATTEMPT_ENTRY), // Question help text 1440 STRING_TOKEN (STR_ORDER_ATTEMPT_ENTRY), // Question prompt text 1441 STRING_TOKEN (STR_ORDER_ATTEMPT_ENTRY), // Question help text 1442 1442 0, // Question flag 1443 1443 EFI_IFR_UNIQUE_SET, // Ordered list flag, e.g. EFI_IFR_UNIQUE_SET 1444 1444 EFI_IFR_NUMERIC_SIZE_1, // Data type of Question value 1445 1445 ISCSI_MAX_ATTEMPTS_NUM, // Maximum container 1446 OptionsOpCodeHandle, // Option Opcode list 1447 NULL // Default Opcode is NULL 1446 OptionsOpCodeHandle, // Option Opcode list 1447 NULL // Default Opcode is NULL 1448 1448 ); 1449 1449 … … 1455 1455 StartOpCodeHandle, // Label for where to insert opcodes 1456 1456 EndOpCodeHandle // Replace data 1457 ); 1457 ); 1458 1458 1459 1459 Error: 1460 1460 HiiFreeOpCodeHandle (StartOpCodeHandle); 1461 HiiFreeOpCodeHandle (EndOpCodeHandle); 1461 HiiFreeOpCodeHandle (EndOpCodeHandle); 1462 1462 if (OptionsOpCodeHandle != NULL) { 1463 1463 HiiFreeOpCodeHandle (OptionsOpCodeHandle); … … 1630 1630 return EFI_SUCCESS; 1631 1631 } 1632 1632 1633 1633 // 1634 1634 // Free any attempt that is previously created but not saved to system. … … 1648 1648 return EFI_NOT_FOUND; 1649 1649 } 1650 1650 1651 1651 // 1652 1652 // Create new attempt. … … 1721 1721 // 1722 1722 CopyMem (AttemptConfigData->SessionConfigData.IsId, &NicInfo->PermanentAddress, 6); 1723 AttemptConfigData->SessionConfigData.IsId[0] = 1723 AttemptConfigData->SessionConfigData.IsId[0] = 1724 1724 (UINT8) (AttemptConfigData->SessionConfigData.IsId[0] & 0x3F); 1725 1725 … … 1789 1789 ZeroMem (IfrNvData->ReverseCHAPSecret, sizeof (IfrNvData->ReverseCHAPSecret)); 1790 1790 } 1791 1791 1792 1792 IScsiConvertAttemptConfigDataToIfrNvData (AttemptConfigData, IfrNvData); 1793 1793 … … 1802 1802 1803 1803 /** 1804 1804 1805 1805 This function allows the caller to request the current 1806 1806 configuration for one or more named elements. The resulting … … 1831 1831 failing name / value pair (or the beginning 1832 1832 of the string if the failure is in the first 1833 name / value pair) if the request was not successful. 1833 name / value pair) if the request was not successful. 1834 1834 1835 1835 @param[out] Results A null-terminated Unicode string in … … 1852 1852 error. In this case, the 1853 1853 Progress parameter would be 1854 set to NULL. 1854 set to NULL. 1855 1855 1856 1856 @retval EFI_NOT_FOUND Routing data doesn't match any … … 1910 1910 return EFI_OUT_OF_RESOURCES; 1911 1911 } 1912 1912 1913 1913 if (Private->Current != NULL) { 1914 1914 IScsiConvertAttemptConfigDataToIfrNvData (Private->Current, IfrNvData); … … 1921 1921 return EFI_OUT_OF_RESOURCES; 1922 1922 } 1923 1923 1924 1924 Status = gIScsiInitiatorName.Get (&gIScsiInitiatorName, &BufferSize, InitiatorName); 1925 1925 if (EFI_ERROR (Status)) { … … 1981 1981 1982 1982 /** 1983 1983 1984 1984 This function applies changes in a driver's configuration. 1985 1985 Input is a Configuration, which has the routing data for this … … 1994 1994 1995 1995 @param[in] Configuration A null-terminated Unicode string in 1996 <ConfigString> format. 1997 1996 <ConfigString> format. 1997 1998 1998 @param[out] Progress A pointer to a string filled in with the 1999 1999 offset of the most recent '&' before the … … 2006 2006 @retval EFI_SUCCESS The results have been distributed or are 2007 2007 awaiting distribution. 2008 2008 2009 2009 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the 2010 2010 parts of the results that must be 2011 2011 stored awaiting possible future 2012 2012 protocols. 2013 2013 2014 2014 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the 2015 2015 Results parameter would result 2016 2016 in this type of error. 2017 2017 2018 2018 @retval EFI_NOT_FOUND Target for the specified routing data 2019 2019 was not found. … … 2047 2047 2048 2048 /** 2049 2049 2050 2050 This function is called to provide results data to the driver. 2051 2051 This data consists of a unique key that is used to identify … … 2056 2056 @param[in] QuestionId A unique value which is sent to the original 2057 2057 exporting driver so that it can identify the type 2058 of data to expect. The format of the data tends to 2058 of data to expect. The format of the data tends to 2059 2059 vary based on the opcode that generated the callback. 2060 2060 @param[in] Type The type of value for the question. … … 2116 2116 2117 2117 Private = ISCSI_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK (This); 2118 2118 2119 2119 // 2120 2120 // Retrieve uncommitted data from Browser 2121 2121 // 2122 2122 2123 2123 BufferSize = sizeof (ISCSI_CONFIG_IFR_NVDATA); 2124 2124 IfrNvData = AllocateZeroPool (BufferSize); … … 2126 2126 return EFI_OUT_OF_RESOURCES; 2127 2127 } 2128 2128 2129 2129 IScsiName = (CHAR8 *) AllocateZeroPool (ISCSI_NAME_MAX_SIZE); 2130 2130 if (IScsiName == NULL) { … … 2132 2132 return EFI_OUT_OF_RESOURCES; 2133 2133 } 2134 2134 2135 2135 Status = EFI_SUCCESS; 2136 2136 2137 2137 ZeroMem (&OldIfrNvData, BufferSize); 2138 2138 2139 2139 HiiGetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData); 2140 2140 2141 2141 CopyMem (&OldIfrNvData, IfrNvData, BufferSize); 2142 2142 … … 2167 2167 IScsiConfigDisplayOrderAttempts (); 2168 2168 break; 2169 2169 2170 2170 default: 2171 2171 Status = IScsiConfigProcessDefault (QuestionId, IfrNvData); 2172 2172 break; 2173 2173 } 2174 } else if (Action == EFI_BROWSER_ACTION_CHANGED) { 2174 } else if (Action == EFI_BROWSER_ACTION_CHANGED) { 2175 2175 switch (QuestionId) { 2176 2176 case KEY_INITIATOR_NAME: … … 2185 2185 L"Invalid iSCSI Name!", 2186 2186 NULL 2187 ); 2187 ); 2188 2188 } 2189 2189 … … 2208 2208 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY; 2209 2209 break; 2210 2210 2211 2211 case KEY_SAVE_ATTEMPT_CONFIG: 2212 2212 Status = IScsiConvertIfrNvDataToAttemptConfigData (IfrNvData, Private->Current); … … 2288 2288 L"Invalid IP address!", 2289 2289 NULL 2290 ); 2291 2290 ); 2291 2292 2292 Status = EFI_INVALID_PARAMETER; 2293 2293 } else { … … 2305 2305 L"Invalid Subnet Mask!", 2306 2306 NULL 2307 ); 2308 2307 ); 2308 2309 2309 Status = EFI_INVALID_PARAMETER; 2310 2310 } else { … … 2322 2322 L"Invalid Gateway!", 2323 2323 NULL 2324 ); 2324 ); 2325 2325 Status = EFI_INVALID_PARAMETER; 2326 2326 } else { … … 2339 2339 L"Invalid IP address!", 2340 2340 NULL 2341 ); 2341 ); 2342 2342 Status = EFI_INVALID_PARAMETER; 2343 2343 } else { … … 2356 2356 L"Invalid iSCSI Name!", 2357 2357 NULL 2358 ); 2358 ); 2359 2359 } else { 2360 2360 AsciiStrCpy (Private->Current->SessionConfigData.TargetName, IScsiName); … … 2379 2379 L"Invalid LUN string!", 2380 2380 NULL 2381 ); 2381 ); 2382 2382 } else { 2383 2383 CopyMem (Private->Current->SessionConfigData.BootLun, &Lun, sizeof (Lun)); … … 2492 2492 ); 2493 2493 ASSERT_EFI_ERROR (Status); 2494 2494 2495 2495 // 2496 2496 // Publish our HII data. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiConfigVfr.vfr
-
Property svn:eol-style
set to
native
r58459 r58466 1 1 /** @file 2 2 VFR file used by the iSCSI configuration component. 3 3 4 4 Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials … … 116 116 flags = INTERACTIVE, 117 117 key = KEY_IGNORE_DELETE_ATTEMPT; 118 endform; 118 endform; 119 119 120 120 form formid = FORMID_ATTEMPT_FORM, … … 160 160 maximum = CONNECT_MAX_RETRY, 161 161 step = 0, 162 endnumeric; 163 162 endnumeric; 163 164 164 numeric varid = ISCSI_CONFIG_IFR_NVDATA.ConnectTimeout, 165 165 prompt = STRING_TOKEN(STR_ISCSI_CONFIG_TIMEOUT), … … 174 174 subtitle text = STRING_TOKEN(STR_NULL); 175 175 176 string varid = ISCSI_CONFIG_IFR_NVDATA.IsId, 176 string varid = ISCSI_CONFIG_IFR_NVDATA.IsId, 177 177 prompt = STRING_TOKEN(STR_ISCSI_CONFIG_ISID), 178 178 help = STRING_TOKEN(STR_ISCSI_CONFIG_ISID_HELP), … … 195 195 196 196 suppressif ideqval ISCSI_CONFIG_IFR_NVDATA.InitiatorInfoFromDhcp == 0x01 OR 197 ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_IP6 OR 197 ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_IP6 OR 198 198 ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_AUTOCONFIG; 199 199 string varid = ISCSI_CONFIG_IFR_NVDATA.LocalIp, … … 223 223 maxsize = IP4_MAX_SIZE, 224 224 endstring; 225 225 226 226 endif; 227 227 228 228 suppressif ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_AUTOCONFIG; 229 229 subtitle text = STRING_TOKEN(STR_NULL); 230 endif; 230 endif; 231 231 232 232 suppressif ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_AUTOCONFIG OR … … 277 277 maxsize = LUN_MAX_SIZE, 278 278 endstring; 279 279 280 280 endif; 281 281 282 282 suppressif ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_AUTOCONFIG; 283 283 subtitle text = STRING_TOKEN(STR_NULL); 284 endif; 284 endif; 285 285 286 286 oneof varid = ISCSI_CONFIG_IFR_NVDATA.AuthenticationType, 287 questionid = KEY_AUTH_TYPE, 287 questionid = KEY_AUTH_TYPE, 288 288 prompt = STRING_TOKEN(STR_AUTHEN_TYPE_PROMPT), 289 289 help = STRING_TOKEN(STR_AUTHEN_TYPE_HELP), … … 292 292 endoneof; 293 293 294 suppressif NOT ideqval ISCSI_CONFIG_IFR_NVDATA.AuthenticationType == ISCSI_AUTH_TYPE_CHAP; 294 suppressif NOT ideqval ISCSI_CONFIG_IFR_NVDATA.AuthenticationType == ISCSI_AUTH_TYPE_CHAP; 295 295 oneof varid = ISCSI_CONFIG_IFR_NVDATA.CHAPType, 296 296 prompt = STRING_TOKEN(STR_CHAP_TYPE_PROMPT), … … 352 352 flags = INTERACTIVE, 353 353 key = KEY_SAVE_ATTEMPT_CONFIG; 354 354 355 355 goto FORMID_MAIN_FORM, 356 356 prompt = STRING_TOKEN (STR_RETURN_MAIN_FORM), -
Property svn:eol-style
set to
-
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiDhcp.c
r48674 r58466 188 188 The callback function registerd to the DHCP4 instance that is used to select 189 189 the qualified DHCP OFFER. 190 190 191 191 @param[in] This The DHCP4 protocol. 192 192 @param[in] Context The context set when configuring the DHCP4 protocol. 193 193 @param[in] CurrentState The current state of the DHCP4 protocol. 194 194 @param[in] Dhcp4Event The event occurs in the current state. 195 @param[in] Packet The DHCP packet that is to be sent or was already received. 195 @param[in] Packet The DHCP packet that is to be sent or was already received. 196 196 @param[out] NewPacket The packet used to replace the above Packet. 197 197 198 198 @retval EFI_SUCCESS Either the DHCP OFFER is qualified or we're not intereseted 199 199 in the Dhcp4Event. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiDhcp6.c
r58459 r58466 48 48 ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData; 49 49 EFI_IP_ADDRESS Ip; 50 UINT8 IpMode; 50 UINT8 IpMode; 51 51 52 52 ConfigNvData = &ConfigData->SessionConfigData; … … 144 144 // Get the IP address of the target. 145 145 // 146 Field = &Fields[RP_FIELD_IDX_SERVERNAME]; 146 Field = &Fields[RP_FIELD_IDX_SERVERNAME]; 147 147 if (ConfigNvData->IpMode < IP_MODE_AUTOCONFIG) { 148 148 IpMode = ConfigNvData->IpMode; … … 214 214 215 215 /** 216 EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol 216 EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol 217 217 instance to intercept events that occurs in the DHCPv6 Information Request 218 218 exchange process. 219 219 220 @param[in] This Pointer to the EFI_DHCP6_PROTOCOL instance that 220 @param[in] This Pointer to the EFI_DHCP6_PROTOCOL instance that 221 221 is used to configure this callback function. 222 222 @param[in] Context Pointer to the context that is initialized in … … 252 252 ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData; 253 253 UINT16 ParaLen; 254 254 255 255 OptionCount = 0; 256 256 BootFileOpt = NULL; 257 257 258 258 Status = This->Parse (This, Packet, &OptionCount, NULL); 259 259 if (Status != EFI_BUFFER_TOO_SMALL) { … … 329 329 goto Exit; 330 330 } 331 331 332 332 // 333 333 // Get iSCSI root path from Boot File Uniform Resource Locator (URL) Option … … 499 499 if (Oro != NULL) { 500 500 FreePool (Oro); 501 } 501 } 502 502 503 503 if (Timer != NULL) { -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiDriver.c
r58459 r58466 38 38 39 39 /** 40 Tests to see if this driver supports the RemainingDevicePath. 41 42 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 43 parameter is ignored by device drivers, and is optional for bus 44 drivers. For bus drivers, if this parameter is not NULL, then 45 the bus driver must determine if the bus controller specified 46 by ControllerHandle and the child controller specified 47 by RemainingDevicePath are both supported by this 40 Tests to see if this driver supports the RemainingDevicePath. 41 42 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 43 parameter is ignored by device drivers, and is optional for bus 44 drivers. For bus drivers, if this parameter is not NULL, then 45 the bus driver must determine if the bus controller specified 46 by ControllerHandle and the child controller specified 47 by RemainingDevicePath are both supported by this 48 48 bus driver. 49 49 … … 81 81 82 82 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 83 @param[in] ControllerHandle The handle of the controller to test. This handle 84 must support a protocol interface that supplies 83 @param[in] ControllerHandle The handle of the controller to test. This handle 84 must support a protocol interface that supplies 85 85 an I/O abstraction to the driver. 86 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 87 parameter is ignored by device drivers, and is optional for bus 88 drivers. For bus drivers, if this parameter is not NULL, then 89 the bus driver must determine if the bus controller specified 90 by ControllerHandle and the child controller specified 91 by RemainingDevicePath are both supported by this 86 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 87 parameter is ignored by device drivers, and is optional for bus 88 drivers. For bus drivers, if this parameter is not NULL, then 89 the bus driver must determine if the bus controller specified 90 by ControllerHandle and the child controller specified 91 by RemainingDevicePath are both supported by this 92 92 bus driver. 93 93 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. … … 167 167 } 168 168 } 169 169 170 170 return EFI_SUCCESS; 171 171 } … … 185 185 @retval EFI_NOT_FOUND There is no sufficient information to establish 186 186 the iScsi session. 187 @retval EFI_DEVICE_ERROR Failed to get TCP connection device path. 187 @retval EFI_DEVICE_ERROR Failed to get TCP connection device path. 188 188 189 189 **/ … … 298 298 EFI_OPEN_PROTOCOL_BY_DRIVER 299 299 ); 300 300 301 301 if (EFI_ERROR (Status)) { 302 302 goto ON_ERROR; … … 304 304 305 305 // 306 // Always install private protocol no matter what happens later. We need to 306 // Always install private protocol no matter what happens later. We need to 307 307 // keep the relationship between ControllerHandle and ChildHandle. 308 308 // … … 316 316 goto ON_ERROR; 317 317 } 318 318 319 319 if (IpVersion == IP_VERSION_4) { 320 320 mPrivate->Ipv6Flag = FALSE; … … 703 703 IScsiPrivateGuid, 704 704 &ExistPrivate->IScsiIdentifier 705 ); 706 705 ); 706 707 707 IScsiRemoveNic (ExistPrivate->Controller); 708 708 if (ExistPrivate->Session != NULL) { … … 761 761 Private->ExtScsiPassThruHandle, 762 762 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 763 ); 763 ); 764 764 if (EFI_ERROR (Status)) { 765 765 gBS->UninstallMultipleProtocolInterfaces ( … … 771 771 NULL 772 772 ); 773 773 774 774 goto ON_ERROR; 775 775 } … … 798 798 Stops a device controller or a bus controller. This is the worker function for 799 799 IScsiIp4(6)DriverBindingStop. 800 800 801 801 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 802 @param[in] ControllerHandle A handle to the device being stopped. The handle must 803 support a bus specific I/O protocol for the driver 802 @param[in] ControllerHandle A handle to the device being stopped. The handle must 803 support a bus specific I/O protocol for the driver 804 804 to use to stop the device. 805 805 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. 806 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 806 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 807 807 if NumberOfChildren is 0. 808 808 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 809 809 810 810 @retval EFI_SUCCESS The device was stopped. 811 811 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error. … … 869 869 Private->ExtScsiPassThruHandle 870 870 ); 871 871 872 872 gBS->CloseProtocol ( 873 873 Conn->TcpIo.Handle, … … 879 879 return EFI_SUCCESS; 880 880 } 881 881 882 882 // 883 883 // Get the handle of the controller we are controling. … … 919 919 IScsiController 920 920 ); 921 921 922 922 ASSERT (!EFI_ERROR (Status)); 923 923 … … 936 936 ProtocolGuid, 937 937 &Private->IScsiIdentifier 938 ); 938 ); 939 939 940 940 // … … 958 958 959 959 /** 960 Tests to see if this driver supports a given controller. If a child device is provided, 960 Tests to see if this driver supports a given controller. If a child device is provided, 961 961 it tests to see if this driver supports creating a handle for the specified child device. 962 962 963 This function checks to see if the driver specified by This supports the device specified by 964 ControllerHandle. Drivers typically use the device path attached to 965 ControllerHandle and/or the services from the bus I/O abstraction attached to 966 ControllerHandle to determine if the driver supports ControllerHandle. This function 967 may be called many times during platform initialization. In order to reduce boot times, the tests 968 performed by this function must be very small and take as little time as possible to execute. This 969 function must not change the state of any hardware devices, and this function must be aware that the 970 device specified by ControllerHandle may already be managed by the same driver or a 971 different driver. This function must match its calls to AllocatePages() with FreePages(), 972 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). 973 Since ControllerHandle may have been previously started by the same driver, if a protocol is 974 already in the opened state, then it must not be closed with CloseProtocol(). This is required 963 This function checks to see if the driver specified by This supports the device specified by 964 ControllerHandle. Drivers typically use the device path attached to 965 ControllerHandle and/or the services from the bus I/O abstraction attached to 966 ControllerHandle to determine if the driver supports ControllerHandle. This function 967 may be called many times during platform initialization. In order to reduce boot times, the tests 968 performed by this function must be very small and take as little time as possible to execute. This 969 function must not change the state of any hardware devices, and this function must be aware that the 970 device specified by ControllerHandle may already be managed by the same driver or a 971 different driver. This function must match its calls to AllocatePages() with FreePages(), 972 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). 973 Since ControllerHandle may have been previously started by the same driver, if a protocol is 974 already in the opened state, then it must not be closed with CloseProtocol(). This is required 975 975 to guarantee the state of ControllerHandle is not modified by this function. 976 976 977 977 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 978 @param[in] ControllerHandle The handle of the controller to test. This handle 979 must support a protocol interface that supplies 978 @param[in] ControllerHandle The handle of the controller to test. This handle 979 must support a protocol interface that supplies 980 980 an I/O abstraction to the driver. 981 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 982 parameter is ignored by device drivers, and is optional for bus 983 drivers. For bus drivers, if this parameter is not NULL, then 984 the bus driver must determine if the bus controller specified 985 by ControllerHandle and the child controller specified 986 by RemainingDevicePath are both supported by this 981 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 982 parameter is ignored by device drivers, and is optional for bus 983 drivers. For bus drivers, if this parameter is not NULL, then 984 the bus driver must determine if the bus controller specified 985 by ControllerHandle and the child controller specified 986 by RemainingDevicePath are both supported by this 987 987 bus driver. 988 988 … … 1019 1019 1020 1020 The Start() function is designed to be invoked from the EFI boot service ConnectController(). 1021 As a result, much of the error checking on the parameters to Start() has been moved into this 1022 common boot service. It is legal to call Start() from other locations, 1021 As a result, much of the error checking on the parameters to Start() has been moved into this 1022 common boot service. It is legal to call Start() from other locations, 1023 1023 but the following calling restrictions must be followed or the system behavior will not be deterministic. 1024 1024 1. ControllerHandle must be a valid EFI_HANDLE. … … 1026 1026 EFI_DEVICE_PATH_PROTOCOL. 1027 1027 3. Prior to calling Start(), the Supported() function for the driver specified by This must 1028 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. 1028 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. 1029 1029 1030 1030 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 1031 @param[in] ControllerHandle The handle of the controller to start. This handle 1032 must support a protocol interface that supplies 1031 @param[in] ControllerHandle The handle of the controller to start. This handle 1032 must support a protocol interface that supplies 1033 1033 an I/O abstraction to the driver. 1034 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 1035 parameter is ignored by device drivers, and is optional for bus 1036 drivers. For a bus driver, if this parameter is NULL, then handles 1037 for all the children of Controller are created by this driver. 1038 If this parameter is not NULL and the first Device Path Node is 1039 not the End of Device Path Node, then only the handle for the 1040 child device specified by the first Device Path Node of 1034 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 1035 parameter is ignored by device drivers, and is optional for bus 1036 drivers. For a bus driver, if this parameter is NULL, then handles 1037 for all the children of Controller are created by this driver. 1038 If this parameter is not NULL and the first Device Path Node is 1039 not the End of Device Path Node, then only the handle for the 1040 child device specified by the first Device Path Node of 1041 1041 RemainingDevicePath is created by this driver. 1042 If the first Device Path Node of RemainingDevicePath is 1042 If the first Device Path Node of RemainingDevicePath is 1043 1043 the End of Device Path Node, no child handle is created by this 1044 1044 driver. … … 1070 1070 /** 1071 1071 Stops a device controller or a bus controller. 1072 1073 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). 1074 As a result, much of the error checking on the parameters to Stop() has been moved 1075 into this common boot service. It is legal to call Stop() from other locations, 1072 1073 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). 1074 As a result, much of the error checking on the parameters to Stop() has been moved 1075 into this common boot service. It is legal to call Stop() from other locations, 1076 1076 but the following calling restrictions must be followed or the system behavior will not be deterministic. 1077 1077 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this … … 1081 1081 Start() function, and the Start() function must have called OpenProtocol() on 1082 1082 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. 1083 1083 1084 1084 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 1085 @param[in] ControllerHandle A handle to the device being stopped. The handle must 1086 support a bus specific I/O protocol for the driver 1085 @param[in] ControllerHandle A handle to the device being stopped. The handle must 1086 support a bus specific I/O protocol for the driver 1087 1087 to use to stop the device. 1088 1088 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. 1089 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 1089 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 1090 1090 if NumberOfChildren is 0. 1091 1091 … … 1113 1113 1114 1114 /** 1115 Tests to see if this driver supports a given controller. If a child device is provided, 1115 Tests to see if this driver supports a given controller. If a child device is provided, 1116 1116 it tests to see if this driver supports creating a handle for the specified child device. 1117 1117 1118 This function checks to see if the driver specified by This supports the device specified by 1119 ControllerHandle. Drivers typically use the device path attached to 1120 ControllerHandle and/or the services from the bus I/O abstraction attached to 1121 ControllerHandle to determine if the driver supports ControllerHandle. This function 1122 may be called many times during platform initialization. In order to reduce boot times, the tests 1123 performed by this function must be very small and take as little time as possible to execute. This 1124 function must not change the state of any hardware devices, and this function must be aware that the 1125 device specified by ControllerHandle may already be managed by the same driver or a 1126 different driver. This function must match its calls to AllocatePages() with FreePages(), 1127 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). 1128 Since ControllerHandle may have been previously started by the same driver, if a protocol is 1129 already in the opened state, then it must not be closed with CloseProtocol(). This is required 1118 This function checks to see if the driver specified by This supports the device specified by 1119 ControllerHandle. Drivers typically use the device path attached to 1120 ControllerHandle and/or the services from the bus I/O abstraction attached to 1121 ControllerHandle to determine if the driver supports ControllerHandle. This function 1122 may be called many times during platform initialization. In order to reduce boot times, the tests 1123 performed by this function must be very small and take as little time as possible to execute. This 1124 function must not change the state of any hardware devices, and this function must be aware that the 1125 device specified by ControllerHandle may already be managed by the same driver or a 1126 different driver. This function must match its calls to AllocatePages() with FreePages(), 1127 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). 1128 Since ControllerHandle may have been previously started by the same driver, if a protocol is 1129 already in the opened state, then it must not be closed with CloseProtocol(). This is required 1130 1130 to guarantee the state of ControllerHandle is not modified by this function. 1131 1131 1132 1132 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 1133 @param[in] ControllerHandle The handle of the controller to test. This handle 1134 must support a protocol interface that supplies 1133 @param[in] ControllerHandle The handle of the controller to test. This handle 1134 must support a protocol interface that supplies 1135 1135 an I/O abstraction to the driver. 1136 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 1137 parameter is ignored by device drivers, and is optional for bus 1138 drivers. For bus drivers, if this parameter is not NULL, then 1139 the bus driver must determine if the bus controller specified 1140 by ControllerHandle and the child controller specified 1141 by RemainingDevicePath are both supported by this 1136 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 1137 parameter is ignored by device drivers, and is optional for bus 1138 drivers. For bus drivers, if this parameter is not NULL, then 1139 the bus driver must determine if the bus controller specified 1140 by ControllerHandle and the child controller specified 1141 by RemainingDevicePath are both supported by this 1142 1142 bus driver. 1143 1143 … … 1174 1174 1175 1175 The Start() function is designed to be invoked from the EFI boot service ConnectController(). 1176 As a result, much of the error checking on the parameters to Start() has been moved into this 1177 common boot service. It is legal to call Start() from other locations, 1176 As a result, much of the error checking on the parameters to Start() has been moved into this 1177 common boot service. It is legal to call Start() from other locations, 1178 1178 but the following calling restrictions must be followed or the system behavior will not be deterministic. 1179 1179 1. ControllerHandle must be a valid EFI_HANDLE. … … 1181 1181 EFI_DEVICE_PATH_PROTOCOL. 1182 1182 3. Prior to calling Start(), the Supported() function for the driver specified by This must 1183 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. 1183 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. 1184 1184 1185 1185 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 1186 @param[in] ControllerHandle The handle of the controller to start. This handle 1187 must support a protocol interface that supplies 1186 @param[in] ControllerHandle The handle of the controller to start. This handle 1187 must support a protocol interface that supplies 1188 1188 an I/O abstraction to the driver. 1189 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 1190 parameter is ignored by device drivers, and is optional for bus 1191 drivers. For a bus driver, if this parameter is NULL, then handles 1192 for all the children of Controller are created by this driver. 1193 If this parameter is not NULL and the first Device Path Node is 1194 not the End of Device Path Node, then only the handle for the 1195 child device specified by the first Device Path Node of 1189 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 1190 parameter is ignored by device drivers, and is optional for bus 1191 drivers. For a bus driver, if this parameter is NULL, then handles 1192 for all the children of Controller are created by this driver. 1193 If this parameter is not NULL and the first Device Path Node is 1194 not the End of Device Path Node, then only the handle for the 1195 child device specified by the first Device Path Node of 1196 1196 RemainingDevicePath is created by this driver. 1197 If the first Device Path Node of RemainingDevicePath is 1197 If the first Device Path Node of RemainingDevicePath is 1198 1198 the End of Device Path Node, no child handle is created by this 1199 1199 driver. … … 1225 1225 /** 1226 1226 Stops a device controller or a bus controller. 1227 1228 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). 1229 As a result, much of the error checking on the parameters to Stop() has been moved 1230 into this common boot service. It is legal to call Stop() from other locations, 1227 1228 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). 1229 As a result, much of the error checking on the parameters to Stop() has been moved 1230 into this common boot service. It is legal to call Stop() from other locations, 1231 1231 but the following calling restrictions must be followed or the system behavior will not be deterministic. 1232 1232 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this … … 1236 1236 Start() function, and the Start() function must have called OpenProtocol() on 1237 1237 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. 1238 1238 1239 1239 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 1240 @param[in] ControllerHandle A handle to the device being stopped. The handle must 1241 support a bus specific I/O protocol for the driver 1240 @param[in] ControllerHandle A handle to the device being stopped. The handle must 1241 support a bus specific I/O protocol for the driver 1242 1242 to use to stop the device. 1243 1243 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. 1244 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 1244 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 1245 1245 if NumberOfChildren is 0. 1246 1246 … … 1354 1354 goto ON_EXIT; 1355 1355 } 1356 1356 1357 1357 // 1358 1358 // Uninstall the protocols installed by iSCSI driver. … … 1367 1367 goto ON_EXIT; 1368 1368 } 1369 1369 1370 1370 if (gIScsiControllerNameTable!= NULL) { 1371 1371 Status = FreeUnicodeStringTable (gIScsiControllerNameTable); … … 1396 1396 } 1397 1397 } 1398 1398 1399 1399 Status = gBS->HandleProtocol ( 1400 1400 gIScsiIp4DriverBinding.DriverBindingHandle, … … 1434 1434 } 1435 1435 } 1436 1436 1437 1437 Status = gBS->HandleProtocol ( 1438 1438 gIScsiIp6DriverBinding.DriverBindingHandle, … … 1479 1479 FreePool (DeviceHandleBuffer); 1480 1480 } 1481 1481 1482 1482 return Status; 1483 1483 } … … 1487 1487 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including 1488 1488 both device drivers and bus drivers. 1489 1489 1490 1490 The entry point for iSCSI driver which initializes the global variables and 1491 1491 installs the driver binding, component name protocol, iSCSI initiator name 1492 1492 protocol and Authentication Info protocol on its image. 1493 1493 1494 1494 @param[in] ImageHandle The firmware allocated handle for the UEFI image. 1495 1495 @param[in] SystemTable A pointer to the EFI System Table. … … 1548 1548 goto Error1; 1549 1549 } 1550 1550 1551 1551 // 1552 1552 // Install the iSCSI Initiator Name Protocol. … … 1560 1560 if (EFI_ERROR (Status)) { 1561 1561 goto Error2; 1562 } 1562 } 1563 1563 1564 1564 // … … 1600 1600 if (EFI_ERROR (Status)) { 1601 1601 goto Error5; 1602 } 1602 } 1603 1603 } 1604 1604 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiDriver.h
r58459 r58466 84 84 85 85 /** 86 Tests to see if this driver supports a given controller. If a child device is provided, 86 Tests to see if this driver supports a given controller. If a child device is provided, 87 87 it tests to see if this driver supports creating a handle for the specified child device. 88 88 89 This function checks to see if the driver specified by This supports the device specified by 90 ControllerHandle. Drivers typically use the device path attached to 91 ControllerHandle and/or the services from the bus I/O abstraction attached to 92 ControllerHandle to determine if the driver supports ControllerHandle. This function 93 may be called many times during platform initialization. In order to reduce boot times, the tests 94 performed by this function must be very small and take as little time as possible to execute. This 95 function must not change the state of any hardware devices, and this function must be aware that the 96 device specified by ControllerHandle may already be managed by the same driver or a 97 different driver. This function must match its calls to AllocatePages() with FreePages(), 98 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). 99 Since ControllerHandle may have been previously started by the same driver, if a protocol is 100 already in the opened state, then it must not be closed with CloseProtocol(). This is required 89 This function checks to see if the driver specified by This supports the device specified by 90 ControllerHandle. Drivers typically use the device path attached to 91 ControllerHandle and/or the services from the bus I/O abstraction attached to 92 ControllerHandle to determine if the driver supports ControllerHandle. This function 93 may be called many times during platform initialization. In order to reduce boot times, the tests 94 performed by this function must be very small and take as little time as possible to execute. This 95 function must not change the state of any hardware devices, and this function must be aware that the 96 device specified by ControllerHandle may already be managed by the same driver or a 97 different driver. This function must match its calls to AllocatePages() with FreePages(), 98 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). 99 Since ControllerHandle may have been previously started by the same driver, if a protocol is 100 already in the opened state, then it must not be closed with CloseProtocol(). This is required 101 101 to guarantee the state of ControllerHandle is not modified by this function. 102 102 103 103 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 104 @param[in] ControllerHandle The handle of the controller to test. This handle 105 must support a protocol interface that supplies 104 @param[in] ControllerHandle The handle of the controller to test. This handle 105 must support a protocol interface that supplies 106 106 an I/O abstraction to the driver. 107 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 108 parameter is ignored by device drivers, and is optional for bus 109 drivers. For bus drivers, if this parameter is not NULL, then 110 the bus driver must determine if the bus controller specified 111 by ControllerHandle and the child controller specified 112 by RemainingDevicePath are both supported by this 107 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 108 parameter is ignored by device drivers, and is optional for bus 109 drivers. For bus drivers, if this parameter is not NULL, then 110 the bus driver must determine if the bus controller specified 111 by ControllerHandle and the child controller specified 112 by RemainingDevicePath are both supported by this 113 113 bus driver. 114 114 … … 137 137 138 138 The Start() function is designed to be invoked from the EFI boot service ConnectController(). 139 As a result, much of the error checking on the parameters to Start() has been moved into this 140 common boot service. It is legal to call Start() from other locations, 139 As a result, much of the error checking on the parameters to Start() has been moved into this 140 common boot service. It is legal to call Start() from other locations, 141 141 but the following calling restrictions must be followed or the system behavior will not be deterministic. 142 142 1. ControllerHandle must be a valid EFI_HANDLE. … … 144 144 EFI_DEVICE_PATH_PROTOCOL. 145 145 3. Prior to calling Start(), the Supported() function for the driver specified by This must 146 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. 146 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. 147 147 148 148 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 149 @param[in] ControllerHandle The handle of the controller to start. This handle 150 must support a protocol interface that supplies 149 @param[in] ControllerHandle The handle of the controller to start. This handle 150 must support a protocol interface that supplies 151 151 an I/O abstraction to the driver. 152 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 153 parameter is ignored by device drivers, and is optional for bus 154 drivers. For a bus driver, if this parameter is NULL, then handles 155 for all the children of Controller are created by this driver. 156 If this parameter is not NULL and the first Device Path Node is 157 not the End of Device Path Node, then only the handle for the 158 child device specified by the first Device Path Node of 152 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 153 parameter is ignored by device drivers, and is optional for bus 154 drivers. For a bus driver, if this parameter is NULL, then handles 155 for all the children of Controller are created by this driver. 156 If this parameter is not NULL and the first Device Path Node is 157 not the End of Device Path Node, then only the handle for the 158 child device specified by the first Device Path Node of 159 159 RemainingDevicePath is created by this driver. 160 If the first Device Path Node of RemainingDevicePath is 160 If the first Device Path Node of RemainingDevicePath is 161 161 the End of Device Path Node, no child handle is created by this 162 162 driver. … … 178 178 /** 179 179 Stops a device controller or a bus controller. 180 181 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). 182 As a result, much of the error checking on the parameters to Stop() has been moved 183 into this common boot service. It is legal to call Stop() from other locations, 180 181 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). 182 As a result, much of the error checking on the parameters to Stop() has been moved 183 into this common boot service. It is legal to call Stop() from other locations, 184 184 but the following calling restrictions must be followed or the system behavior will not be deterministic. 185 185 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this … … 189 189 Start() function, and the Start() function must have called OpenProtocol() on 190 190 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. 191 191 192 192 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 193 @param[in] ControllerHandle A handle to the device being stopped. The handle must 194 support a bus specific I/O protocol for the driver 193 @param[in] ControllerHandle A handle to the device being stopped. The handle must 194 support a bus specific I/O protocol for the driver 195 195 to use to stop the device. 196 196 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. 197 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 197 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 198 198 if NumberOfChildren is 0. 199 199 … … 212 212 213 213 /** 214 Tests to see if this driver supports a given controller. If a child device is provided, 214 Tests to see if this driver supports a given controller. If a child device is provided, 215 215 it tests to see if this driver supports creating a handle for the specified child device. 216 216 217 This function checks to see if the driver specified by This supports the device specified by 218 ControllerHandle. Drivers typically use the device path attached to 219 ControllerHandle and/or the services from the bus I/O abstraction attached to 220 ControllerHandle to determine if the driver supports ControllerHandle. This function 221 may be called many times during platform initialization. In order to reduce boot times, the tests 222 performed by this function must be very small and take as little time as possible to execute. This 223 function must not change the state of any hardware devices, and this function must be aware that the 224 device specified by ControllerHandle may already be managed by the same driver or a 225 different driver. This function must match its calls to AllocatePages() with FreePages(), 226 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). 227 Since ControllerHandle may have been previously started by the same driver, if a protocol is 228 already in the opened state, then it must not be closed with CloseProtocol(). This is required 217 This function checks to see if the driver specified by This supports the device specified by 218 ControllerHandle. Drivers typically use the device path attached to 219 ControllerHandle and/or the services from the bus I/O abstraction attached to 220 ControllerHandle to determine if the driver supports ControllerHandle. This function 221 may be called many times during platform initialization. In order to reduce boot times, the tests 222 performed by this function must be very small and take as little time as possible to execute. This 223 function must not change the state of any hardware devices, and this function must be aware that the 224 device specified by ControllerHandle may already be managed by the same driver or a 225 different driver. This function must match its calls to AllocatePages() with FreePages(), 226 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). 227 Since ControllerHandle may have been previously started by the same driver, if a protocol is 228 already in the opened state, then it must not be closed with CloseProtocol(). This is required 229 229 to guarantee the state of ControllerHandle is not modified by this function. 230 230 231 231 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 232 @param[in] ControllerHandle The handle of the controller to test. This handle 233 must support a protocol interface that supplies 232 @param[in] ControllerHandle The handle of the controller to test. This handle 233 must support a protocol interface that supplies 234 234 an I/O abstraction to the driver. 235 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 236 parameter is ignored by device drivers, and is optional for bus 237 drivers. For bus drivers, if this parameter is not NULL, then 238 the bus driver must determine if the bus controller specified 239 by ControllerHandle and the child controller specified 240 by RemainingDevicePath are both supported by this 235 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 236 parameter is ignored by device drivers, and is optional for bus 237 drivers. For bus drivers, if this parameter is not NULL, then 238 the bus driver must determine if the bus controller specified 239 by ControllerHandle and the child controller specified 240 by RemainingDevicePath are both supported by this 241 241 bus driver. 242 242 … … 265 265 266 266 The Start() function is designed to be invoked from the EFI boot service ConnectController(). 267 As a result, much of the error checking on the parameters to Start() has been moved into this 268 common boot service. It is legal to call Start() from other locations, 267 As a result, much of the error checking on the parameters to Start() has been moved into this 268 common boot service. It is legal to call Start() from other locations, 269 269 but the following calling restrictions must be followed or the system behavior will not be deterministic. 270 270 1. ControllerHandle must be a valid EFI_HANDLE. … … 272 272 EFI_DEVICE_PATH_PROTOCOL. 273 273 3. Prior to calling Start(), the Supported() function for the driver specified by This must 274 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. 274 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. 275 275 276 276 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 277 @param[in] ControllerHandle The handle of the controller to start. This handle 278 must support a protocol interface that supplies 277 @param[in] ControllerHandle The handle of the controller to start. This handle 278 must support a protocol interface that supplies 279 279 an I/O abstraction to the driver. 280 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 281 parameter is ignored by device drivers, and is optional for bus 282 drivers. For a bus driver, if this parameter is NULL, then handles 283 for all the children of Controller are created by this driver. 284 If this parameter is not NULL and the first Device Path Node is 285 not the End of Device Path Node, then only the handle for the 286 child device specified by the first Device Path Node of 280 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 281 parameter is ignored by device drivers, and is optional for bus 282 drivers. For a bus driver, if this parameter is NULL, then handles 283 for all the children of Controller are created by this driver. 284 If this parameter is not NULL and the first Device Path Node is 285 not the End of Device Path Node, then only the handle for the 286 child device specified by the first Device Path Node of 287 287 RemainingDevicePath is created by this driver. 288 If the first Device Path Node of RemainingDevicePath is 288 If the first Device Path Node of RemainingDevicePath is 289 289 the End of Device Path Node, no child handle is created by this 290 290 driver. … … 306 306 /** 307 307 Stops a device controller or a bus controller. 308 309 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). 310 As a result, much of the error checking on the parameters to Stop() has been moved 311 into this common boot service. It is legal to call Stop() from other locations, 308 309 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). 310 As a result, much of the error checking on the parameters to Stop() has been moved 311 into this common boot service. It is legal to call Stop() from other locations, 312 312 but the following calling restrictions must be followed or the system behavior will not be deterministic. 313 313 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this … … 317 317 Start() function, and the Start() function must have called OpenProtocol() on 318 318 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. 319 319 320 320 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 321 @param[in] ControllerHandle A handle to the device being stopped. The handle must 322 support a bus specific I/O protocol for the driver 321 @param[in] ControllerHandle A handle to the device being stopped. The handle must 322 support a bus specific I/O protocol for the driver 323 323 to use to stop the device. 324 324 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. 325 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 325 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 326 326 if NumberOfChildren is 0. 327 327 … … 425 425 requesting, and it must match one of the 426 426 languages specified in SupportedLanguages. The 427 number of languages supported by a driver is 428 determined by the driver writer. Language is 429 specified inRFC 4646 or ISO 639-2 language code 427 number of languages supported by a driver is 428 determined by the driver writer. Language is 429 specified inRFC 4646 or ISO 639-2 language code 430 430 format. 431 431 432 432 @param[out] ControllerName A pointer to the Unicode string to return. 433 433 This Unicode string is the name of the … … 588 588 Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. 589 589 This function supports both blocking I/O and nonblocking I/O. The blocking I/O 590 functionality is required, and the nonblocking I/O functionality is optional. 590 functionality is required, and the nonblocking I/O functionality is optional. 591 591 592 592 @param[in] This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. … … 595 595 Request Packet. Each transport driver may choose to 596 596 utilize a subset of this size to suit the needs 597 of transport target representation. For example, a 597 of transport target representation. For example, a 598 598 Fibre Channel driver may use only 8 bytes (WWN) 599 599 to represent an FC target. 600 600 @param[in] Lun The LUN of the SCSI device to send the SCSI Request Packet. 601 601 @param[in, out] Packet A pointer to the SCSI Request Packet to send to the 602 SCSI device specified by Target and Lun. 602 SCSI device specified by Target and Lun. 603 603 @param[in] Event If nonblocking I/O is not supported then Event is ignored, 604 604 and blocking I/O is performed. If Event is NULL, then … … 609 609 610 610 @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For 611 bi-directional commands, InTransferLength bytes 611 bi-directional commands, InTransferLength bytes 612 612 were transferred from InDataBuffer. 613 613 For write and bi-directional commands, OutTransferLength … … 622 622 queued. The caller may retry later. 623 623 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send 624 the SCSI Request Packet. 624 the SCSI Request Packet. 625 625 @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket 626 626 are invalid. … … 649 649 a SCSI channel. These can either be the list SCSI devices that are actually 650 650 present on the SCSI channel, or the list of legal Target Ids and LUNs for the 651 SCSI channel. Regardless, the caller of this function must probe the Target ID 652 and LUN returned to see if a SCSI device is actually present at that location 653 on the SCSI channel. 651 SCSI channel. Regardless, the caller of this function must probe the Target ID 652 and LUN returned to see if a SCSI device is actually present at that location 653 on the SCSI channel. 654 654 655 655 @param[in] This The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. … … 781 781 782 782 /** 783 Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. 783 Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. 784 784 785 785 @param[in] This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL … … 791 791 An input value of 0xF(all bytes in the array are 0xF) 792 792 in the Target array retrieves the Target ID of the 793 first SCSI device present on a SCSI channel. 793 first SCSI device present on a SCSI channel. 794 794 795 795 @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiDxe.inf
r58459 r58466 4 4 # The iSCSI driver provides iSCSI service in the preboot environment and supports 5 5 # booting over iSCSI. 6 # 6 # 7 7 # Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> 8 8 # This program and the accompanying materials … … 56 56 IScsiIbft.c 57 57 IScsiIbft.h 58 IScsiInitiatorName.c 58 IScsiInitiatorName.c 59 59 IScsiImpl.h 60 60 IScsiMisc.c … … 81 81 UefiBootServicesTableLib 82 82 UefiDriverEntryPoint 83 UefiLib 83 UefiLib 84 84 UefiRuntimeServicesTableLib 85 85 UefiHiiServicesLib … … 91 91 gEfiPciIoProtocolGuid ## SOMETIMES_CONSUMES 92 92 gEfiDhcp4ProtocolGuid ## TO_START 93 gEfiDhcp6ProtocolGuid ## TO_START 93 gEfiDhcp6ProtocolGuid ## TO_START 94 94 gEfiDhcp4ServiceBindingProtocolGuid ## TO_START 95 gEfiDhcp6ServiceBindingProtocolGuid ## TO_START 95 gEfiDhcp6ServiceBindingProtocolGuid ## TO_START 96 96 gEfiTcp4ProtocolGuid ## TO_START 97 gEfiTcp6ProtocolGuid ## TO_START 97 gEfiTcp6ProtocolGuid ## TO_START 98 98 gEfiTcp4ServiceBindingProtocolGuid ## TO_START 99 gEfiTcp6ServiceBindingProtocolGuid ## TO_START 99 gEfiTcp6ServiceBindingProtocolGuid ## TO_START 100 100 gEfiExtScsiPassThruProtocolGuid ## BY_START 101 101 gEfiHiiConfigAccessProtocolGuid ## PRODUCES … … 106 106 ## UNDEFINED # Variable 107 107 gEfiIScsiInitiatorNameProtocolGuid 108 ## PRODUCES 109 gEfiAuthenticationInfoProtocolGuid 108 ## PRODUCES 109 gEfiAuthenticationInfoProtocolGuid 110 110 111 111 [Guids] … … 115 115 gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES ## SystemTable 116 116 gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES ## SystemTable 117 117 118 118 ## SOMETIMES_PRODUCES ## Variable:L"AttemptOrder" 119 119 ## SOMETIMES_CONSUMES ## Variable:L"AttemptOrder" … … 124 124 ## SOMETIMES_CONSUMES ## HII 125 125 gIScsiConfigGuid 126 126 127 127 [UserExtensions.TianoCore."ExtraFiles"] 128 128 IScsiDxeExtra.uni -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiExtScsiPassThru.c
r58459 r58466 30 30 Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. 31 31 This function supports both blocking I/O and nonblocking I/O. The blocking I/O 32 functionality is required, and the nonblocking I/O functionality is optional. 32 functionality is required, and the nonblocking I/O functionality is optional. 33 33 34 34 @param[in] This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. … … 37 37 Request Packet. Each transport driver may choose to 38 38 utilize a subset of this size to suit the needs 39 of transport target representation. For example, a 39 of transport target representation. For example, a 40 40 Fibre Channel driver may use only 8 bytes (WWN) 41 41 to represent an FC target. 42 42 @param[in] Lun The LUN of the SCSI device to send the SCSI Request Packet. 43 43 @param[in, out] Packet A pointer to the SCSI Request Packet to send to the 44 SCSI device specified by Target and Lun. 44 SCSI device specified by Target and Lun. 45 45 @param[in] Event If nonblocking I/O is not supported then Event is ignored, 46 46 and blocking I/O is performed. If Event is NULL, then … … 51 51 52 52 @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For 53 bi-directional commands, InTransferLength bytes 53 bi-directional commands, InTransferLength bytes 54 54 were transferred from InDataBuffer. 55 55 For write and bi-directional commands, OutTransferLength … … 64 64 queued. The caller may retry later. 65 65 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send 66 the SCSI Request Packet. 66 the SCSI Request Packet. 67 67 @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket, 68 68 are invalid. … … 89 89 EFI_STATUS Status; 90 90 ISCSI_DRIVER_DATA *Private; 91 91 92 92 if (Target[0] != 0) { 93 93 return EFI_INVALID_PARAMETER; … … 119 119 a SCSI channel. These can either be the list SCSI devices that are actually 120 120 present on the SCSI channel, or the list of legal Target Ids and LUNs for the 121 SCSI channel. Regardless, the caller of this function must probe the Target ID 122 and LUN returned to see if a SCSI device is actually present at that location 123 on the SCSI channel. 121 SCSI channel. Regardless, the caller of this function must probe the Target ID 122 and LUN returned to see if a SCSI device is actually present at that location 123 on the SCSI channel. 124 124 125 125 @param[in] This The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. … … 299 299 @retval EFI_UNSUPPORTED This driver does not support the device path node 300 300 type in DevicePath. 301 @retval EFI_NOT_FOUND A valid translation does not exist from DevicePath 301 @retval EFI_NOT_FOUND A valid translation does not exist from DevicePath 302 302 to a TargetID and LUN. 303 303 … … 383 383 384 384 /** 385 Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. 385 Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. 386 386 387 387 @param[in] This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL … … 393 393 An input value of 0xF(all bytes in the array are 0xF) 394 394 in the Target array retrieves the Target ID of the 395 first SCSI device present on a SCSI channel. 395 first SCSI device present on a SCSI channel. 396 396 397 397 @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiIbft.c
r58459 r58466 20 20 /** 21 21 Initialize the header of the iSCSI Boot Firmware Table. 22 22 23 23 @param[out] Header The header of the iSCSI Boot Firmware Table. 24 24 @param[in] OemId The OEM ID. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiIbft.h
r48674 r58466 17 17 18 18 #include <IndustryStandard/Acpi.h> 19 #include <IndustryStandard/IScsiBootFirmwareTable.h> 19 #include <IndustryStandard/IScsiBootFirmwareTable.h> 20 20 #include <Protocol/AcpiTable.h> 21 21 #include <Protocol/PciIo.h> -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiImpl.h
r58459 r58466 192 192 EFI_HANDLE ExtScsiPassThruHandle; 193 193 EFI_DEVICE_PATH_PROTOCOL *DevicePath; 194 EFI_HANDLE ChildHandle; 194 EFI_HANDLE ChildHandle; 195 195 ISCSI_SESSION *Session; 196 196 }; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiMisc.c
r58459 r58466 21 21 22 22 @param[in, out] Str Pointer to the null-terminated string to be trimmed. 23 On return, Str will hold the trimmed string. 23 On return, Str will hold the trimmed string. 24 24 25 25 @param[in] CharC Character will be trimmed from str. … … 34 34 CHAR16 *Pointer1; 35 35 CHAR16 *Pointer2; 36 36 37 37 if (*Str == 0) { 38 38 return ; 39 39 } 40 40 41 41 // 42 42 // Trim off the leading and trailing characters c … … 45 45 ; 46 46 } 47 47 48 48 Pointer2 = Str; 49 49 if (Pointer2 == Pointer1) { … … 53 53 } 54 54 } else { 55 while (*Pointer1 != 0) { 56 *Pointer2 = *Pointer1; 55 while (*Pointer1 != 0) { 56 *Pointer2 = *Pointer1; 57 57 Pointer1++; 58 58 Pointer2++; … … 60 60 *Pointer2 = 0; 61 61 } 62 63 62 63 64 64 for (Pointer1 = Str + StrLen(Str) - 1; Pointer1 >= Str && *Pointer1 == CharC; Pointer1--) { 65 65 ; 66 66 } 67 if (Pointer1 != Str + StrLen(Str) - 1) { 67 if (Pointer1 != Str + StrLen(Str) - 1) { 68 68 *(Pointer1 + 1) = 0; 69 69 } … … 132 132 UINT8 TemValue; 133 133 UINT16 Value[4]; 134 134 135 135 ZeroMem (Lun, 8); 136 136 ZeroMem (TemStr, 2); 137 137 ZeroMem ((UINT8 *) Value, sizeof (Value)); 138 SizeStr = AsciiStrLen (Str); 138 SizeStr = AsciiStrLen (Str); 139 139 IndexValue = 0; 140 140 IndexNum = 0; … … 151 151 } 152 152 } 153 153 154 154 if ((TemValue == 0) && (TemStr[0] == '-')) { 155 155 // … … 168 168 continue; 169 169 } 170 170 171 171 if (++IndexNum > 4) { 172 // 172 // 173 173 // Each Lun Str can't exceed size 4, because it will be as UINT16 value. 174 174 // 175 175 return EFI_INVALID_PARAMETER; 176 176 } 177 177 178 178 // 179 179 // Combine UINT16 value. … … 181 181 Value[IndexValue] = (UINT16) ((Value[IndexValue] << 4) + TemValue); 182 182 } 183 183 184 184 for (Index = 0; Index <= IndexValue; Index ++) { 185 185 *((UINT16 *) &Lun[Index * 2]) = HTONS (Value[Index]); 186 186 } 187 187 188 188 return EFI_SUCCESS; 189 189 } … … 320 320 @param[in, out] HexLength The length of the string. 321 321 322 @retval EFI_SUCCESS The binary data is converted to the hexadecimal string 322 @retval EFI_SUCCESS The binary data is converted to the hexadecimal string 323 323 and the length of the string is updated. 324 324 @retval EFI_BUFFER_TOO_SMALL The string is too small. … … 386 386 UINT8 Digit; 387 387 CHAR8 TemStr[2]; 388 388 389 389 ZeroMem (TemStr, sizeof (TemStr)); 390 390 … … 395 395 HexStr += 2; 396 396 } 397 397 398 398 Length = AsciiStrLen (HexStr); 399 399 … … 413 413 } 414 414 } 415 415 416 416 *BinLength = (UINT32) ((Index + 1)/2); 417 417 … … 899 899 @param[in] Controller The handle of the controller. 900 900 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 901 901 902 902 @retval TRUE The handle of the controller need the Dhcp protocol. 903 903 @retval FALSE The handle of the controller does not need the Dhcp protocol. 904 904 905 905 **/ 906 906 BOOLEAN … … 920 920 CHAR16 MacString[ISCSI_MAX_MAC_STRING_LEN]; 921 921 CHAR16 AttemptName[ISCSI_NAME_IFR_MAX_SIZE]; 922 922 923 923 AttemptConfigOrder = IScsiGetVariableAndSize ( 924 924 L"AttemptOrder", … … 929 929 return FALSE; 930 930 } 931 931 932 932 // 933 933 // Get MAC address of this network device. … … 942 942 VlanId = NetLibGetVlanId (Controller); 943 943 IScsiMacAddrToStr (&MacAddr, (UINT32) HwAddressSize, VlanId, MacString); 944 944 945 945 for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) { 946 946 UnicodeSPrint ( … … 960 960 continue; 961 961 } 962 962 963 963 ASSERT (AttemptConfigOrder[Index] == AttemptTmp->AttemptConfigIndex); 964 964 … … 968 968 } 969 969 970 if (AttemptTmp->SessionConfigData.IpMode != IP_MODE_AUTOCONFIG && 970 if (AttemptTmp->SessionConfigData.IpMode != IP_MODE_AUTOCONFIG && 971 971 AttemptTmp->SessionConfigData.IpMode != ((IpVersion == IP_VERSION_4) ? IP_MODE_IP4 : IP_MODE_IP6)) { 972 972 FreePool (AttemptTmp); 973 973 continue; 974 974 } 975 975 976 976 if(AttemptTmp->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG || 977 977 AttemptTmp->SessionConfigData.InitiatorInfoFromDhcp == TRUE || 978 AttemptTmp->SessionConfigData.TargetInfoFromDhcp == TRUE) { 978 AttemptTmp->SessionConfigData.TargetInfoFromDhcp == TRUE) { 979 979 FreePool (AttemptTmp); 980 980 FreePool (AttemptConfigOrder); … … 984 984 FreePool (AttemptTmp); 985 985 } 986 986 987 987 FreePool (AttemptConfigOrder); 988 988 return FALSE; … … 1047 1047 // Check whether the attempt exists in AttemptConfig. 1048 1048 // 1049 AttemptTmp = IScsiConfigGetAttemptByConfigIndex (AttemptConfigOrder[Index]); 1049 AttemptTmp = IScsiConfigGetAttemptByConfigIndex (AttemptConfigOrder[Index]); 1050 1050 if (AttemptTmp != NULL && AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED) { 1051 1051 continue; … … 1199 1199 (UINT8) (mPrivate->Ipv6Flag ? IP_MODE_AUTOCONFIG_IP6 : IP_MODE_AUTOCONFIG_IP4); 1200 1200 } 1201 1201 1202 1202 // 1203 1203 // Get some information from dhcp server. … … 1369 1369 &gEfiDevicePathProtocolGuid, 1370 1370 (VOID **) &DevicePath 1371 ); 1371 ); 1372 1372 if (EFI_ERROR (Status)) { 1373 1373 return NULL; … … 1388 1388 DPathNode->Ipv4.LocalPort = 0; 1389 1389 1390 DPathNode->Ipv4.StaticIpAddress = 1390 DPathNode->Ipv4.StaticIpAddress = 1391 1391 (BOOLEAN) (!Session->ConfigData->SessionConfigData.InitiatorInfoFromDhcp); 1392 1392 … … 1448 1448 is performed by evaluating if the the protocol specified by ProtocolGuid is 1449 1449 present on ControllerHandle and is was opened by DriverBindingHandle and Nic 1450 Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. 1450 Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. 1451 1451 If ProtocolGuid is NULL, then ASSERT(). 1452 1452 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiMisc.h
r58459 r58466 56 56 57 57 /** 58 Convert the hexadecimal encoded LUN string into the 64-bit LUN. 58 Convert the hexadecimal encoded LUN string into the 64-bit LUN. 59 59 60 60 @param[in] Str The hexadecimal encoded LUN string. … … 128 128 @param[in, out] HexLength The length of the string. 129 129 130 @retval EFI_SUCCESS The binary data is converted to the hexadecimal string 130 @retval EFI_SUCCESS The binary data is converted to the hexadecimal string 131 131 and the length of the string is updated. 132 132 @retval EFI_BUFFER_TOO_SMALL The string is too small. … … 304 304 @param[in] Controller The handle of the controller. 305 305 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 306 306 307 307 @retval TRUE The handle of the controller need the Dhcp protocol. 308 308 @retval FALSE The handle of the controller does not need the Dhcp protocol. 309 309 310 310 **/ 311 311 BOOLEAN … … 365 365 is performed by evaluating if the the protocol specified by ProtocolGuid is 366 366 present on ControllerHandle and is was opened by DriverBindingHandle and Nic 367 Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. 367 Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. 368 368 If ProtocolGuid is NULL, then ASSERT(). 369 369 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiProto.c
r58459 r58466 18 18 19 19 /** 20 Attach the iSCSI connection to the iSCSI session. 20 Attach the iSCSI connection to the iSCSI session. 21 21 22 22 @param[in, out] Session The iSCSI session. … … 36 36 37 37 /** 38 Detach the iSCSI connection from the session it belongs to. 38 Detach the iSCSI connection from the session it belongs to. 39 39 40 40 @param[in, out] Conn The iSCSI connection. … … 53 53 54 54 /** 55 Check the sequence number according to RFC3720. 55 Check the sequence number according to RFC3720. 56 56 57 57 @param[in, out] ExpSN The currently expected sequence number. … … 125 125 @retval EFI_SUCCESS The iSCSI connection is logged into the iSCSI target. 126 126 @retval EFI_TIMEOUT Timeout occurred during the login procedure. 127 @retval Others Other errors as indicated. 127 @retval Others Other errors as indicated. 128 128 129 129 **/ … … 254 254 if (!Conn->Ipv6Flag) { 255 255 Tcp4IoConfig = &TcpIoConfig.Tcp4IoConfigData; 256 256 257 257 CopyMem (&Tcp4IoConfig->LocalIp, &NvData->LocalIp, sizeof (EFI_IPv4_ADDRESS)); 258 258 CopyMem (&Tcp4IoConfig->SubnetMask, &NvData->SubnetMask, sizeof (EFI_IPv4_ADDRESS)); … … 265 265 } else { 266 266 Tcp6IoConfig = &TcpIoConfig.Tcp6IoConfigData; 267 267 268 268 CopyMem (&Tcp6IoConfig->RemoteIp, &NvData->TargetIp, sizeof (EFI_IPv6_ADDRESS)); 269 269 Tcp6IoConfig->RemotePort = NvData->TargetPort; … … 318 318 @retval EFI_SUCCESS Get the NIC information successfully. 319 319 @retval Others Other errors as indicated. 320 320 321 321 **/ 322 322 EFI_STATUS … … 474 474 475 475 if (!Conn->Ipv6Flag) { 476 ProtocolGuid = &gEfiTcp4ProtocolGuid; 476 ProtocolGuid = &gEfiTcp4ProtocolGuid; 477 477 } else { 478 478 ProtocolGuid = &gEfiTcp6ProtocolGuid; … … 485 485 Session->Private->Image, 486 486 Session->Private->ExtScsiPassThruHandle, 487 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 487 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 488 488 ); 489 489 … … 592 592 593 593 @param[in] Conn The connection in the iSCSI login phase. 594 594 595 595 @retval EFI_SUCCESS The iSCSI login response PDU is received and processed. 596 596 @retval Others Other errors as indicated. … … 770 770 // 771 771 // Both none authentication and CHAP authentication share the CHAP path. 772 // 772 // 773 773 // 774 774 if (Session->AuthType != ISCSI_AUTH_TYPE_KRB) { … … 785 785 IScsiFillOpParams (Conn, Nbuf); 786 786 } 787 787 788 788 ISCSI_SET_FLAG (LoginReq, ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT); 789 789 break; … … 941 941 // 942 942 if ((Session->State == SESSION_STATE_FREE) && (Session->CmdSN != LoginRsp->ExpCmdSN)) { 943 return EFI_PROTOCOL_ERROR; 943 return EFI_PROTOCOL_ERROR; 944 944 } 945 945 … … 1049 1049 TargetAddress key-value list. 1050 1050 @param[in] Len Length of the data. 1051 1051 1052 1052 @retval EFI_SUCCESS The target address is updated. 1053 1053 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. … … 1283 1283 case ISCSI_OPCODE_SCSI_DATA_IN: 1284 1284 // 1285 // To reduce memory copy overhead, try to use the buffer described by Context 1285 // To reduce memory copy overhead, try to use the buffer described by Context 1286 1286 // if the PDU is an iSCSI SCSI data. 1287 1287 // … … 1631 1631 IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_TARGET_PORTAL_GROUP_TAG); 1632 1632 1633 1633 1634 1634 // 1635 1635 // Remove the key-value that may not needed for result function is OR. … … 2146 2146 NetbufFree (PduHeader); 2147 2147 return NULL; 2148 } 2148 } 2149 2149 Header = (ISCSI_ADDITIONAL_HEADER *) (ScsiCmd + 1); 2150 2150 … … 2817 2817 @param[in, out] Packet The request packet containing IO request, SCSI command 2818 2818 buffer and buffers to read/write. 2819 2820 @retval EFI_SUCCES The SCSI command is executed and the result is updated to 2819 2820 @retval EFI_SUCCES The SCSI command is executed and the result is updated to 2821 2821 the Packet. 2822 2822 @retval EFI_DEVICE_ERROR Session state was not as required. … … 3112 3112 ProtocolGuid = &gEfiTcp4ProtocolGuid; 3113 3113 } else { 3114 ProtocolGuid = &gEfiTcp6ProtocolGuid; 3114 ProtocolGuid = &gEfiTcp6ProtocolGuid; 3115 3115 } 3116 3116 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe/IScsiProto.h
r58459 r58466 622 622 623 623 /** 624 Attach the iSCSI connection to the iSCSI session. 624 Attach the iSCSI connection to the iSCSI session. 625 625 626 626 @param[in, out] Session The iSCSI session. … … 635 635 636 636 /** 637 Detach the iSCSI connection from the session it belongs to. 637 Detach the iSCSI connection from the session it belongs to. 638 638 639 639 @param[in, out] Conn The iSCSI connection. … … 653 653 @retval EFI_SUCCESS The iSCSI connection is logged into the iSCSI target. 654 654 @retval EFI_TIMEOUT Timeout occurred during the login procedure. 655 @retval Others Other errors as indicated. 655 @retval Others Other errors as indicated. 656 656 657 657 **/ … … 738 738 739 739 @param[in] Conn The connection in the iSCSI login phase. 740 740 741 741 @retval EFI_SUCCESS The iSCSI login response PDU is received and processed. 742 742 @retval Others Other errors as indicated. … … 810 810 TargetAddress key-value list. 811 811 @param[in] Len Length of the data. 812 812 813 813 @retval EFI_SUCCESS The target address is updated. 814 814 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. … … 978 978 @param[in, out] Packet The request packet containing IO request, SCSI command 979 979 buffer and buffers to read/write. 980 981 @retval EFI_SUCCES The SCSI command is executed and the result is updated to 980 981 @retval EFI_SUCCES The SCSI command is executed and the result is updated to 982 982 the Packet. 983 983 @retval EFI_DEVICE_ERROR Session state was not as required. … … 1021 1021 IN BOOLEAN Recovery 1022 1022 ); 1023 1023 1024 1024 /** 1025 1025 Abort the iSCSI session, that is, reset all the connection and free the -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Include/Guid/IScsiConfigHii.h
r48674 r58466 1 1 /** @file 2 GUIDs used as HII FormSet and HII Package list GUID in IScsiConfig driver 3 that supports IP4 and IP6 both. 4 2 GUIDs used as HII FormSet and HII Package list GUID in IScsiConfig driver 3 that supports IP4 and IP6 both. 4 5 5 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials are licensed and made available under 7 the terms and conditions of the BSD License that accompanies this distribution. 6 This program and the accompanying materials are licensed and made available under 7 the terms and conditions of the BSD License that accompanies this distribution. 8 8 The full text of the license may be found at 9 http://opensource.org/licenses/bsd-license.php. 9 http://opensource.org/licenses/bsd-license.php. 10 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Include/Guid/Ip6ConfigHii.h
r48674 r58466 1 1 /** @file 2 GUIDs used as HII FormSet and HII Package list GUID in Ip6Config driver. 3 2 GUIDs used as HII FormSet and HII Package list GUID in Ip6Config driver. 3 4 4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 5 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 7 7 The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php. 8 http://opensource.org/licenses/bsd-license.php. 9 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 12 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/ComponentName.c
r58459 r58466 239 239 @param Ip6[in] A pointer to the EFI_IP6_PROTOCOL. 240 240 241 241 242 242 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 243 243 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 244 244 245 245 **/ 246 246 EFI_STATUS … … 295 295 gIp6ControllerNameTable = NULL; 296 296 } 297 297 298 298 Status = AddUnicodeString2 ( 299 299 "eng", … … 306 306 return Status; 307 307 } 308 308 309 309 return AddUnicodeString2 ( 310 310 "en", … … 396 396 EFI_STATUS Status; 397 397 EFI_IP6_PROTOCOL *Ip6; 398 398 399 399 // 400 400 // Only provide names for child handles. … … 405 405 406 406 // 407 // Make sure this driver produced ChildHandle 407 // Make sure this driver produced ChildHandle 408 408 // 409 409 Status = EfiTestChildHandle ( -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Common.c
r58459 r58466 331 331 /** 332 332 Callback function which provided by user to remove one node in NetDestroyLinkList process. 333 333 334 334 @param[in] Entry The entry to be removed. 335 335 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList. … … 349 349 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 350 350 EFI_IPv6_ADDRESS *Address; 351 351 352 352 Instance = NET_LIST_USER_STRUCT_S (Entry, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE); 353 353 ServiceBinding = ((IP6_DESTROY_CHILD_BY_ADDR_CALLBACK_CONTEXT*) Context)->ServiceBinding; … … 357 357 return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); 358 358 } 359 359 360 360 return EFI_SUCCESS; 361 361 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Config.vfr
-
Property svn:eol-style
set to
native
-
Property svn:eol-style
set to
-
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.h
r58459 r58466 73 73 @retval EFI_SUCCESS The specified configuration data for the EFI IPv6 74 74 network stack was set successfully. 75 75 76 76 **/ 77 77 typedef … … 90 90 bytes, the size of buffer required to store the specified 91 91 configuration data. 92 @param[in] Data The data buffer in which the configuration data is returned. 92 @param[in] Data The data buffer in which the configuration data is returned. 93 93 Ignored if DataSize is ZERO. 94 94 95 95 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified 96 configuration data, and the required size is 96 configuration data, and the required size is 97 97 returned in DataSize. 98 @retval EFI_SUCCESS The specified configuration data was obtained successfully. 99 98 @retval EFI_SUCCESS The specified configuration data was obtained successfully. 99 100 100 **/ 101 101 typedef … … 165 165 166 166 typedef struct { 167 EFI_IP6_CONFIG_POLICY Policy; ///< manual or automatic 167 EFI_IP6_CONFIG_POLICY Policy; ///< manual or automatic 168 168 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadTransmitCount; ///< dad transmits count 169 EFI_IP6_CONFIG_INTERFACE_ID InterfaceId; ///< alternative interface id 169 EFI_IP6_CONFIG_INTERFACE_ID InterfaceId; ///< alternative interface id 170 170 LIST_ENTRY ManualAddress; ///< IP addresses 171 171 UINT32 ManualAddressCount; ///< IP addresses count … … 219 219 The event process routine when the DHCPv6 server is answered with a reply packet 220 220 for an information request. 221 221 222 222 @param[in] This Points to the EFI_DHCP6_PROTOCOL. 223 223 @param[in] Context The pointer to the IP6 configuration instance data. … … 225 225 226 226 @retval EFI_SUCCESS The DNS server address was retrieved from the reply packet. 227 @retval EFI_NOT_READY The reply packet does not contain the DNS server option, or 227 @retval EFI_NOT_READY The reply packet does not contain the DNS server option, or 228 228 the DNS server address is not valid. 229 229 … … 239 239 /** 240 240 The work function to trigger the DHCPv6 process to perform a stateful autoconfiguration. 241 241 242 242 @param[in] Instance Pointer to the IP6 config instance data. 243 243 @param[in] OtherInfoOnly If FALSE, get stateful address and other information … … 258 258 259 259 @param[out] Instance The buffer of IP6_CONFIG_INSTANCE to be initialized. 260 260 261 261 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to complete the operation. 262 262 @retval EFI_SUCCESS The IP6_CONFIG_INSTANCE initialized successfully. 263 263 264 264 **/ 265 265 EFI_STATUS … … 272 272 273 273 @param[in, out] Instance The buffer of IP6_CONFIG_INSTANCE to be freed. 274 274 275 275 **/ 276 276 VOID … … 286 286 @retval EFI_SUCCESS The child was successfully destroyed. 287 287 @retval Others Failed to destroy the child. 288 288 289 289 **/ 290 290 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c
r58459 r58466 995 995 /** 996 996 Convert IFR data into IP6 configuration data. The policy, alternative interface 997 ID, and DAD transmit counts, and will be saved. 997 ID, and DAD transmit counts, and will be saved. 998 998 999 999 @param[in] IfrNvData The IFR NV data. … … 1542 1542 CHAR16 PortString[ADDRESS_STR_MAX_SIZE]; 1543 1543 EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo; 1544 1544 1545 1545 1546 1546 Ip6Config = &Instance->Ip6Config; … … 1795 1795 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; 1796 1796 break; 1797 1797 1798 1798 case KEY_INTERFACE_ID: 1799 1799 Status = Ip6ParseInterfaceIdFromString (IfrNvData->InterfaceId, &Ip6NvData->InterfaceId); … … 1806 1806 ); 1807 1807 } 1808 1808 1809 1809 break; 1810 1810 1811 1811 case KEY_MANUAL_ADDRESS: 1812 1812 Status = Ip6ParseAddressListFromString ( … … 1823 1823 ); 1824 1824 } 1825 1825 1826 1826 break; 1827 1827 1828 1828 case KEY_GATEWAY_ADDRESS: 1829 1829 Status = Ip6ParseAddressListFromString ( … … 1840 1840 ); 1841 1841 } 1842 1842 1843 1843 break; 1844 1844 1845 1845 case KEY_DNS_ADDRESS: 1846 1846 Status = Ip6ParseAddressListFromString ( … … 1857 1857 ); 1858 1858 } 1859 1859 1860 1860 break; 1861 1861 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Driver.c
r58459 r58466 124 124 if (EFI_ERROR (Status)) { 125 125 return Status; 126 } 126 } 127 127 } 128 128 … … 567 567 if (EFI_ERROR (Status)) { 568 568 goto ON_ERROR; 569 } 569 } 570 570 571 571 // … … 585 585 /** 586 586 Callback function which provided by user to remove one node in NetDestroyLinkList process. 587 587 588 588 @param[in] Entry The entry to be removed. 589 589 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList. … … 718 718 Status = EFI_SUCCESS; 719 719 } 720 720 721 721 Exit: 722 722 return Status; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Dxe.inf
r58459 r58466 1 1 ## @file 2 2 # Basic IPv6 packet I/O Service. 3 # 4 # This module provides basic network IPv6 packet I/O services which includes support for 5 # Neighbor Discovery Protocol (ND), Multicast Listener Discovery Protocol (MLD), 6 # and a subset of the Internet Control Message Protocol (ICMPv6). This driver 3 # 4 # This module provides basic network IPv6 packet I/O services which includes support for 5 # Neighbor Discovery Protocol (ND), Multicast Listener Discovery Protocol (MLD), 6 # and a subset of the Internet Control Message Protocol (ICMPv6). This driver 7 7 # also provides the mechanism to set and get various types of configurations for 8 8 # the EFI IPv6 network stack. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6DxeStrings.uni
-
Property svn:mime-type
changed from
application/octet-stream
totext/plain;encoding=UTF-16LE
-
Property svn:mime-type
changed from
-
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6If.c
r58459 r58466 566 566 EFI_STATUS Status; 567 567 IP6_LINK_RX_TOKEN *Token; 568 568 569 569 NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE); 570 570 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Input.c
r58459 r58466 652 652 sizeof (IP6_CLIP_INFO) 653 653 ); 654 654 655 655 NetIpSecNetbufFree(Packet); 656 656 *Netbuf = TxWrap->Packet; … … 729 729 @param[in] Flag The link layer flag for the packet received, such 730 730 as multicast. 731 @param[out] Payload The pointer to the payload of the recieved packet. 732 it starts from the first byte of the extension header. 731 @param[out] Payload The pointer to the payload of the recieved packet. 732 it starts from the first byte of the extension header. 733 733 @param[out] LastHead The pointer of NextHeader of the last extension 734 734 header processed by IP6. 735 735 @param[out] ExtHdrsLen The length of the whole option. 736 736 @param[out] UnFragmentLen The length of unfragmented length of extension headers. 737 @param[out] Fragmented Indicate whether the packet is fragmented. 737 @param[out] Fragmented Indicate whether the packet is fragmented. 738 738 @param[out] Head The pointer to the EFI_IP6_Header. 739 739 … … 751 751 OUT UINT32 *ExtHdrsLen, 752 752 OUT UINT32 *UnFragmentLen, 753 OUT BOOLEAN *Fragmented, 753 OUT BOOLEAN *Fragmented, 754 754 OUT EFI_IP6_HEADER **Head 755 755 ) … … 969 969 // 970 970 NetbufTrim (*Packet, sizeof (EFI_IP6_HEADER) + *ExtHdrsLen, TRUE); 971 971 972 972 return EFI_SUCCESS; 973 973 } … … 1014 1014 goto Drop; 1015 1015 } 1016 1016 1017 1017 // 1018 1018 // Pre-Process the Ipv6 Packet and then reassemble if it is necessary. 1019 1019 // 1020 1020 Status = Ip6PreProcessPacket ( 1021 IpSb, 1022 &Packet, 1023 Flag, 1024 &Payload, 1025 &LastHead, 1026 &ExtHdrsLen, 1027 &UnFragmentLen, 1021 IpSb, 1022 &Packet, 1023 Flag, 1024 &Payload, 1025 &LastHead, 1026 &ExtHdrsLen, 1027 &UnFragmentLen, 1028 1028 &Fragmented, 1029 1029 &Head … … 1057 1057 if (0 == CompareMem (Head, &ZeroHead, sizeof (EFI_IP6_HEADER))) { 1058 1058 Status = Ip6PreProcessPacket ( 1059 IpSb, 1060 &Packet, 1061 Flag, 1062 &Payload, 1063 &LastHead, 1064 &ExtHdrsLen, 1065 &UnFragmentLen, 1066 &Fragmented, 1059 IpSb, 1060 &Packet, 1061 Flag, 1062 &Payload, 1063 &LastHead, 1064 &ExtHdrsLen, 1065 &UnFragmentLen, 1066 &Fragmented, 1067 1067 &Head 1068 1068 ); … … 1078 1078 goto Restart; 1079 1079 } 1080 1080 1081 1081 // 1082 1082 // Packet may have been changed. The ownership of the packet -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Nd.c
r58459 r58466 823 823 EFI_DHCP6_RETRANSMISSION InfoReqReXmit; 824 824 EFI_IPv6_ADDRESS AllNodes; 825 825 826 826 IpSb = IpIf->Service; 827 827 AddrInfo = DadEntry->AddressInfo; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/ComponentName.c
r58459 r58466 326 326 return EFI_UNSUPPORTED; 327 327 } 328 328 329 329 // 330 330 // Make sure this driver is currently managing ControllerHandle -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IetfConstants.c
r48674 r58466 1 1 /** @file 2 2 Cryptographic Parameter Constant Definitions from IETF; 3 3 4 4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR> 5 5 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/Ike.h
r48674 r58466 56 56 #define IPSEC_ESP_3IDEA 8 57 57 #define IPSEC_ESP_DES_IV32 9 58 #define IPSEC_ESP_RC4 10 // It's reserved in IKEv2 58 #define IPSEC_ESP_RC4 10 // It's reserved in IKEv2 59 59 #define IPSEC_ESP_NULL 11 60 60 #define IPSEC_ESP_AES 12 … … 151 151 UINT16 AttrLength; 152 152 UINT16 AttrValue; 153 } IKE_SA_ATTR_UNION; 153 } IKE_SA_ATTR_UNION; 154 154 155 155 // … … 164 164 165 165 // 166 // Contains the IKE packet information. 166 // Contains the IKE packet information. 167 167 // 168 168 typedef struct { … … 220 220 // Each algorithm has its own Id, Guid, BlockSize and KeyLength. 221 221 // This struct contains these information for each algorithm. It is generic structure 222 // for both encryption and authentication algorithm. 222 // for both encryption and authentication algorithm. 223 223 // For authentication algorithm, the AlgSize means IcvSize. For encryption algorithm, 224 224 // it means IvSize. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IkeCommon.c
r58459 r58466 1 1 /** @file 2 2 Common operation of the IKE 3 3 4 4 Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 … … 27 27 /** 28 28 Call Crypto Lib to generate a random value with eight-octet length. 29 29 30 30 @return the 64 byte vaule. 31 31 … … 51 51 52 52 @param[in] NonceSize Size of the data in bytes. 53 54 @return Buffer which contains the random data of the spcified size. 53 54 @return Buffer which contains the random data of the spcified size. 55 55 56 56 **/ … … 128 128 return NULL; 129 129 } 130 130 131 131 IkePayload->Signature = IKE_PAYLOAD_SIGNATURE; 132 132 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IkeCommon.h
r48674 r58466 20 20 #include <Protocol/Udp6.h> 21 21 #include <Protocol/Ip4Config.h> 22 22 23 23 #include <Library/BaseLib.h> 24 24 #include <Library/BaseMemoryLib.h> … … 63 63 /** 64 64 Call Crypto Lib to generate a random value with eight-octet length. 65 65 66 66 @return the 64 byte vaule. 67 67 … … 76 76 77 77 @param[in] NonceSize Size of the data in bytes. 78 79 @return Buffer which contains the random data of the spcified size. 78 79 @return Buffer which contains the random data of the spcified size. 80 80 81 81 **/ -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IkePacket.c
r48674 r58466 37 37 IkePacket->RefCount = 1; 38 38 InitializeListHead (&IkePacket->PayloadList); 39 39 40 40 IkePacket->Header = (IKE_HEADER *) AllocateZeroPool (sizeof (IKE_HEADER)); 41 41 if (IkePacket->Header == NULL) { … … 95 95 /** 96 96 Callback funtion of NetbufFromExt() 97 98 @param[in] Arg The data passed from the NetBufFromExe(). 97 98 @param[in] Arg The data passed from the NetBufFromExe(). 99 99 100 100 **/ … … 112 112 /** 113 113 Copy the NetBuf into a IKE_PACKET sturcture. 114 115 Create a IKE_PACKET and fill the received IKE header into the header of IKE_PACKET 114 115 Create a IKE_PACKET and fill the received IKE header into the header of IKE_PACKET 116 116 and copy the recieved packet without IKE HEADER to the PayloadBuf of IKE_PACKET. 117 117 118 @param[in] Netbuf The pointer of the Netbuf which contains the whole received 118 @param[in] Netbuf The pointer of the Netbuf which contains the whole received 119 119 IKE packet. 120 120 … … 175 175 @param[in] SessionCommon Pointer of related IKE_COMMON_SESSION 176 176 @param[in] IkePacket Pointer of IKE_PACKET to be copy to NetBuf 177 @param[in] IkeType The IKE type to pointer the packet is for which IKE 178 phase. Now it supports IKE_SA_TYPE, IKE_CHILDSA_TYPE, 177 @param[in] IkeType The IKE type to pointer the packet is for which IKE 178 phase. Now it supports IKE_SA_TYPE, IKE_CHILDSA_TYPE, 179 179 IKE_INFO_TYPE. 180 180 181 181 @return a pointer of Netbuff which contains the IKE_PACKE in network order. 182 182 183 183 **/ 184 184 NET_BUF * … … 218 218 // 219 219 NET_LIST_FOR_EACH (PacketEntry, &(IkePacket)->PayloadList) { 220 220 221 221 NumPayloads++; 222 222 } … … 252 252 NULL 253 253 ); 254 254 255 255 FreePool (Fragments); 256 256 return Netbuf; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IkePacket.h
r48674 r58466 11 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 14 14 **/ 15 15 … … 47 47 /** 48 48 Copy the NetBuf into a IKE_PACKET sturcture. 49 50 Create a IKE_PACKET and fill the received IKE header into the header of IKE_PACKET 49 50 Create a IKE_PACKET and fill the received IKE header into the header of IKE_PACKET 51 51 and copy the recieved packet without IKE HEADER to the PayloadBuf of IKE_PACKET. 52 52 53 @param[in] Netbuf The pointer of the Netbuf which contains the whole received 53 @param[in] Netbuf The pointer of the Netbuf which contains the whole received 54 54 IKE packet. 55 55 … … 67 67 @param[in] SessionCommon Pointer of related IKE_COMMON_SESSION 68 68 @param[in] IkePacket Pointer of IKE_PACKET to be copy to NetBuf 69 @param[in] IkeType The IKE type to pointer the packet is for which IKE 70 phase. Now it supports IKE_SA_TYPE, IKE_CHILDSA_TYPE, 69 @param[in] IkeType The IKE type to pointer the packet is for which IKE 70 phase. Now it supports IKE_SA_TYPE, IKE_CHILDSA_TYPE, 71 71 IKE_INFO_TYPE. 72 72 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/Ikev2/ChildSa.c
r48674 r58466 17 17 18 18 /** 19 Generate IKE Packet for CREATE_CHILD_SA exchange. 19 Generate IKE Packet for CREATE_CHILD_SA exchange. 20 20 21 21 This IKE Packet would be the packet for creating new CHILD SA, or the packet for 22 22 rekeying existing IKE SA, or the packet for existing CHILD SA. 23 24 @param[in] SaSession Pointer to related SA session. 23 24 @param[in] SaSession Pointer to related SA session. 25 25 @param[in] Context The data passed by the caller. 26 26 … … 40 40 IKE_PAYLOAD *NotifyPayload; 41 41 UINT32 *MessageId; 42 42 43 43 ChildSaSession = (IKEV2_CHILD_SA_SESSION *) SaSession; 44 44 IkePacket = IkePacketAlloc(); … … 55 55 MessageId = (UINT32 *) Context; 56 56 } 57 57 58 58 IkePacket->Header->Version = (UINT8) (2 << 4); 59 59 IkePacket->Header->NextPayload = IKEV2_PAYLOAD_TYPE_NOTIFY; 60 60 IkePacket->Header->ExchangeType = IKE_XCG_TYPE_CREATE_CHILD_SA; 61 61 62 62 if (ChildSaSession->SessionCommon.IkeSessionType == IkeSessionTypeChildSa) { 63 63 // 64 64 // 1.a Fill the IkePacket->Hdr 65 // 65 // 66 66 IkePacket->Header->InitiatorCookie = ChildSaSession->IkeSaSession->InitiatorCookie; 67 67 IkePacket->Header->ResponderCookie = ChildSaSession->IkeSaSession->ResponderCookie; 68 68 69 69 if (MessageId != NULL) { 70 70 IkePacket->Header->MessageId = *MessageId; 71 71 } else { 72 72 IkePacket->Header->MessageId = ChildSaSession->MessageId; 73 } 74 73 } 74 75 75 if (ChildSaSession->SessionCommon.IsInitiator) { 76 76 IkePacket->Header->Flags = IKE_HEADER_FLAGS_CHILD_INIT; … … 78 78 IkePacket->Header->Flags = IKE_HEADER_FLAGS_RESPOND; 79 79 } 80 80 81 81 } else { 82 82 IkeSaSession = (IKEV2_SA_SESSION *) SaSession; … … 91 91 } else { 92 92 IkePacket->Header->MessageId = IkeSaSession->MessageId; 93 } 94 93 } 94 95 95 if (IkeSaSession->SessionCommon.IsInitiator) { 96 96 IkePacket->Header->Flags = IKE_HEADER_FLAGS_CHILD_INIT; … … 98 98 IkePacket->Header->Flags = IKE_HEADER_FLAGS_RESPOND; 99 99 } 100 } 101 100 } 101 102 102 // 103 103 // According to RFC4306, Chapter 4. … … 108 108 0, 109 109 IKEV2_PAYLOAD_TYPE_NONE, 110 0, 110 0, 111 111 IKEV2_NOTIFICATION_NO_ADDITIONAL_SAS, 112 112 NULL, … … 114 114 0 115 115 ); 116 116 117 117 IKE_PACKET_APPEND_PAYLOAD (IkePacket, NotifyPayload); 118 118 // 119 // TODO: Support the CREATE_CHILD_SA exchange. 120 // 119 // TODO: Support the CREATE_CHILD_SA exchange. 120 // 121 121 return IkePacket; 122 122 } … … 124 124 /** 125 125 Parse the IKE packet of CREATE_CHILD_SA exchange. 126 126 127 127 This function parse the IKE packet and save the related information to further 128 calculation. 129 128 calculation. 129 130 130 @param[in] SaSession Pointer to IKEv2_CHILD_SA_SESSION related to this Exchange. 131 131 @param[in] IkePacket Received packet to be parsed. 132 132 133 133 134 134 @retval EFI_SUCCESS The IKE Packet is acceptable. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/Ikev2/Ikev2.h
r48674 r58466 232 232 } PRF_DATA_FRAGMENT; 233 233 234 typedef 234 typedef 235 235 IKE_PACKET * 236 236 (*IKEV2_PACKET_GENERATOR) ( -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/Ikev2/Info.c
r48674 r58466 11 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 13 14 14 **/ 15 15 … … 21 21 Generate Information Packet. 22 22 23 The information Packet may contain one Delete Payload, or Notify Payload, which 23 The information Packet may contain one Delete Payload, or Notify Payload, which 24 24 dependes on the Context's parameters. 25 25 26 @param[in] SaSession Pointer to IKE SA Session or Child SA Session which is 26 @param[in] SaSession Pointer to IKE SA Session or Child SA Session which is 27 27 related to the information Exchange. 28 28 @param[in] Context The Data passed from the caller. If the Context is not NULL 29 29 it should contain the information for Notification Data. 30 30 31 31 @retval Pointer of IKE_PACKET generated. 32 32 … … 53 53 // 54 54 IkePacket->Header->ExchangeType = IKEV2_EXCHANGE_TYPE_INFO; 55 IkePacket->Header->Version = (UINT8) (2 << 4); 55 IkePacket->Header->Version = (UINT8) (2 << 4); 56 56 57 57 if (Context != NULL) { … … 62 62 // For Liveness Check 63 63 // 64 if (InfoContext != NULL && 65 (InfoContext->InfoType == Ikev2InfoLiveCheck || InfoContext->InfoType == Ikev2InfoNotify) 64 if (InfoContext != NULL && 65 (InfoContext->InfoType == Ikev2InfoLiveCheck || InfoContext->InfoType == Ikev2InfoNotify) 66 66 ) { 67 67 IkePacket->Header->MessageId = InfoContext->MessageId; … … 75 75 return IkePacket; 76 76 } 77 77 78 78 // 79 79 // For delete SAs 80 // 80 // 81 81 if (IkeSaSession->SessionCommon.IkeSessionType == IkeSessionTypeIkeSa) { 82 82 … … 99 99 if (IkeSaSession->SessionCommon.State == IkeStateSaDeleting ) { 100 100 IkePayload = Ikev2GenerateDeletePayload ( 101 IkeSaSession, 102 IKEV2_PAYLOAD_TYPE_NONE, 103 0, 104 0, 101 IkeSaSession, 102 IKEV2_PAYLOAD_TYPE_NONE, 103 0, 104 0, 105 105 NULL 106 ); 106 ); 107 107 if (IkePayload == NULL) { 108 108 goto ERROR_EXIT; … … 116 116 IkePacket->Spi = 0; 117 117 IkePacket->IsDeleteInfo = TRUE; 118 118 119 119 } else if (Context != NULL) { 120 120 // … … 126 126 // 127 127 goto ERROR_EXIT; 128 } 128 } 129 129 } else { 130 130 // … … 146 146 Ikev2SaSessionIncreaseMessageId (IkeSaSession); 147 147 } 148 148 149 149 IkePayload = Ikev2GenerateDeletePayload ( 150 150 ChildSaSession->IkeSaSession, … … 225 225 EFI_STATUS Status; 226 226 IKE_PACKET *RespondPacket; 227 227 228 228 IKEV2_INFO_EXCHANGE_CONTEXT Context; 229 229 230 230 IkeSaSession = (IKEV2_SA_SESSION *) SaSession; 231 231 … … 235 235 RespondPacket = NULL; 236 236 Status = EFI_SUCCESS; 237 237 238 238 // 239 239 // For Liveness Check … … 272 272 // For SA Delete 273 273 // 274 NET_LIST_FOR_EACH (Entry, &(IkePacket)->PayloadList) { 274 NET_LIST_FOR_EACH (Entry, &(IkePacket)->PayloadList) { 275 275 276 276 // … … 278 278 // 279 279 IkePayload = IKE_PAYLOAD_BY_PACKET (Entry); 280 280 281 281 if (IkePayload->PayloadType == IKEV2_PAYLOAD_TYPE_DELETE) { 282 282 DeletePayload = IkePayload; … … 303 303 // IPsec status variable. 304 304 // 305 if (IsListEmpty (&Private->Ikev1EstablishedList) && 305 if (IsListEmpty (&Private->Ikev1EstablishedList) && 306 306 (IsListEmpty (&Private->Ikev2EstablishedList)) 307 307 ) { … … 334 334 } 335 335 Status = Ikev2SendIkePacket ( 336 IkeSaSession->SessionCommon.UdpService, 337 (UINT8 *)(&IkeSaSession->SessionCommon), 338 RespondPacket, 336 IkeSaSession->SessionCommon.UdpService, 337 (UINT8 *)(&IkeSaSession->SessionCommon), 338 RespondPacket, 339 339 0 340 340 ); … … 366 366 Context.InfoType = Ikev2InfoDelete; 367 367 Context.MessageId = IkePacket->Header->MessageId; 368 368 369 369 RespondPacket = Ikev2InfoGenerator ((UINT8 *)ChildSaSession, &Context); 370 370 if (RespondPacket == NULL) { … … 375 375 ChildSaSession->SessionCommon.UdpService, 376 376 (UINT8 *)(&ChildSaSession->SessionCommon), 377 RespondPacket, 377 RespondPacket, 378 378 0 379 379 ); … … 392 392 } 393 393 } 394 394 395 395 return Status; 396 396 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/Ikev2/Payload.h
r48674 r58466 63 63 typedef struct { 64 64 IKEV2_COMMON_PAYLOAD_HEADER Header; 65 // 65 // 66 66 // Proposals 67 67 // … … 90 90 // 91 91 // IKEv2 Transform ID for Encrypt Algorithm (ENCR) 92 // 92 // 93 93 #define IKEV2_TRANSFORM_ID_ENCR_DES_IV64 1 94 94 #define IKEV2_TRANSFORM_ID_ENCR_DES 2 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/Ikev2/Sa.c
r48674 r58466 23 23 24 24 This generates the DH local public key and store it in the IKEv2 SA Session's GxBuffer. 25 25 26 26 @param[in] IkeSaSession Pointer to related IKE SA Session. 27 27 … … 153 153 // No need to recompute the Public key. 154 154 // 155 if ((IkeSaSession->SessionCommon.IsInitiator) && (IkeSaSession->NCookie == NULL)) { 155 if ((IkeSaSession->SessionCommon.IsInitiator) && (IkeSaSession->NCookie == NULL)) { 156 156 Status = Ikev2GenerateSaDhPublicKey (IkeSaSession); 157 157 if (EFI_ERROR (Status)) { … … 164 164 // 165 165 KePayload = Ikev2GenerateKePayload ( 166 IkeSaSession, 166 IkeSaSession, 167 167 IKEV2_PAYLOAD_TYPE_NONCE 168 168 ); … … 219 219 IkePayloadFree (SaPayload); 220 220 } 221 return NULL; 221 return NULL; 222 222 } 223 223 … … 237 237 IN UINT8 *SaSession, 238 238 IN IKE_PACKET *IkePacket 239 ) 239 ) 240 240 { 241 241 IKEV2_SA_SESSION *IkeSaSession; … … 403 403 FreePool (NonceBuffer); 404 404 } 405 405 406 406 return Status; 407 407 } … … 432 432 IKE_PAYLOAD *CpPayload; 433 433 IKEV2_CHILD_SA_SESSION *ChildSaSession; 434 434 435 435 436 436 IkeSaSession = (IKEV2_SA_SESSION *) SaSession; … … 439 439 CpPayload = NULL; 440 440 NotifyPayload = NULL; 441 441 442 442 // 443 443 // 1. Allocate IKE Packet … … 460 460 461 461 // 462 // According to RFC4306_2.2, For the IKE_SA_INIT message the MessageID should 462 // According to RFC4306_2.2, For the IKE_SA_INIT message the MessageID should 463 463 // be always number 0 and 1; 464 464 // … … 589 589 @param[in] IkePacket Pointer to the IKE_AUTH packet to be parsered. 590 590 591 @retval EFI_INVALID_PARAMETER The IKE packet is malformed or the SA 591 @retval EFI_INVALID_PARAMETER The IKE packet is malformed or the SA 592 592 proposal is unacceptable. 593 593 @retval EFI_SUCCESS The IKE packet is acceptable and the … … 595 595 596 596 **/ 597 EFI_STATUS 597 EFI_STATUS 598 598 Ikev2AuthPskParser ( 599 599 IN UINT8 *SaSession, … … 661 661 // 662 662 if (IkeSaSession->SessionCommon.IsInitiator) { 663 663 664 664 // 665 665 // 1. Check the IkePacket->Hdr == IKE_HEADER_FLAGS_RESPOND … … 755 755 ) { 756 756 return EFI_INVALID_PARAMETER; 757 } 757 } 758 758 if ((((TRAFFIC_SELECTOR *)(TsiPayload->PayloadBuf + sizeof (IKEV2_TS)))->StartPort != 0) && 759 759 (((TRAFFIC_SELECTOR *)(TsiPayload->PayloadBuf + sizeof (IKEV2_TS)))->StartPort != ChildSaSession->LocalPort) … … 772 772 } 773 773 // 774 // Get the Virtual IP address from the Tsi traffic selector. 774 // Get the Virtual IP address from the Tsi traffic selector. 775 775 // TODO: check the CFG reply payload 776 776 // … … 781 781 sizeof (EFI_IPv4_ADDRESS) : sizeof (EFI_IPv6_ADDRESS) 782 782 ); 783 } 783 } 784 784 } 785 785 … … 795 795 IkeSaSession->SessionCommon.State = IkeStateIkeSaEstablished; 796 796 } 797 797 798 798 return EFI_SUCCESS; 799 799 } … … 813 813 IN UINT8 *SaSession, 814 814 IN VOID *Context 815 ) 815 ) 816 816 { 817 817 IKE_PACKET *IkePacket; … … 865 865 @retval EFI_SUCCESS The IKEv2 packet is acceptable and the relative data is 866 866 saved for furthure communication. 867 @retval EFI_INVALID_PARAMETER The IKE packet is malformed or the SA proposal is unacceptable. 867 @retval EFI_INVALID_PARAMETER The IKE packet is malformed or the SA proposal is unacceptable. 868 868 @retval EFI_UNSUPPORTED The certificate authentication is not supported. 869 869 … … 877 877 if (!FeaturePcdGet (PcdIpsecCertificateEnabled)) { 878 878 return EFI_UNSUPPORTED; 879 } 880 879 } 880 881 881 // 882 882 // The first two messages exchange is same between PSK and Cert. 883 // Todo: Parse Certificate Request from responder Initial Exchange. 883 // Todo: Parse Certificate Request from responder Initial Exchange. 884 884 // 885 885 return Ikev2InitPskParser (SaSession, IkePacket); … … 1057 1057 1058 1058 // 1059 // Generate Notify Payload. If transport mode, there should have Notify 1059 // Generate Notify Payload. If transport mode, there should have Notify 1060 1060 // payload with TRANSPORT_MODE notification. 1061 1061 // … … 1189 1189 } 1190 1190 1191 if ((SaPayload == NULL) || (AuthPayload == NULL) || (TsiPayload == NULL) || 1191 if ((SaPayload == NULL) || (AuthPayload == NULL) || (TsiPayload == NULL) || 1192 1192 (TsrPayload == NULL) || (CertPayload == NULL)) { 1193 1193 goto Exit; … … 1201 1201 // 1202 1202 if (IkeSaSession->SessionCommon.IsInitiator) { 1203 1203 1204 1204 // 1205 1205 // 1. Check the IkePacket->Hdr == IKE_HEADER_FLAGS_RESPOND … … 1295 1295 ) { 1296 1296 goto Exit; 1297 } 1297 } 1298 1298 if ((((TRAFFIC_SELECTOR *)(TsiPayload->PayloadBuf + sizeof (IKEV2_TS)))->StartPort != 0) && 1299 1299 (((TRAFFIC_SELECTOR *)(TsiPayload->PayloadBuf + sizeof (IKEV2_TS)))->StartPort != ChildSaSession->LocalPort) … … 1312 1312 } 1313 1313 // 1314 // Get the Virtual IP address from the Tsi traffic selector. 1314 // Get the Virtual IP address from the Tsi traffic selector. 1315 1315 // TODO: check the CFG reply payload 1316 1316 // … … 1323 1323 } 1324 1324 } 1325 1325 1326 1326 // 1327 1327 // 5. Generat keymats for IPsec protocol. … … 1406 1406 @param[in] DhBuffer Pointer to buffer of peer's puliic key. 1407 1407 @param[in] KePayload Pointer to received key payload. 1408 1408 1409 1409 @retval EFI_SUCCESS The operation succeeded. 1410 1410 @retval Otherwise The operation failed. … … 1518 1518 // If one or more algorithm is not support, return EFI_UNSUPPORTED. 1519 1519 // 1520 if (AuthAlgKeyLen == 0 || 1520 if (AuthAlgKeyLen == 0 || 1521 1521 EncryptAlgKeyLen == 0 || 1522 1522 IntegrityAlgKeyLen == 0 || … … 1577 1577 IPSEC_DUMP_BUF (">>> InitiatorCookie", (UINT8 *)&IkeSaSession->InitiatorCookie, sizeof(UINT64)); 1578 1578 IPSEC_DUMP_BUF (">>> ResponderCookie", (UINT8 *)&IkeSaSession->ResponderCookie, sizeof(UINT64)); 1579 1580 OutputKeyLength = PrfAlgKeyLen + 1579 1580 OutputKeyLength = PrfAlgKeyLen + 1581 1581 2 * EncryptAlgKeyLen + 1582 1582 2 * AuthAlgKeyLen + … … 1628 1628 IkeSaSession->IkeKeys->SkAiKeySize = IntegrityAlgKeyLen; 1629 1629 CopyMem (IkeSaSession->IkeKeys->SkAiKey, OutputKey + PrfAlgKeyLen, IntegrityAlgKeyLen); 1630 1630 1631 1631 IPSEC_DUMP_BUF (">>> SK_Ai Key", IkeSaSession->IkeKeys->SkAiKey, IkeSaSession->IkeKeys->SkAiKeySize); 1632 1632 … … 1645 1645 IntegrityAlgKeyLen 1646 1646 ); 1647 1647 1648 1648 IPSEC_DUMP_BUF (">>> SK_Ar Key", IkeSaSession->IkeKeys->SkArKey, IkeSaSession->IkeKeys->SkArKeySize); 1649 1649 … … 1657 1657 } 1658 1658 IkeSaSession->IkeKeys->SkEiKeySize = EncryptAlgKeyLen; 1659 1659 1660 1660 CopyMem ( 1661 1661 IkeSaSession->IkeKeys->SkEiKey, … … 1664 1664 ); 1665 1665 IPSEC_DUMP_BUF ( 1666 ">>> SK_Ei Key", 1666 ">>> SK_Ei Key", 1667 1667 OutputKey + AuthAlgKeyLen + 2 * IntegrityAlgKeyLen, 1668 1668 EncryptAlgKeyLen … … 1725 1725 OutputKey + AuthAlgKeyLen + 2 * IntegrityAlgKeyLen + 2 * EncryptAlgKeyLen + AuthAlgKeyLen, 1726 1726 AuthAlgKeyLen 1727 ); 1727 ); 1728 1728 IPSEC_DUMP_BUF ( 1729 1729 ">>> SK_Pr Key", … … 1768 1768 } 1769 1769 1770 1770 1771 1771 return Status; 1772 1772 } … … 1798 1798 Status = EFI_SUCCESS; 1799 1799 OutputKey = NULL; 1800 1800 1801 1801 if (KePayload != NULL) { 1802 1802 // 1803 // Generate Gxy 1803 // Generate Gxy 1804 1804 // 1805 1805 Ikev2GenerateSaDhComputeKey (ChildSaSession->DhBuffer, KePayload); … … 1827 1827 1828 1828 // 1829 // 1829 // 1830 1830 // If KePayload is not NULL, calculate KEYMAT = prf+(SK_d, g^ir (new) | Ni | Nr ), 1831 1831 // otherwise, KEYMAT = prf+(SK_d, Ni | Nr ) … … 1851 1851 1852 1852 if (EFI_ERROR (Status)) { 1853 goto Exit; 1854 } 1855 1853 goto Exit; 1854 } 1855 1856 1856 // 1857 1857 // Copy KEYMATE (SK_ENCRYPT_i | SK_ENCRYPT_r | SK_INTEG_i | SK_INTEG_r) to 1858 1858 // ChildKeyMates. 1859 // 1859 // 1860 1860 if (!ChildSaSession->SessionCommon.IsInitiator) { 1861 1861 1862 // 1862 // 1863 1863 // Initiator Encryption Key 1864 1864 // … … 1886 1886 Status = EFI_OUT_OF_RESOURCES; 1887 1887 goto Exit; 1888 } 1889 1888 } 1889 1890 1890 CopyMem ( 1891 1891 ChildSaSession->ChildKeymats.LocalPeerInfo.EspAlgoInfo.AuthKey, … … 1903 1903 Status = EFI_OUT_OF_RESOURCES; 1904 1904 goto Exit; 1905 } 1906 1905 } 1906 1907 1907 CopyMem ( 1908 1908 ChildSaSession->ChildKeymats.RemotePeerInfo.EspAlgoInfo.EncKey, … … 1920 1920 Status = EFI_OUT_OF_RESOURCES; 1921 1921 goto Exit; 1922 } 1923 1922 } 1923 1924 1924 CopyMem ( 1925 1925 ChildSaSession->ChildKeymats.RemotePeerInfo.EspAlgoInfo.AuthKey, … … 1937 1937 Status = EFI_OUT_OF_RESOURCES; 1938 1938 goto Exit; 1939 } 1940 1939 } 1940 1941 1941 CopyMem ( 1942 1942 ChildSaSession->ChildKeymats.RemotePeerInfo.EspAlgoInfo.EncKey, … … 1954 1954 Status = EFI_OUT_OF_RESOURCES; 1955 1955 goto Exit; 1956 } 1957 1956 } 1957 1958 1958 CopyMem ( 1959 1959 ChildSaSession->ChildKeymats.RemotePeerInfo.EspAlgoInfo.AuthKey, … … 1971 1971 Status = EFI_OUT_OF_RESOURCES; 1972 1972 goto Exit; 1973 } 1974 1973 } 1974 1975 1975 CopyMem ( 1976 1976 ChildSaSession->ChildKeymats.LocalPeerInfo.EspAlgoInfo.EncKey, … … 1988 1988 Status = EFI_OUT_OF_RESOURCES; 1989 1989 goto Exit; 1990 } 1991 1990 } 1991 1992 1992 CopyMem ( 1993 1993 ChildSaSession->ChildKeymats.LocalPeerInfo.EspAlgoInfo.AuthKey, … … 2039 2039 FreePool (OutputKey); 2040 2040 } 2041 2041 2042 2042 return EFI_SUCCESS; 2043 2043 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/Ikev2/Utility.c
r58459 r58466 21 21 UINT16 mIkev2EncryptAlgorithmList[IKEV2_SUPPORT_ENCRYPT_ALGORITHM_NUM] = { 22 22 IKEV2_TRANSFORM_ID_ENCR_3DES, 23 IKEV2_TRANSFORM_ID_ENCR_AES_CBC, 23 IKEV2_TRANSFORM_ID_ENCR_AES_CBC, 24 24 }; 25 25 … … 67 67 IkeSaSession->ResponderCookie = 0; 68 68 // 69 // BUGBUG: Message ID starts from 2 is to match the OpenSwan requirement, but it 69 // BUGBUG: Message ID starts from 2 is to match the OpenSwan requirement, but it 70 70 // might not match the IPv6 Logo. In its test specification, it mentions that 71 71 // the Message ID should start from zero after the IKE_SA_INIT exchange. … … 141 141 // 142 142 // Cleanup the fields of SessionCommon for processing. 143 // 143 // 144 144 Ikev2SessionCommonRefresh (SessionCommon); 145 145 … … 161 161 if (EFI_ERROR(Status)){ 162 162 // 163 // If TimerEvent creation failed, the SA will be alive untill user disable it or 164 // receiving a Delete Payload from peer. 163 // If TimerEvent creation failed, the SA will be alive untill user disable it or 164 // receiving a Delete Payload from peer. 165 165 // 166 166 return; … … 175 175 Lifetime = IkeSaSession->Spd->Data->ProcessingPolicy->SaLifetime.HardLifetime; 176 176 } 177 177 178 178 Status = gBS->SetTimer ( 179 179 SessionCommon->TimeoutEvent, … … 183 183 if (EFI_ERROR(Status)){ 184 184 // 185 // If SetTimer failed, the SA will be alive untill user disable it or 186 // receiving a Delete Payload from peer. 185 // If SetTimer failed, the SA will be alive untill user disable it or 186 // receiving a Delete Payload from peer. 187 187 // 188 188 return ; … … 237 237 238 238 @param[in] SaSessionList Pointer to list to be inserted into. 239 @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION to be inserted. 240 @param[in] RemotePeerIp Pointer to EFI_IP_ADDRESSS to indicate the 239 @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION to be inserted. 240 @param[in] RemotePeerIp Pointer to EFI_IP_ADDRESSS to indicate the 241 241 unique IKEV2_SA_SESSION. 242 242 … … 259 259 @param[in] RemotePeerIp Pointer to EFI_IP_ADDRESS to use for SA Session search. 260 260 261 @retval Pointer to IKEV2_SA_SESSION with the specified remote IP address or NULL. 261 @retval Pointer to IKEV2_SA_SESSION with the specified remote IP address or NULL. 262 262 263 263 **/ … … 305 305 306 306 /** 307 Free specified Seession Common. The session common would belong to a IKE SA or 307 Free specified Seession Common. The session common would belong to a IKE SA or 308 308 a Child SA. 309 309 … … 356 356 } 357 357 /** 358 Free specified IKEV2 SA Session. 358 Free specified IKEV2 SA Session. 359 359 360 360 @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION to be freed. … … 372 372 373 373 ASSERT (IkeSaSession != NULL); 374 374 375 375 // 376 376 // Delete Common Session … … 417 417 // 418 418 // Delete Keys 419 // 419 // 420 420 if (IkeKeys->SkAiKey != NULL) { 421 421 FreePool (IkeKeys->SkAiKey); … … 493 493 /** 494 494 Allocate memory for IKEV2 Child SA Session. 495 495 496 496 @param[in] UdpService Pointer to IKE_UDP_SERVICE. 497 @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION related to this Child SA 497 @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION related to this Child SA 498 498 Session. 499 499 … … 555 555 556 556 /** 557 Register a established IKEv2 Child SA into IkeSaSession->ChildSaEstablishSessionList. 558 If the there is IKEV2_CHILD_SA_SESSION with same remote peer IP, remove the old one 557 Register a established IKEv2 Child SA into IkeSaSession->ChildSaEstablishSessionList. 558 If the there is IKEV2_CHILD_SA_SESSION with same remote peer IP, remove the old one 559 559 then register the new one. 560 560 … … 600 600 // 601 601 // Cleanup the fields of SessionCommon for processing. 602 // 602 // 603 603 Ikev2SessionCommonRefresh (SessionCommon); 604 604 605 605 // 606 606 // Insert the ready child SA session into established list. … … 683 683 This functin find a ChildSA session by searching the ChildSaSessionlist of 684 684 the input IKEV2_SA_SESSION by specified MessageID. 685 685 686 686 @param[in] SaSessionList Pointer to List to be searched. 687 687 @param[in] Spi Specified SPI. … … 728 728 /** 729 729 Remove the IKEV2_CHILD_SA_SESSION from IkeSaSessionList. 730 730 731 731 @param[in] SaSessionList The SA Session List to be iterated. 732 732 @param[in] Spi Spi used to identified the IKEV2_CHILD_SA_SESSION. 733 @param[in] ListType The type of the List to indicate whether it is a 734 Established. 733 @param[in] ListType The type of the List to indicate whether it is a 734 Established. 735 735 736 736 @return The point to IKEV2_CHILD_SA_SESSION or NULL. 737 737 738 738 **/ 739 739 IKEV2_CHILD_SA_SESSION * 740 740 Ikev2ChildSaSessionRemove ( 741 741 IN LIST_ENTRY *SaSessionList, 742 IN UINT32 Spi, 742 IN UINT32 Spi, 743 743 IN UINT8 ListType 744 744 ) … … 749 749 750 750 NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, SaSessionList) { 751 751 752 752 if (ListType == IKEV2_ESTABLISHED_CHILDSA_LIST || ListType == IKEV2_ESTABLISHING_CHILDSA_LIST) { 753 753 ChildSaSession = IKEV2_CHILD_SA_SESSION_BY_IKE_SA (Entry); … … 784 784 785 785 /** 786 Free the memory located for the specified IKEV2_CHILD_SA_SESSION. 786 Free the memory located for the specified IKEV2_CHILD_SA_SESSION. 787 787 788 788 @param[in] ChildSaSession Pointer to IKEV2_CHILD_SA_SESSION. … … 902 902 ChildSession = Ikev2ChildSaSessionRemove( 903 903 &(IkeSaSession->ChildSaEstablishSessionList), 904 Spi, 904 Spi, 905 905 IKEV2_ESTABLISHED_CHILDSA_LIST 906 906 ); … … 911 911 LocalSpi = ChildSession->LocalPeerSpi; 912 912 RemoteSpi = ChildSession->RemotePeerSpi; 913 913 914 914 SelectorSize = sizeof (EFI_IPSEC_CONFIG_SELECTOR); 915 915 Selector = AllocateZeroPool (SelectorSize); 916 916 ASSERT (Selector != NULL); 917 917 918 918 919 919 920 920 while (1) { … … 1015 1015 1016 1016 @param[in] DhBuffer Pointer to IKEV2_DH_BUFFER to be freed. 1017 1017 1018 1018 **/ 1019 1019 VOID 1020 1020 Ikev2DhBufferFree ( 1021 1021 IKEV2_DH_BUFFER *DhBuffer 1022 ) 1022 ) 1023 1023 { 1024 1024 if (DhBuffer != NULL) { … … 1041 1041 /** 1042 1042 This function is to parse a request IKE packet and return its request type. 1043 The request type is one of IKE CHILD SA creation, IKE SA rekeying and 1043 The request type is one of IKE CHILD SA creation, IKE SA rekeying and 1044 1044 IKE CHILD SA rekeying. 1045 1045 … … 1068 1068 Flag = TRUE; 1069 1069 } 1070 if (IkePayload->PayloadType == IKEV2_PAYLOAD_TYPE_NOTIFY) { 1070 if (IkePayload->PayloadType == IKEV2_PAYLOAD_TYPE_NOTIFY) { 1071 1071 if (((IKEV2_NOTIFY*)IkePayload)->MessageType == IKEV2_NOTIFICATION_REKEY_SA) { 1072 1072 // 1073 // If notify payload with REKEY_SA message type, the IkePacket is for 1073 // If notify payload with REKEY_SA message type, the IkePacket is for 1074 1074 // rekeying Child SA. 1075 1075 // … … 1086 1086 } else { 1087 1087 // 1088 // If the Notify payloaad with transport mode message type, the IkePacket is 1088 // If the Notify payloaad with transport mode message type, the IkePacket is 1089 1089 // for create Child SA. 1090 1090 // … … 1096 1096 Associate a SPD selector to the Child SA Session. 1097 1097 1098 This function is called when the Child SA is not the first child SA of its 1098 This function is called when the Child SA is not the first child SA of its 1099 1099 IKE SA. It associate a SPD to this Child SA. 1100 1100 1101 @param[in, out] ChildSaSession Pointer to the Child SA Session to be associated to 1101 @param[in, out] ChildSaSession Pointer to the Child SA Session to be associated to 1102 1102 a SPD selector. 1103 1103 … … 1122 1122 /** 1123 1123 This function finds the SPI from Create Child SA Exchange Packet. 1124 1124 1125 1125 @param[in] IkePacket Pointer to IKE_PACKET to be searched. 1126 1126 … … 1135 1135 // 1136 1136 // Not support yet. 1137 // 1137 // 1138 1138 return 0; 1139 1139 } … … 1185 1185 // Information Exchagne and Create Child Exchange can be started from each part. 1186 1186 // 1187 if (IkeHdr->ExchangeType != IKEV2_EXCHANGE_TYPE_INFO && 1187 if (IkeHdr->ExchangeType != IKEV2_EXCHANGE_TYPE_INFO && 1188 1188 IkeHdr->ExchangeType != IKEV2_EXCHANGE_TYPE_CREATE_CHILD 1189 1189 ) { … … 1260 1260 1261 1261 // 1262 // If SA data for IKE_SA_INIT exchage, contains 4 transforms. If SA data for 1262 // If SA data for IKE_SA_INIT exchage, contains 4 transforms. If SA data for 1263 1263 // IKE_AUTH exchange contains 3 transforms. 1264 1264 // … … 1430 1430 // 1431 1431 // Create a SpdSelector. In this implementation, one SPD represents 1432 // 2 direction traffic, so in here, there needs to reverse the local address 1432 // 2 direction traffic, so in here, there needs to reverse the local address 1433 1433 // and remote address for Remote Peer's SA, then reverse again for the locate 1434 // SA. 1434 // SA. 1435 1435 // 1436 1436 TempAddressCount = ChildSaSession->SpdSelector->LocalAddressCount; … … 1457 1457 if (SaData.Mode == EfiIPsecTunnel) { 1458 1458 CopyMem ( 1459 &SaData.TunnelSourceAddress, 1459 &SaData.TunnelSourceAddress, 1460 1460 &ChildSaSession->Spd->Data->ProcessingPolicy->TunnelOption->RemoteTunnelAddress, 1461 1461 sizeof (EFI_IP_ADDRESS) … … 1486 1486 // 1487 1487 // Store the local SA into SAD. 1488 // 1488 // 1489 1489 ChildSaSession->SpdSelector->RemoteAddressCount = ChildSaSession->SpdSelector->LocalAddressCount; 1490 1490 ChildSaSession->SpdSelector->RemoteAddress = ChildSaSession->SpdSelector->LocalAddress; … … 1492 1492 ChildSaSession->SpdSelector->LocalAddress = TempAddressInfo; 1493 1493 ChildSaSession->SpdSelector->LocalAddressCount = TempAddressCount; 1494 1494 1495 1495 SaId.Spi = ChildSaSession->RemotePeerSpi; 1496 1496 … … 1529 1529 Call back function of the IKE life time is over. 1530 1530 1531 This function will mark the related IKE SA Session as deleting and trigger a 1531 This function will mark the related IKE SA Session as deleting and trigger a 1532 1532 Information negotiation. 1533 1533 1534 1534 @param[in] Event The signaled Event. 1535 1535 @param[in] Context Pointer to data passed by caller. 1536 1536 1537 1537 **/ 1538 1538 VOID … … 1576 1576 // 1577 1577 // Change the Child SA Session's State to IKE_STATE_SA_DELETING. 1578 // 1578 // 1579 1579 DEBUG (( 1580 1580 DEBUG_INFO, … … 1612 1612 EFI_STATUS Status; 1613 1613 1614 ASSERT (Context != NULL); 1614 ASSERT (Context != NULL); 1615 1615 IkeSaSession = NULL; 1616 1616 ChildSaSession = NULL; … … 1688 1688 1689 1689 // 1690 // Established Child SA should be remove from the SAD entry and 1691 // DeleteList. The function of Ikev2DeleteChildSaSilent() will remove 1692 // the childSA from the IkeSaSession->ChildSaEstablishedList. So there 1690 // Established Child SA should be remove from the SAD entry and 1691 // DeleteList. The function of Ikev2DeleteChildSaSilent() will remove 1692 // the childSA from the IkeSaSession->ChildSaEstablishedList. So there 1693 1693 // is no need to remove it here. 1694 1694 // … … 1733 1733 1734 1734 ChildSaSession->SpdSelector stores the real Spdselector for its SA. Sometime, 1735 the SpdSelector in ChildSaSession is more accurated or the scope is smaller 1735 the SpdSelector in ChildSaSession is more accurated or the scope is smaller 1736 1736 than the one in ChildSaSession->Spd, especially for the tunnel mode. 1737 1737 1738 1738 @param[in, out] ChildSaSession Pointer to IKEV2_CHILD_SA_SESSION related to. 1739 1739 1740 1740 **/ 1741 1741 VOID 1742 1742 Ikev2ChildSaSessionSpdSelectorCreate ( 1743 1743 IN OUT IKEV2_CHILD_SA_SESSION *ChildSaSession 1744 ) 1744 ) 1745 1745 { 1746 1746 if (ChildSaSession->Spd != NULL && ChildSaSession->Spd->Selector != NULL) { … … 1750 1750 } 1751 1751 CopyMem ( 1752 ChildSaSession->SpdSelector, 1753 ChildSaSession->Spd->Selector, 1752 ChildSaSession->SpdSelector, 1753 ChildSaSession->Spd->Selector, 1754 1754 sizeof (EFI_IPSEC_SPD_SELECTOR) 1755 1755 ); 1756 1756 ChildSaSession->SpdSelector->RemoteAddress = AllocateCopyPool ( 1757 ChildSaSession->Spd->Selector->RemoteAddressCount * 1758 sizeof (EFI_IP_ADDRESS_INFO), 1757 ChildSaSession->Spd->Selector->RemoteAddressCount * 1758 sizeof (EFI_IP_ADDRESS_INFO), 1759 1759 ChildSaSession->Spd->Selector->RemoteAddress 1760 1760 ); 1761 1761 ChildSaSession->SpdSelector->LocalAddress = AllocateCopyPool ( 1762 ChildSaSession->Spd->Selector->LocalAddressCount * 1763 sizeof (EFI_IP_ADDRESS_INFO), 1762 ChildSaSession->Spd->Selector->LocalAddressCount * 1763 sizeof (EFI_IP_ADDRESS_INFO), 1764 1764 ChildSaSession->Spd->Selector->LocalAddress 1765 1765 ); … … 1769 1769 1770 1770 ChildSaSession->SpdSelector->RemoteAddressCount = ChildSaSession->Spd->Selector->RemoteAddressCount; 1771 ChildSaSession->SpdSelector->LocalAddressCount = ChildSaSession->Spd->Selector->LocalAddressCount; 1771 ChildSaSession->SpdSelector->LocalAddressCount = ChildSaSession->Spd->Selector->LocalAddressCount; 1772 1772 } 1773 1773 } … … 1799 1799 // 1800 1800 // Set the specific parameters. 1801 // 1801 // 1802 1802 ChildSaSession->Spd = IkeSaSession->Spd; 1803 1803 ChildSaCommon = &ChildSaSession->SessionCommon; … … 1832 1832 1833 1833 // 1834 // Only if the Create Child SA is called for the IKE_INIT Exchange and 1835 // IkeSaSession is initiator (Only Initiator's SPD is not NULL), Set the 1834 // Only if the Create Child SA is called for the IKE_INIT Exchange and 1835 // IkeSaSession is initiator (Only Initiator's SPD is not NULL), Set the 1836 1836 // Traffic Selectors related information here. 1837 1837 // … … 1853 1853 1854 1854 This function is the subfunction of Ikev1AssociateSpdEntry(). It is the call 1855 back function of IpSecVisitConfigData(). 1856 1855 back function of IpSecVisitConfigData(). 1856 1857 1857 1858 1858 @param[in] Type Type of the input Config Selector. 1859 @param[in] Selector Pointer to the Configure Selector to be checked. 1860 @param[in] Data Pointer to the Configure Selector's Data passed 1859 @param[in] Selector Pointer to the Configure Selector to be checked. 1860 @param[in] Data Pointer to the Configure Selector's Data passed 1861 1861 from the caller. 1862 1862 @param[in] SelectorSize The buffer size of Selector. … … 1865 1865 SA Session in this context. 1866 1866 1867 @retval EFI_SUCCESS The SPD Selector is not related to the Child SA Session. 1868 @retval EFI_ABORTED The SPD Selector is related to the Child SA session and 1867 @retval EFI_SUCCESS The SPD Selector is not related to the Child SA Session. 1868 @retval EFI_ABORTED The SPD Selector is related to the Child SA session and 1869 1869 set the ChildSaSession->Spd to point to this SPD Selector. 1870 1870 … … 1897 1897 ChildSaSession = (IKEV2_CHILD_SA_SESSION *) Context; 1898 1898 IpVersion = ChildSaSession->SessionCommon.UdpService->IpVersion; 1899 SpdSelector = (EFI_IPSEC_SPD_SELECTOR *) Selector; 1899 SpdSelector = (EFI_IPSEC_SPD_SELECTOR *) Selector; 1900 1900 IsMatch = TRUE; 1901 1901 … … 1926 1926 } 1927 1927 1928 IsMatch = (BOOLEAN) (IsMatch && 1928 IsMatch = (BOOLEAN) (IsMatch && 1929 1929 IpSecMatchIpAddress ( 1930 1930 IpVersion, … … 1934 1934 )); 1935 1935 1936 IsMatch = (BOOLEAN) (IsMatch && 1936 IsMatch = (BOOLEAN) (IsMatch && 1937 1937 IpSecMatchIpAddress ( 1938 1938 IpVersion, … … 2008 2008 @param[in] ProposalData Pointer to related IKEV2_PROPOSAL_DATA. 2009 2009 @param[out] PreferEncryptAlgorithm Output of preferred encrypt algorithm. 2010 @param[out] PreferIntegrityAlgorithm Output of preferred integrity algorithm. 2011 @param[out] PreferPrfAlgorithm Output of preferred PRF algorithm. Only 2010 @param[out] PreferIntegrityAlgorithm Output of preferred integrity algorithm. 2011 @param[out] PreferPrfAlgorithm Output of preferred PRF algorithm. Only 2012 2012 for IKE SA. 2013 @param[out] PreferDhGroup Output of preferred DH group. Only for 2013 @param[out] PreferDhGroup Output of preferred DH group. Only for 2014 2014 IKE SA. 2015 @param[out] PreferEncryptKeylength Output of preferred encrypt key length 2015 @param[out] PreferEncryptKeylength Output of preferred encrypt key length 2016 2016 in bytes. 2017 2017 @param[out] IsSupportEsn Output of value about the Extented Sequence … … 2023 2023 VOID 2024 2024 Ikev2ParseProposalData ( 2025 IN IKEV2_PROPOSAL_DATA *ProposalData, 2025 IN IKEV2_PROPOSAL_DATA *ProposalData, 2026 2026 OUT UINT16 *PreferEncryptAlgorithm, 2027 2027 OUT UINT16 *PreferIntegrityAlgorithm, … … 2031 2031 OUT BOOLEAN *IsSupportEsn, 2032 2032 IN BOOLEAN IsChildSa 2033 ) 2033 ) 2034 2034 { 2035 2035 IKEV2_TRANSFORM_DATA *TransformData; … … 2040 2040 // 2041 2041 if (ProposalData == NULL || 2042 PreferEncryptAlgorithm == NULL || 2042 PreferEncryptAlgorithm == NULL || 2043 2043 PreferIntegrityAlgorithm == NULL || 2044 2044 PreferEncryptKeylength == NULL … … 2055 2055 return; 2056 2056 } 2057 } 2057 } 2058 2058 2059 2059 TransformData = (IKEV2_TRANSFORM_DATA *)(ProposalData + 1); 2060 2060 for (TransformIndex = 0; TransformIndex < ProposalData->NumTransforms; TransformIndex++) { 2061 switch (TransformData->TransformType) { 2062 // 2063 // For IKE SA there are four algorithm types. Encryption Algorithm, Pseudo-random Function, 2064 // Integrity Algorithm, Diffie-Hellman Group. For Child SA, there are three algorithm types. 2061 switch (TransformData->TransformType) { 2062 // 2063 // For IKE SA there are four algorithm types. Encryption Algorithm, Pseudo-random Function, 2064 // Integrity Algorithm, Diffie-Hellman Group. For Child SA, there are three algorithm types. 2065 2065 // Encryption Algorithm, Integrity Algorithm, Extended Sequence Number. 2066 2066 // … … 2089 2089 *PreferPrfAlgorithm = TransformData->TransformId; 2090 2090 } 2091 } 2091 } 2092 2092 break; 2093 2093 … … 2097 2097 } 2098 2098 break; 2099 2099 2100 2100 case IKEV2_TRANSFORM_TYPE_DH : 2101 2101 if (!IsChildSa) { … … 2103 2103 *PreferDhGroup = TransformData->TransformId; 2104 2104 } 2105 } 2105 } 2106 2106 break; 2107 2107 2108 2108 case IKEV2_TRANSFORM_TYPE_ESN : 2109 2109 if (IsChildSa) { … … 2111 2111 *IsSupportEsn = TRUE; 2112 2112 } 2113 } 2113 } 2114 2114 break; 2115 2115 … … 2123 2123 /** 2124 2124 Parse the received Initial Exchange Packet. 2125 2126 This function parse the SA Payload and Key Payload to find out the cryptographic 2127 suite for the further IKE negotiation and fill it into the IKE SA Session's 2125 2126 This function parse the SA Payload and Key Payload to find out the cryptographic 2127 suite for the further IKE negotiation and fill it into the IKE SA Session's 2128 2128 CommonSession->SaParams. 2129 2129 2130 2130 @param[in, out] IkeSaSession Pointer to related IKEV2_SA_SESSION. 2131 2131 @param[in] SaPayload The received packet. 2132 @param[in] Type The received packet IKE header flag. 2132 @param[in] Type The received packet IKE header flag. 2133 2133 2134 2134 @retval TRUE If the SA proposal in Packet is acceptable. … … 2181 2181 // 2182 2182 Ikev2ParseProposalData ( 2183 ProposalData, 2183 ProposalData, 2184 2184 &PreferEncryptAlgorithm, 2185 2185 &PreferIntegrityAlgorithm, … … 2193 2193 if (PreferEncryptAlgorithm != 0 && 2194 2194 PreferIntegrityAlgorithm != 0 && 2195 PreferPrfAlgorithm != 0 && 2195 PreferPrfAlgorithm != 0 && 2196 2196 PreferDhGroup != 0 2197 2197 ) { 2198 2198 // 2199 // Find the matched one. 2199 // Find the matched one. 2200 2200 // 2201 2201 IkeSaSession->SessionCommon.SaParams = AllocateZeroPool (sizeof (IKEV2_SA_PARAMS)); … … 2225 2225 // 2226 2226 CopyMem ( 2227 (IKEV2_PROPOSAL_DATA *) (IkeSaSession->SaData + 1), 2228 ProposalData, 2227 (IKEV2_PROPOSAL_DATA *) (IkeSaSession->SaData + 1), 2228 ProposalData, 2229 2229 SaDataSize - sizeof (IKEV2_SA_DATA) 2230 2230 ); … … 2243 2243 // Point to next Proposal. 2244 2244 // 2245 ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) + 2245 ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) + 2246 2246 ProposalData->NumTransforms * sizeof (IKEV2_TRANSFORM_DATA)); 2247 2247 } 2248 2248 } else if (Type == IKE_HEADER_FLAGS_RESPOND) { 2249 2249 // 2250 // First check the SA proposal's ProtoctolID and Transform Numbers. Since it is 2251 // the responded SA proposal, suppose it only has one proposal and the transform Numbers 2252 // is 4. 2250 // First check the SA proposal's ProtoctolID and Transform Numbers. Since it is 2251 // the responded SA proposal, suppose it only has one proposal and the transform Numbers 2252 // is 4. 2253 2253 // 2254 2254 ProposalData = (IKEV2_PROPOSAL_DATA *)((IKEV2_SA_DATA *) SaPayload->PayloadBuf + 1); … … 2257 2257 } 2258 2258 // 2259 // Get the preferred algorithms. 2259 // Get the preferred algorithms. 2260 2260 // 2261 2261 Ikev2ParseProposalData ( … … 2266 2266 &PreferDhGroup, 2267 2267 &PreferEncryptKeylength, 2268 NULL, 2268 NULL, 2269 2269 FALSE 2270 2270 ); 2271 // 2271 // 2272 2272 // Check if the Sa proposal data from received packet is in the IkeSaSession->SaData. 2273 2273 // … … 2276 2276 for (ProposalIndex = 0; ProposalIndex < IkeSaSession->SaData->NumProposals && (!IsMatch); ProposalIndex++) { 2277 2277 Ikev2ParseProposalData ( 2278 ProposalData, 2278 ProposalData, 2279 2279 &EncryptAlgorithm, 2280 2280 &IntegrityAlgorithm, … … 2297 2297 PrfAlgorithm = 0; 2298 2298 DhGroup = 0; 2299 EncryptKeylength = 0; 2299 EncryptKeylength = 0; 2300 2300 } 2301 2301 2302 ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) + 2303 ProposalData->NumTransforms * sizeof (IKEV2_TRANSFORM_DATA)); 2302 ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) + 2303 ProposalData->NumTransforms * sizeof (IKEV2_TRANSFORM_DATA)); 2304 2304 } 2305 2305 … … 2313 2313 IkeSaSession->SessionCommon.SaParams->IntegAlgId = PreferIntegrityAlgorithm; 2314 2314 IkeSaSession->SessionCommon.PreferDhGroup = PreferDhGroup; 2315 2315 2316 2316 return TRUE; 2317 2317 } … … 2322 2322 /** 2323 2323 Parse the received Authentication Exchange Packet. 2324 2324 2325 2325 This function parse the SA Payload and Key Payload to find out the cryptographic 2326 2326 suite for the ESP and fill it into the Child SA Session's CommonSession->SaParams. 2327 2328 @param[in, out] ChildSaSession Pointer to IKEV2_CHILD_SA_SESSION related to 2327 2328 @param[in, out] ChildSaSession Pointer to IKEV2_CHILD_SA_SESSION related to 2329 2329 this Authentication Exchange. 2330 2330 @param[in] SaPayload The received packet. 2331 @param[in] Type The IKE header's flag of received packet . 2332 2331 @param[in] Type The IKE header's flag of received packet . 2332 2333 2333 @retval TRUE If the SA proposal in Packet is acceptable. 2334 2334 @retval FALSE If the SA proposal in Packet is not acceptable. … … 2389 2389 // Don't support the ESN now. 2390 2390 // 2391 if (PreferEncryptAlgorithm != 0 && 2391 if (PreferEncryptAlgorithm != 0 && 2392 2392 PreferIntegrityAlgorithm != 0 && 2393 2393 !IsSupportEsn 2394 2394 ) { 2395 2395 // 2396 // Find the matched one. 2396 // Find the matched one. 2397 2397 // 2398 2398 ChildSaSession->SessionCommon.SaParams = AllocateZeroPool (sizeof (IKEV2_SA_PARAMS)); … … 2417 2417 // 2418 2418 // BUGBUG: Suppose there are 4 transforms in the matched proposal. If 2419 // the matched Proposal has more than 4 transforms that means there 2419 // the matched Proposal has more than 4 transforms that means there 2420 2420 // are more than one transform with same type. 2421 2421 // … … 2429 2429 2430 2430 ((IKEV2_PROPOSAL_DATA *) (ChildSaSession->SaData + 1))->Spi = AllocateCopyPool ( 2431 sizeof (ChildSaSession->LocalPeerSpi), 2431 sizeof (ChildSaSession->LocalPeerSpi), 2432 2432 &ChildSaSession->LocalPeerSpi 2433 2433 ); … … 2444 2444 // Point to next Proposal 2445 2445 // 2446 ProposalData = (IKEV2_PROPOSAL_DATA *)((UINT8 *)(ProposalData + 1) + 2446 ProposalData = (IKEV2_PROPOSAL_DATA *)((UINT8 *)(ProposalData + 1) + 2447 2447 ProposalData->NumTransforms * sizeof (IKEV2_TRANSFORM_DATA)); 2448 2448 } 2449 2449 } else if (Type == IKE_HEADER_FLAGS_RESPOND) { 2450 2450 // 2451 // First check the SA proposal's ProtoctolID and Transform Numbers. Since it is 2452 // the responded SA proposal, suppose it only has one proposal and the transform Numbers 2453 // is 3. 2451 // First check the SA proposal's ProtoctolID and Transform Numbers. Since it is 2452 // the responded SA proposal, suppose it only has one proposal and the transform Numbers 2453 // is 3. 2454 2454 // 2455 2455 ProposalData = (IKEV2_PROPOSAL_DATA *)((IKEV2_SA_DATA *)SaPayload->PayloadBuf + 1); … … 2475 2475 for (ProposalIndex = 0; ProposalIndex < ChildSaSession->SaData->NumProposals && (!IsMatch); ProposalIndex++) { 2476 2476 Ikev2ParseProposalData ( 2477 ProposalData, 2477 ProposalData, 2478 2478 &EncryptAlgorithm, 2479 2479 &IntegrityAlgorithm, … … 2487 2487 EncryptKeylength == PreferEncryptKeylength && 2488 2488 IntegrityAlgorithm == PreferIntegrityAlgorithm && 2489 IsSupportEsn == PreferIsSupportEsn 2489 IsSupportEsn == PreferIsSupportEsn 2490 2490 ) { 2491 2491 IsMatch = TRUE; … … 2495 2495 IsSupportEsn = TRUE; 2496 2496 } 2497 ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) + 2498 ProposalData->NumTransforms * sizeof (IKEV2_TRANSFORM_DATA)); 2499 } 2500 2497 ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) + 2498 ProposalData->NumTransforms * sizeof (IKEV2_TRANSFORM_DATA)); 2499 } 2500 2501 2501 ProposalData = (IKEV2_PROPOSAL_DATA *)((IKEV2_SA_DATA *)SaPayload->PayloadBuf + 1); 2502 2502 if (IsMatch) { … … 2517 2517 Generate Key buffer from fragments. 2518 2518 2519 If the digest length of specified HashAlgId is larger than or equal with the 2520 required output key length, derive the key directly. Otherwise, Key Material 2521 needs to be PRF-based concatenation according to 2.13 of RFC 4306: 2519 If the digest length of specified HashAlgId is larger than or equal with the 2520 required output key length, derive the key directly. Otherwise, Key Material 2521 needs to be PRF-based concatenation according to 2.13 of RFC 4306: 2522 2522 prf+ (K,S) = T1 | T2 | T3 | T4 | ..., T1 = prf (K, S | 0x01), 2523 2523 T2 = prf (K, T1 | S | 0x02), T3 = prf (K, T2 | S | 0x03),T4 = prf (K, T3 | S | 0x04) 2524 2524 then derive the key from this key material. 2525 2525 2526 2526 @param[in] HashAlgId The Hash Algorithm ID used to generate key. 2527 2527 @param[in] HashKey Pointer to a key buffer which contains hash key. 2528 2528 @param[in] HashKeyLength The length of HashKey in bytes. 2529 @param[in, out] OutputKey Pointer to buffer which is used to receive the 2529 @param[in, out] OutputKey Pointer to buffer which is used to receive the 2530 2530 output key. 2531 2531 @param[in] OutputKeyLength The length of OutPutKey buffer. … … 2584 2584 Status = IpSecCryptoIoHmac ( 2585 2585 HashAlgId, 2586 HashKey, 2587 HashKeyLength, 2588 (HASH_DATA_FRAGMENT *) Fragments, 2589 NumFragments, 2590 Digest, 2586 HashKey, 2587 HashKeyLength, 2588 (HASH_DATA_FRAGMENT *) Fragments, 2589 NumFragments, 2590 Digest, 2591 2591 DigestSize 2592 2592 ); … … 2620 2620 for (Index = 0; Index < NumFragments; Index++) { 2621 2621 CopyMem ( 2622 LocalFragments[1].Data + FragmentsSize, 2622 LocalFragments[1].Data + FragmentsSize, 2623 2623 Fragments[Index].Data, 2624 2624 Fragments[Index].DataSize … … 2643 2643 for (Index = 0; Index < Round; Index++) { 2644 2644 Status = IpSecCryptoIoHmac ( 2645 HashAlgId, 2646 HashKey, 2647 HashKeyLength, 2645 HashAlgId, 2646 HashKey, 2647 HashKeyLength, 2648 2648 (HASH_DATA_FRAGMENT *)(Index == 0 ? &LocalFragments[1] : LocalFragments), 2649 Index == 0 ? 2 : 3, 2649 Index == 0 ? 2 : 3, 2650 2650 Digest, 2651 2651 DigestSize … … 2655 2655 } 2656 2656 CopyMem ( 2657 LocalFragments[0].Data, 2658 Digest, 2657 LocalFragments[0].Data, 2658 Digest, 2659 2659 DigestSize 2660 2660 ); 2661 2661 if (OutputKeyLength > DigestSize * (Index + 1)) { 2662 2662 CopyMem ( 2663 OutputKey + Index * DigestSize, 2664 Digest, 2663 OutputKey + Index * DigestSize, 2664 Digest, 2665 2665 DigestSize 2666 2666 ); … … 2668 2668 TailData ++; 2669 2669 } else { 2670 // 2670 // 2671 2671 // The last round 2672 2672 // 2673 2673 CopyMem ( 2674 OutputKey + Index * DigestSize, 2675 Digest, 2674 OutputKey + Index * DigestSize, 2675 Digest, 2676 2676 OutputKeyLength - Index * DigestSize 2677 2677 ); -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/Ikev2/Utility.h
r48674 r58466 1 1 /** @file 2 The interfaces of IKE/Child session operations and payload related operations 2 The interfaces of IKE/Child session operations and payload related operations 3 3 used by IKE Exchange Process. 4 4 … … 77 77 78 78 @param[in] SaSessionList Pointer to list to be inserted into. 79 @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION to be inserted. 80 @param[in] RemotePeerIp Pointer to EFI_IP_ADDRESSS to indicate the 79 @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION to be inserted. 80 @param[in] RemotePeerIp Pointer to EFI_IP_ADDRESSS to indicate the 81 81 unique IKEV2_SA_SESSION. 82 82 … … 95 95 @param[in] RemotePeerIp Pointer to EFI_IP_ADDRESS to use for SA Session search. 96 96 97 @retval Pointer to IKEV2_SA_SESSION with the specified remote IP address. 97 @retval Pointer to IKEV2_SA_SESSION with the specified remote IP address. 98 98 99 99 **/ … … 130 130 131 131 /** 132 Free specified IKEV2 SA Session. 132 Free specified IKEV2 SA Session. 133 133 134 134 @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION to be freed. … … 141 141 142 142 /** 143 Free specified Seession Common. The session common would belong to a IKE SA or 143 Free specified Seession Common. The session common would belong to a IKE SA or 144 144 a Child SA. 145 145 … … 165 165 /** 166 166 Allocate Momery for IKEV2 Child SA Session. 167 167 168 168 @param[in] UdpService Pointer to IKE_UDP_SERVICE. 169 @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION related to this Child SA 169 @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION related to this Child SA 170 170 Session. 171 171 … … 180 180 181 181 /** 182 Register a established IKEv2 Child SA into IkeSaSession->ChildSaEstablishSessionList. 183 If the there is IKEV2_CHILD_SA_SESSION with same remote peer IP, remove the old one 182 Register a established IKEv2 Child SA into IkeSaSession->ChildSaEstablishSessionList. 183 If the there is IKEV2_CHILD_SA_SESSION with same remote peer IP, remove the old one 184 184 then register the new one. 185 185 … … 199 199 This functin find a ChildSA session by searching the ChildSaSessionlist of 200 200 the input IKEV2_SA_SESSION by specified MessageID. 201 201 202 202 @param[in] SaSessionList Pointer to List to be searched. 203 203 @param[in] Spi Specified SPI. … … 242 242 /** 243 243 Remove the IKEV2_CHILD_SA_SESSION from IkeSaSessionList. 244 244 245 245 @param[in] SaSessionList The SA Session List to be iterated. 246 246 @param[in] Spi Spi used to identify the IKEV2_CHILD_SA_SESSION. 247 @param[in] ListType The type of the List to indicate whether it is a 248 Established. 247 @param[in] ListType The type of the List to indicate whether it is a 248 Established. 249 249 250 250 @return The point to IKEV2_CHILD_SA_SESSION. 251 251 252 252 **/ 253 253 IKEV2_CHILD_SA_SESSION * 254 254 Ikev2ChildSaSessionRemove ( 255 255 IN LIST_ENTRY *SaSessionList, 256 IN UINT32 Spi, 257 IN UINT8 ListType 256 IN UINT32 Spi, 257 IN UINT8 ListType 258 258 ); 259 259 … … 272 272 273 273 /** 274 Free the memory located for the specified IKEV2_CHILD_SA_SESSION. 274 Free the memory located for the specified IKEV2_CHILD_SA_SESSION. 275 275 276 276 @param[in] ChildSaSession Pointer to IKEV2_CHILD_SA_SESSION. … … 286 286 287 287 @param[in] DhBuffer Pointer to IKEV2_DH_BUFFER to be freed. 288 288 289 289 **/ 290 290 VOID … … 316 316 /** 317 317 This function is to parse a request IKE packet and return its request type. 318 The request type is one of IKE CHILD SA creation, IKE SA rekeying and 318 The request type is one of IKE CHILD SA creation, IKE SA rekeying and 319 319 IKE CHILD SA rekeying. 320 320 … … 331 331 /** 332 332 This function finds the SPI from Create Child Sa Exchange Packet. 333 333 334 334 @param[in] IkePacket Pointer to IKE_PACKET to be searched. 335 335 … … 346 346 Associate a SPD selector to the Child SA Session. 347 347 348 This function is called when the Child SA is not the first child SA of its 348 This function is called when the Child SA is not the first child SA of its 349 349 IKE SA. It associate a SPD to this Child SA. 350 350 351 @param[in, out] ChildSaSession Pointer to the Child SA Session to be associated to 351 @param[in, out] ChildSaSession Pointer to the Child SA Session to be associated to 352 352 a SPD selector. 353 353 … … 442 442 443 443 @param[in] SessionSaData The data used in SA payload. 444 @param[in] NextPayload The payload type presented in NextPayload field of 444 @param[in] NextPayload The payload type presented in NextPayload field of 445 445 SA Payload header. 446 446 @param[in] Type The SA type. It MUST be neither (1) for IKE_SA or … … 448 448 449 449 @retval a Pointer to SA IKE payload. 450 450 451 451 **/ 452 452 IKE_PAYLOAD * … … 461 461 462 462 @param[in] CommonSession Pointer to IKEV2_SESSION_COMMON related to ID payload. 463 @param[in] NextPayload The payload type presented in the NextPayload field 463 @param[in] NextPayload The payload type presented in the NextPayload field 464 464 of ID Payload header. 465 465 … … 477 477 478 478 @param[in] CommonSession Pointer to IKEV2_SESSION_COMMON related to ID payload. 479 @param[in] NextPayload The payload type presented in the NextPayload field 479 @param[in] NextPayload The payload type presented in the NextPayload field 480 480 of ID Payload header. 481 481 @param[in] InCert Pointer to the Certificate which distinguished name … … 489 489 Ikev2GenerateCertIdPayload ( 490 490 IN IKEV2_SESSION_COMMON *CommonSession, 491 IN UINT8 NextPayload, 491 IN UINT8 NextPayload, 492 492 IN UINT8 *InCert, 493 493 IN UINTN CertSize … … 497 497 Generate a Nonce payload contenting the input parameter NonceBuf. 498 498 499 @param[in] NonceBuf The nonce buffer content the whole Nonce payload block 499 @param[in] NonceBuf The nonce buffer content the whole Nonce payload block 500 500 except the payload header. 501 501 @param[in] NonceSize The buffer size of the NonceBuf 502 @param[in] NextPayload The payload type presented in the NextPayload field 502 @param[in] NextPayload The payload type presented in the NextPayload field 503 503 of Nonce Payload header. 504 504 … … 517 517 518 518 Since the structure of Notify payload which defined in RFC 4306 is simple, so 519 there is no internal data structure for Notify payload. This function generate 520 Notify payload defined in RFC 4306, but all the fields in this payload are still 521 in host order and need call Ikev2EncodePayload() to convert those fields from 519 there is no internal data structure for Notify payload. This function generate 520 Notify payload defined in RFC 4306, but all the fields in this payload are still 521 in host order and need call Ikev2EncodePayload() to convert those fields from 522 522 the host order to network order beforing sending it. 523 523 … … 525 525 For IPsec SAs it MUST be neither (2) for AH or (3) 526 526 for ESP. 527 @param[in] NextPayload The next paylaod type in NextPayload field of 527 @param[in] NextPayload The next paylaod type in NextPayload field of 528 528 the Notify payload. 529 529 @param[in] SpiSize Size of the SPI in SPI size field of the Notify Payload. 530 @param[in] MessageType The message type in NotifyMessageType field of the 530 @param[in] MessageType The message type in NotifyMessageType field of the 531 531 Notify Payload. 532 532 @param[in] SpiBuf Pointer to buffer contains the SPI value. 533 533 @param[in] NotifyData Pointer to buffer contains the notification data. 534 534 @param[in] NotifyDataSize The size of NotifyData in bytes. 535 535 536 536 537 537 @retval Pointer to IKE Notify Payload. … … 552 552 Generate the Delete payload. 553 553 554 Since the structure of Delete payload which defined in RFC 4306 is simple, 555 there is no internal data structure for Delete payload. This function generate 556 Delete payload defined in RFC 4306, but all the fields in this payload are still 557 in host order and need call Ikev2EncodePayload() to convert those fields from 554 Since the structure of Delete payload which defined in RFC 4306 is simple, 555 there is no internal data structure for Delete payload. This function generate 556 Delete payload defined in RFC 4306, but all the fields in this payload are still 557 in host order and need call Ikev2EncodePayload() to convert those fields from 558 558 the host order to network order beforing sending it. 559 559 560 560 @param[in] IkeSaSession Pointer to IKE SA Session to be used of Delete payload generation. 561 @param[in] NextPayload The next paylaod type in NextPayload field of 561 @param[in] NextPayload The next paylaod type in NextPayload field of 562 562 the Delete payload. 563 563 @param[in] SpiSize Size of the SPI in SPI size field of the Delete Payload. … … 574 574 IN UINT8 SpiSize, 575 575 IN UINT16 SpiNum, 576 IN UINT8 *SpiBuf 576 IN UINT8 *SpiBuf 577 577 ); 578 578 … … 580 580 Generate the Configuration payload. 581 581 582 This function generates a configuration payload defined in RFC 4306, but all the 583 fields in this payload are still in host order and need call Ikev2EncodePayload() 582 This function generates a configuration payload defined in RFC 4306, but all the 583 fields in this payload are still in host order and need call Ikev2EncodePayload() 584 584 to convert those fields from the host order to network order beforing sending it. 585 585 586 586 @param[in] IkeSaSession Pointer to IKE SA Session to be used for Delete payload 587 587 generation. 588 @param[in] NextPayload The next paylaod type in NextPayload field of 588 @param[in] NextPayload The next paylaod type in NextPayload field of 589 589 the Delete payload. 590 590 @param[in] CfgType The attribute type in the Configuration attribute. … … 603 603 Generate a Authentication Payload. 604 604 605 This function is used for both Authentication generation and verification. When the 606 IsVerify is TRUE, it create a Auth Data for verification. This function choose the 605 This function is used for both Authentication generation and verification. When the 606 IsVerify is TRUE, it create a Auth Data for verification. This function choose the 607 607 related IKE_SA_INIT Message for Auth data creation according to the IKE Session's type 608 608 and the value of IsVerify parameter. 609 609 610 610 @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION related to. 611 @param[in] IdPayload Pointer to the ID payload to be used for Authentication 611 @param[in] IdPayload Pointer to the ID payload to be used for Authentication 612 612 payload generation. 613 @param[in] NextPayload The type filled into the Authentication Payload next 613 @param[in] NextPayload The type filled into the Authentication Payload next 614 614 payload field. 615 615 @param[in] IsVerify If it is TURE, the Authentication payload is used for … … 628 628 629 629 /** 630 Generate a Authentication Payload for Certificate Auth method. 631 632 This function has two functions. One is creating a local Authentication 633 Payload for sending and other is creating the remote Authentication data 630 Generate a Authentication Payload for Certificate Auth method. 631 632 This function has two functions. One is creating a local Authentication 633 Payload for sending and other is creating the remote Authentication data 634 634 for verification when the IsVerify is TURE. 635 635 636 636 @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION related to. 637 @param[in] IdPayload Pointer to the ID payload to be used for Authentication 637 @param[in] IdPayload Pointer to the ID payload to be used for Authentication 638 638 payload generation. 639 @param[in] NextPayload The type filled into the Authentication Payload 639 @param[in] NextPayload The type filled into the Authentication Payload 640 640 next payload field. 641 @param[in] IsVerify If it is TURE, the Authentication payload is used 641 @param[in] IsVerify If it is TURE, the Authentication payload is used 642 642 for verification. 643 @param[in] UefiPrivateKey Pointer to the UEFI private key. Ignore it when 643 @param[in] UefiPrivateKey Pointer to the UEFI private key. Ignore it when 644 644 verify the authenticate payload. 645 @param[in] UefiPrivateKeyLen The size of UefiPrivateKey in bytes. Ignore it 645 @param[in] UefiPrivateKeyLen The size of UefiPrivateKey in bytes. Ignore it 646 646 when verify the authenticate payload. 647 @param[in] UefiKeyPwd Pointer to the password of UEFI private key. 647 @param[in] UefiKeyPwd Pointer to the password of UEFI private key. 648 648 Ignore it when verify the authenticate payload. 649 @param[in] UefiKeyPwdLen The size of UefiKeyPwd in bytes.Ignore it when 649 @param[in] UefiKeyPwdLen The size of UefiKeyPwd in bytes.Ignore it when 650 650 verify the authenticate payload. 651 651 … … 671 671 If the next payload is Responder TS, gereate TSi Payload. Otherwise, generate 672 672 TSr payload 673 673 674 674 @param[in] ChildSa Pointer to IKEV2_CHILD_SA_SESSION related to this TS payload. 675 @param[in] NextPayload The payload type presented in the NextPayload field 675 @param[in] NextPayload The payload type presented in the NextPayload field 676 676 of ID Payload header. 677 677 @param[in] IsTunnel It indicates that if the Ts Payload is after the CP payload. … … 697 697 the COOKIE, return EFI_INVALID_PARAMETER. 698 698 699 @param[in] IkeNCookie Pointer to the IKE_PAYLOAD which contians the 699 @param[in] IkeNCookie Pointer to the IKE_PAYLOAD which contians the 700 700 Notify Cookie payload. 701 701 the Notify payload. … … 716 716 Generate the Certificate payload or Certificate Request Payload. 717 717 718 Since the Certificate Payload structure is same with Certificate Request Payload, 718 Since the Certificate Payload structure is same with Certificate Request Payload, 719 719 the only difference is that one contains the Certificate Data, other contains 720 the acceptable certificateion CA. This function generate Certificate payload 721 or Certificate Request Payload defined in RFC 4306, but all the fields 722 in the payload are still in host order and need call Ikev2EncodePayload() 720 the acceptable certificateion CA. This function generate Certificate payload 721 or Certificate Request Payload defined in RFC 4306, but all the fields 722 in the payload are still in host order and need call Ikev2EncodePayload() 723 723 to convert those fields from the host order to network order beforing sending it. 724 724 725 @param[in] IkeSaSession Pointer to IKE SA Session to be used of Delete payload 725 @param[in] IkeSaSession Pointer to IKE SA Session to be used of Delete payload 726 726 generation. 727 @param[in] NextPayload The next paylaod type in NextPayload field of 727 @param[in] NextPayload The next paylaod type in NextPayload field of 728 728 the Delete payload. 729 729 @param[in] Certificate Pointer of buffer contains the certification data. … … 748 748 IN BOOLEAN IsRequest 749 749 ); 750 750 751 751 /** 752 752 General interface of payload encoding. 753 753 754 This function encode the internal data structure into payload which 755 is defined in RFC 4306. The IkePayload->PayloadBuf used to store both the input 756 payload and converted payload. Only the SA payload use the interal structure 757 to store the attribute. Other payload use structure which is same with the RFC 758 defined, for this kind payloads just do host order to network order change of 754 This function encode the internal data structure into payload which 755 is defined in RFC 4306. The IkePayload->PayloadBuf used to store both the input 756 payload and converted payload. Only the SA payload use the interal structure 757 to store the attribute. Other payload use structure which is same with the RFC 758 defined, for this kind payloads just do host order to network order change of 759 759 some fields. 760 760 … … 780 780 @param[in] SessionCommon Pointer to IKE Session Common to use for decoding. 781 781 @param[in, out] IkePayload Pointer to IKE payload to be decode as input, and 782 store the decoded result as output. 782 store the decoded result as output. 783 783 784 784 @retval EFI_INVALID_PARAMETER Meet error when decode the SA payload. … … 797 797 This function decrpt the Encrypted IKE packet and put the result into IkePacket->PayloadBuf. 798 798 799 @param[in] SessionCommon Pointer to IKEV2_SESSION_COMMON containing 799 @param[in] SessionCommon Pointer to IKEV2_SESSION_COMMON containing 800 800 some parameter used during decrypting. 801 @param[in, out] IkePacket Point to IKE_PACKET to be decrypted as input, 801 @param[in, out] IkePacket Point to IKE_PACKET to be decrypted as input, 802 802 and the decrypted reslult as output. 803 803 @param[in, out] IkeType The type of IKE. IKE_SA_TYPE, IKE_INFO_TYPE and 804 804 IKE_CHILD_TYPE are supportted. 805 805 806 @retval EFI_INVALID_PARAMETER If the IKE packet length is zero or the 806 @retval EFI_INVALID_PARAMETER If the IKE packet length is zero or the 807 807 IKE packet length is not Algorithm Block Size 808 808 alignment. 809 809 @retval EFI_SUCCESS Decrypt IKE packet successfully. 810 810 811 811 **/ 812 812 EFI_STATUS … … 822 822 This function encrypt IKE packet before sending it. The Encrypted IKE packet 823 823 is put in to IKEV2 Encrypted Payload. 824 824 825 825 @param[in] SessionCommon Pointer to IKEV2_SESSION_COMMON related to the IKE packet. 826 826 @param[in, out] IkePacket Pointer to IKE packet to be encrypted. … … 841 841 This function put all Payloads into one payload then encrypt it if needed. 842 842 843 @param[in] SessionCommon Pointer to IKEV2_SESSION_COMMON containing 843 @param[in] SessionCommon Pointer to IKEV2_SESSION_COMMON containing 844 844 some parameter used during IKE packet encoding. 845 @param[in, out] IkePacket Pointer to IKE_PACKET to be encoded as input, 845 @param[in, out] IkePacket Pointer to IKE_PACKET to be encoded as input, 846 846 and the encoded reslult as output. 847 847 @param[in] IkeType The type of IKE. IKE_SA_TYPE, IKE_INFO_TYPE and … … 862 862 Decode the IKE packet. 863 863 864 This function first decrypts the IKE packet if needed , then separats the whole 864 This function first decrypts the IKE packet if needed , then separats the whole 865 865 IKE packet from the IkePacket->PayloadBuf into IkePacket payload list. 866 867 @param[in] SessionCommon Pointer to IKEV1_SESSION_COMMON containing 866 867 @param[in] SessionCommon Pointer to IKEV1_SESSION_COMMON containing 868 868 some parameter used by IKE packet decoding. 869 @param[in, out] IkePacket The IKE Packet to be decoded on input, and 869 @param[in, out] IkePacket The IKE Packet to be decoded on input, and 870 870 the decoded result on return. 871 871 @param[in] IkeType The type of IKE. IKE_SA_TYPE, IKE_INFO_TYPE and … … 905 905 @param[in] SessionCommon Pointer to IKEV1_SESSION_COMMON related to the IKE packet. 906 906 @param[in] IkePacket Pointer to IKE_PACKET to be sent out. 907 @param[in] IkeType The type of IKE to point what's kind of the IKE 908 packet is to be sent out. IKE_SA_TYPE, IKE_INFO_TYPE 907 @param[in] IkeType The type of IKE to point what's kind of the IKE 908 packet is to be sent out. IKE_SA_TYPE, IKE_INFO_TYPE 909 909 and IKE_CHILD_TYPE are supportted. 910 910 … … 924 924 Callback function for the IKE life time is over. 925 925 926 This function will mark the related IKE SA Session as deleting and trigger a 926 This function will mark the related IKE SA Session as deleting and trigger a 927 927 Information negotiation. 928 928 929 929 @param[in] Event The time out event. 930 930 @param[in] Context Pointer to data passed by caller. 931 931 932 932 **/ 933 933 VOID … … 953 953 954 954 /** 955 Generate a Key Exchange payload according to the DH group type and save the 955 Generate a Key Exchange payload according to the DH group type and save the 956 956 public Key into IkeSaSession IkeKey field. 957 957 958 958 @param[in, out] IkeSaSession Pointer of the IKE_SA_SESSION. 959 @param[in] NextPayload The payload type presented in the NextPayload field of Key 959 @param[in] NextPayload The payload type presented in the NextPayload field of Key 960 960 Exchange Payload header. 961 961 … … 965 965 IKE_PAYLOAD * 966 966 Ikev2GenerateKePayload ( 967 IN OUT IKEV2_SA_SESSION *IkeSaSession, 968 IN UINT8 NextPayload 967 IN OUT IKEV2_SA_SESSION *IkeSaSession, 968 IN UINT8 NextPayload 969 969 ); 970 970 … … 973 973 974 974 This function is the subfunction of Ikev1AssociateSpdEntry(). It is the call 975 back function of IpSecVisitConfigData(). 976 975 back function of IpSecVisitConfigData(). 976 977 977 978 978 @param[in] Type Type of the input Config Selector. 979 @param[in] Selector Pointer to the Configure Selector to be checked. 980 @param[in] Data Pointer to the Configure Selector's Data passed 979 @param[in] Selector Pointer to the Configure Selector to be checked. 980 @param[in] Data Pointer to the Configure Selector's Data passed 981 981 from the caller. 982 982 @param[in] SelectorSize The buffer size of Selector. … … 985 985 SA Session in this context. 986 986 987 @retval EFI_SUCCESS The SPD Selector is not related to the Child SA Session. 988 @retval EFI_ABORTED The SPD Selector is related to the Child SA session and 987 @retval EFI_SUCCESS The SPD Selector is not related to the Child SA Session. 988 @retval EFI_ABORTED The SPD Selector is related to the Child SA session and 989 989 set the ChildSaSession->Spd to point to this SPD Selector. 990 990 … … 1034 1034 /** 1035 1035 Parse the received Initial Exchange Packet. 1036 1037 This function parse the SA Payload and Key Payload to find out the cryptographic 1038 suite for the further IKE negotiation and fill it into the IKE SA Session's 1036 1037 This function parse the SA Payload and Key Payload to find out the cryptographic 1038 suite for the further IKE negotiation and fill it into the IKE SA Session's 1039 1039 CommonSession->SaParams. 1040 1040 1041 1041 @param[in, out] IkeSaSession Pointer to related IKEV2_SA_SESSION. 1042 1042 @param[in] SaPayload The received packet. 1043 @param[in] Type The received packet IKE header flag. 1043 @param[in] Type The received packet IKE header flag. 1044 1044 1045 1045 @retval TRUE If the SA proposal in Packet is acceptable. … … 1056 1056 /** 1057 1057 Parse the received Authentication Exchange Packet. 1058 1058 1059 1059 This function parse the SA Payload and Key Payload to find out the cryptographic 1060 1060 suite for the ESP and fill it into the Child SA Session's CommonSession->SaParams. 1061 1062 @param[in, out] ChildSaSession Pointer to IKEV2_CHILD_SA_SESSION related to 1061 1062 @param[in, out] ChildSaSession Pointer to IKEV2_CHILD_SA_SESSION related to 1063 1063 this Authentication Exchange. 1064 1064 @param[in] SaPayload The received packet. 1065 @param[in] Type The IKE header's flag of received packet . 1066 1065 @param[in] Type The IKE header's flag of received packet . 1066 1067 1067 @retval TRUE If the SA proposal in Packet is acceptable. 1068 1068 @retval FALSE If the SA proposal in Packet is not acceptable. … … 1079 1079 Generate Key buffer from fragments. 1080 1080 1081 If the digest length of specified HashAlgId is larger than or equal with the 1082 required output key length, derive the key directly. Otherwise, Key Material 1083 needs to be PRF-based concatenation according to 2.13 of RFC 4306: 1081 If the digest length of specified HashAlgId is larger than or equal with the 1082 required output key length, derive the key directly. Otherwise, Key Material 1083 needs to be PRF-based concatenation according to 2.13 of RFC 4306: 1084 1084 prf+ (K,S) = T1 | T2 | T3 | T4 | ..., T1 = prf (K, S | 0x01), 1085 1085 T2 = prf (K, T1 | S | 0x02), T3 = prf (K, T2 | S | 0x03),T4 = prf (K, T3 | S | 0x04) 1086 1086 then derive the key from this key material. 1087 1087 1088 1088 @param[in] HashAlgId The Hash Algorithm ID used to generate key. 1089 1089 @param[in] HashKey Pointer to a key buffer which contains hash key. 1090 1090 @param[in] HashKeyLength The length of HashKey in bytes. 1091 @param[in, out] OutputKey Pointer to buffer which is used to receive the 1091 @param[in, out] OutputKey Pointer to buffer which is used to receive the 1092 1092 output key. 1093 1093 @param[in] OutputKeyLength The length of OutPutKey buffer. … … 1116 1116 1117 1117 ChildSaSession->SpdSelector stores the real Spdselector for its SA. Sometime, 1118 the SpdSelector in ChildSaSession is more accurated or the scope is smaller 1118 the SpdSelector in ChildSaSession is more accurated or the scope is smaller 1119 1119 than the one in ChildSaSession->Spd, especially for the tunnel mode. 1120 1120 1121 1121 @param[in, out] ChildSaSession Pointer to IKEV2_CHILD_SA_SESSION related to. 1122 1122 1123 1123 **/ 1124 1124 VOID -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
r48674 r58466 98 98 to the internal data structure. 99 99 100 This founction is called by IpSecConfigInitialize() that is to intialize the 100 This founction is called by IpSecConfigInitialize() that is to intialize the 101 101 IPsecConfiguration Protocol. 102 102 … … 122 122 @retval TRUE The specified AddressInfo is in the AddressInfoList. 123 123 @retval FALSE The specified AddressInfo is not in the AddressInfoList. 124 124 125 125 **/ 126 126 BOOLEAN … … 153 153 &AddressInfoList[Index].Address, 154 154 sizeof (EFI_IP_ADDRESS) 155 ) == 0 && 155 ) == 0 && 156 156 AddressInfo->PrefixLength == AddressInfoList[Index].PrefixLength 157 ) { 157 ) { 158 158 return TRUE; 159 159 } … … 161 161 return FALSE; 162 162 } 163 163 164 164 /** 165 165 Compare two SPD Selectors. 166 166 167 167 Compare two SPD Selector by the fields of LocalAddressCount/RemoteAddressCount/ 168 NextLayerProtocol/LocalPort/LocalPortRange/RemotePort/RemotePortRange and the 168 NextLayerProtocol/LocalPort/LocalPortRange/RemotePort/RemotePortRange and the 169 169 Local Addresses and remote Addresses. 170 170 … … 174 174 @retval TRUE This two Selector have the same value in above fields. 175 175 @retval FALSE Not all above fields have the same value in these two Selectors. 176 176 177 177 **/ 178 178 BOOLEAN … … 194 194 // Compare the LocalAddressCount/RemoteAddressCount/NextLayerProtocol/ 195 195 // LocalPort/LocalPortRange/RemotePort/RemotePortRange fields in the 196 // two Spdselectors. Since the SPD supports two directions, it needs to 196 // two Spdselectors. Since the SPD supports two directions, it needs to 197 197 // compare two directions. 198 198 // … … 210 210 return IsMatch; 211 211 } 212 212 213 213 // 214 214 // Compare the all LocalAddress fields in the two Spdselectors. 215 // First, SpdSel1->LocalAddress to SpdSel2->LocalAddress && Compare 215 // First, SpdSel1->LocalAddress to SpdSel2->LocalAddress && Compare 216 216 // SpdSel1->RemoteAddress to SpdSel2->RemoteAddress. If all match, return 217 217 // TRUE. … … 264 264 } 265 265 // 266 // Finish the one direction compare. If it is matched, return; otherwise, 266 // Finish the one direction compare. If it is matched, return; otherwise, 267 267 // compare the other direction. 268 268 // … … 271 271 } 272 272 // 273 // Secondly, the SpdSel1->LocalAddress doesn't equal to SpdSel2->LocalAddress and 273 // Secondly, the SpdSel1->LocalAddress doesn't equal to SpdSel2->LocalAddress and 274 274 // SpdSel1->RemoteAddress doesn't equal to SpdSel2->RemoteAddress. Try to compare 275 275 // the RemoteAddress to LocalAddress. … … 329 329 330 330 Compare two SPD Selector by the fields of LocalAddressCount/RemoteAddressCount/ 331 NextLayerProtocol/LocalPort/LocalPortRange/RemotePort/RemotePortRange and the 331 NextLayerProtocol/LocalPort/LocalPortRange/RemotePort/RemotePortRange and the 332 332 Local Addresses and remote Addresses. 333 333 … … 336 336 337 337 @retval TRUE The first SPD Selector is subordinate Selector of second SPD Selector. 338 @retval FALSE The first SPD Selector is not subordinate Selector of second 338 @retval FALSE The first SPD Selector is not subordinate Selector of second 339 339 SPD Selector. 340 340 341 341 **/ 342 342 BOOLEAN … … 358 358 // Compare the LocalAddressCount/RemoteAddressCount/NextLayerProtocol/ 359 359 // LocalPort/LocalPortRange/RemotePort/RemotePortRange fields in the 360 // two Spdselectors. Since the SPD supports two directions, it needs to 360 // two Spdselectors. Since the SPD supports two directions, it needs to 361 361 // compare two directions. 362 362 // … … 371 371 IsMatch = FALSE; 372 372 } 373 373 374 374 // 375 375 // Compare the all LocalAddress fields in the two Spdselectors. 376 // First, SpdSel1->LocalAddress to SpdSel2->LocalAddress && Compare 376 // First, SpdSel1->LocalAddress to SpdSel2->LocalAddress && Compare 377 377 // SpdSel1->RemoteAddress to SpdSel2->RemoteAddress. If all match, return 378 378 // TRUE. … … 406 406 return IsMatch; 407 407 } 408 408 409 409 // 410 410 // … … 413 413 // Compare the LocalAddressCount/RemoteAddressCount/NextLayerProtocol/ 414 414 // LocalPort/LocalPortRange/RemotePort/RemotePortRange fields in the 415 // two Spdselectors. Since the SPD supports two directions, it needs to 415 // two Spdselectors. Since the SPD supports two directions, it needs to 416 416 // compare two directions. 417 417 // … … 428 428 return IsMatch; 429 429 } 430 430 431 431 // 432 432 // Compare the all LocalAddress fields in the two Spdselectors. 433 // First, SpdSel1->LocalAddress to SpdSel2->LocalAddress && Compare 433 // First, SpdSel1->LocalAddress to SpdSel2->LocalAddress && Compare 434 434 // SpdSel1->RemoteAddress to SpdSel2->RemoteAddress. If all match, return 435 435 // TRUE. … … 459 459 } 460 460 return IsMatch; 461 461 462 462 } 463 463 … … 470 470 @retval TRUE This two Selectors have the same SA ID. 471 471 @retval FALSE This two Selecotrs don't have the same SA ID. 472 472 473 473 **/ 474 474 BOOLEAN … … 501 501 @retval TRUE This two Selectors have the same PAD ID. 502 502 @retval FALSE This two Selecotrs don't have the same PAD ID. 503 503 504 504 **/ 505 505 BOOLEAN … … 590 590 BOOLEAN IsZero; 591 591 EFI_IPSEC_CONFIG_SELECTOR ZeroSelector; 592 592 593 593 IsZero = FALSE; 594 594 … … 637 637 @param[in, out] DstSel Pointer of Destination SPD Selector. 638 638 @param[in] SrcSel Pointer of Source SPD Selector. 639 @param[in, out] Size The size of the Destination SPD Selector. If it 640 not NULL and its value less than the size of 641 Source SPD Selector, the value of Source SPD 639 @param[in, out] Size The size of the Destination SPD Selector. If it 640 not NULL and its value less than the size of 641 Source SPD Selector, the value of Source SPD 642 642 Selector's size will be passed to caller by this 643 643 parameter. 644 644 645 645 @retval EFI_INVALID_PARAMETER If the Destination or Source SPD Selector is NULL 646 @retval EFI_BUFFER_TOO_SMALL If the input Size is less than size of the Source SPD Selector. 646 @retval EFI_BUFFER_TOO_SMALL If the input Size is less than size of the Source SPD Selector. 647 647 @retval EFI_SUCCESS Copy Source SPD Selector to the Destination SPD 648 648 Selector successfully. … … 703 703 @param[in, out] DstSel Pointer of Destination SA ID. 704 704 @param[in] SrcSel Pointer of Source SA ID. 705 @param[in, out] Size The size of the Destination SA ID. If it 706 not NULL and its value less than the size of 707 Source SA ID, the value of Source SA ID's size 705 @param[in, out] Size The size of the Destination SA ID. If it 706 not NULL and its value less than the size of 707 Source SA ID, the value of Source SA ID's size 708 708 will be passed to caller by this parameter. 709 709 710 710 @retval EFI_INVALID_PARAMETER If the Destination or Source SA ID is NULL. 711 @retval EFI_BUFFER_TOO_SMALL If the input Size less than size of source SA ID. 711 @retval EFI_BUFFER_TOO_SMALL If the input Size less than size of source SA ID. 712 712 @retval EFI_SUCCESS Copy Source SA ID to the Destination SA ID successfully. 713 713 … … 745 745 @param[in, out] DstSel Pointer of Destination PAD ID. 746 746 @param[in] SrcSel Pointer of Source PAD ID. 747 @param[in, out] Size The size of the Destination PAD ID. If it 748 not NULL and its value less than the size of 749 Source PAD ID, the value of Source PAD ID's size 747 @param[in, out] Size The size of the Destination PAD ID. If it 748 not NULL and its value less than the size of 749 Source PAD ID, the value of Source PAD ID's size 750 750 will be passed to caller by this parameter. 751 751 … … 783 783 784 784 /** 785 Fix the value of some members of SPD Selector. 786 787 This function is called by IpSecCopyPolicyEntry()which copy the Policy 788 Entry into the Variable. Since some members in SPD Selector are pointers, 789 a physical address to relative address convertion is required before copying 785 Fix the value of some members of SPD Selector. 786 787 This function is called by IpSecCopyPolicyEntry()which copy the Policy 788 Entry into the Variable. Since some members in SPD Selector are pointers, 789 a physical address to relative address convertion is required before copying 790 790 this SPD entry into the variable. 791 791 … … 818 818 819 819 /** 820 Fix the value of some members of SA ID. 821 822 This function is called by IpSecCopyPolicyEntry()which copy the Policy 823 Entry into the Variable. Since some members in SA ID are pointers, 824 a physical address to relative address conversion is required before copying 820 Fix the value of some members of SA ID. 821 822 This function is called by IpSecCopyPolicyEntry()which copy the Policy 823 Entry into the Variable. Since some members in SA ID are pointers, 824 a physical address to relative address conversion is required before copying 825 825 this SAD into the variable. 826 826 … … 859 859 860 860 /** 861 Fix the value of some members of PAD ID. 862 863 This function is called by IpSecCopyPolicyEntry()which copy the Policy 864 Entry into the Variable. Since some members in PAD ID are pointers, 861 Fix the value of some members of PAD ID. 862 863 This function is called by IpSecCopyPolicyEntry()which copy the Policy 864 Entry into the Variable. Since some members in PAD ID are pointers, 865 865 a physical address to relative address conversion is required before copying 866 866 this PAD into the variable. … … 891 891 892 892 /** 893 Recover the value of some members of SPD Selector. 893 Recover the value of some members of SPD Selector. 894 894 895 895 This function is corresponding to FixSpdEntry(). It recovers the value of members … … 919 919 } 920 920 } 921 922 } 923 924 /** 925 Recover the value of some members of SA ID. 921 922 } 923 924 /** 925 Recover the value of some members of SA ID. 926 926 927 927 This function is corresponding to FixSadEntry(). It recovers the value of members … … 962 962 963 963 /** 964 Recover the value of some members of PAD ID. 964 Recover the value of some members of PAD ID. 965 965 966 966 This function is corresponding to FixPadEntry(). It recovers the value of members … … 994 994 Set the security policy information for the EFI IPsec driver. 995 995 996 The IPsec configuration data has a unique selector/identifier separately to 996 The IPsec configuration data has a unique selector/identifier separately to 997 997 identify a data entry. 998 998 999 @param[in] Selector Pointer to an entry selector on operated 1000 configuration data specified by DataType. 1001 A NULL Selector causes the entire specified-type 999 @param[in] Selector Pointer to an entry selector on operated 1000 configuration data specified by DataType. 1001 A NULL Selector causes the entire specified-type 1002 1002 configuration information to be flushed. 1003 @param[in] Data The data buffer to be set. The structure 1003 @param[in] Data The data buffer to be set. The structure 1004 1004 of the data buffer should be EFI_IPSEC_SPD_DATA. 1005 @param[in] Context Pointer to one entry selector that describes 1006 the expected position the new data entry will 1005 @param[in] Context Pointer to one entry selector that describes 1006 the expected position the new data entry will 1007 1007 be added. If Context is NULL, the new entry will 1008 1008 be appended the end of database. 1009 1009 1010 1010 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: 1011 - Selector is not NULL and its LocalAddress 1011 - Selector is not NULL and its LocalAddress 1012 1012 is NULL or its RemoteAddress is NULL. 1013 - Data is not NULL and its Action is Protected 1013 - Data is not NULL and its Action is Protected 1014 1014 and its plolicy is NULL. 1015 1015 - Data is not NULL, its Action is not protected, 1016 1016 and its policy is not NULL. 1017 - The Action of Data is Protected, its policy 1017 - The Action of Data is Protected, its policy 1018 1018 mode is Tunnel, and its tunnel option is NULL. 1019 - The Action of Data is protected and its policy 1019 - The Action of Data is protected and its policy 1020 1020 mode is not Tunnel and it tunnel option is not NULL. 1021 1021 @retval EFI_OUT_OF_RESOURCED The required system resource could not be allocated. … … 1083 1083 SpdEntry = IPSEC_SPD_ENTRY_FROM_LIST (Entry); 1084 1084 1085 if (SpdSel == NULL || 1085 if (SpdSel == NULL || 1086 1086 CompareSpdSelector ((EFI_IPSEC_CONFIG_SELECTOR *) SpdEntry->Selector, (EFI_IPSEC_CONFIG_SELECTOR *) SpdSel) 1087 1087 ) { … … 1096 1096 // 1097 1097 SpdSas = &SpdEntry->Data->Sas; 1098 1098 1099 1099 // 1100 1100 // TODO: Deleted the related SAs. … … 1104 1104 SadEntry->Data->SpdEntry = NULL; 1105 1105 } 1106 1106 1107 1107 // 1108 1108 // Free the existed SPD entry … … 1206 1206 (EFI_IPSEC_CONFIG_SELECTOR *)SpdEntry->Selector, 1207 1207 NULL 1208 ); 1208 ); 1209 1209 } 1210 1210 } … … 1221 1221 Set the security association information for the EFI IPsec driver. 1222 1222 1223 The IPsec configuration data has a unique selector/identifier separately to 1223 The IPsec configuration data has a unique selector/identifier separately to 1224 1224 identify a data entry. 1225 1225 1226 @param[in] Selector Pointer to an entry selector on operated 1227 configuration data specified by DataType. 1228 A NULL Selector causes the entire specified-type 1226 @param[in] Selector Pointer to an entry selector on operated 1227 configuration data specified by DataType. 1228 A NULL Selector causes the entire specified-type 1229 1229 configuration information to be flushed. 1230 @param[in] Data The data buffer to be set. The structure 1230 @param[in] Data The data buffer to be set. The structure 1231 1231 of the data buffer should be EFI_IPSEC_SA_DATA. 1232 @param[in] Context Pointer to one entry selector which describes 1233 the expected position the new data entry will 1232 @param[in] Context Pointer to one entry selector which describes 1233 the expected position the new data entry will 1234 1234 be added. If Context is NULL,the new entry will 1235 1235 be appended the end of database. … … 1257 1257 LIST_ENTRY *EntryInsertBefore; 1258 1258 UINTN SadEntrySize; 1259 1259 1260 1260 SaId = (Selector == NULL) ? NULL : &Selector->SaId; 1261 1261 SaData = (Data == NULL) ? NULL : (EFI_IPSEC_SA_DATA2 *) Data; … … 1275 1275 SadEntry = IPSEC_SAD_ENTRY_FROM_LIST (Entry); 1276 1276 1277 if (SaId == NULL || 1277 if (SaId == NULL || 1278 1278 CompareSaId ( 1279 1279 (EFI_IPSEC_CONFIG_SELECTOR *) SadEntry->Id, … … 1326 1326 SadEntrySize = ALIGN_VARIABLE (SadEntrySize + sizeof (EFI_IPSEC_SA_ID)); 1327 1327 SadEntrySize = ALIGN_VARIABLE (SadEntrySize + sizeof (IPSEC_SAD_DATA)); 1328 1328 1329 1329 if (SaId->Proto == EfiIPsecAH) { 1330 1330 SadEntrySize += SaData->AlgoInfo.AhAlgoInfo.AuthKeyLength; … … 1383 1383 if (SadEntry->Data->AlgoInfo.EspAlgoInfo.EncKeyLength != 0) { 1384 1384 SadEntry->Data->AlgoInfo.EspAlgoInfo.EncKey = (VOID *) ALIGN_POINTER ( 1385 ((UINT8 *) (SadEntry->Data + 1) + 1385 ((UINT8 *) (SadEntry->Data + 1) + 1386 1386 SadEntry->Data->AlgoInfo.EspAlgoInfo.AuthKeyLength), 1387 1387 sizeof (UINTN) … … 1457 1457 Set the peer authorization configuration information for the EFI IPsec driver. 1458 1458 1459 The IPsec configuration data has a unique selector/identifier separately to 1459 The IPsec configuration data has a unique selector/identifier separately to 1460 1460 identify a data entry. 1461 1461 1462 @param[in] Selector Pointer to an entry selector on operated 1463 configuration data specified by DataType. 1464 A NULL Selector causes the entire specified-type 1462 @param[in] Selector Pointer to an entry selector on operated 1463 configuration data specified by DataType. 1464 A NULL Selector causes the entire specified-type 1465 1465 configuration information to be flushed. 1466 @param[in] Data The data buffer to be set. The structure 1466 @param[in] Data The data buffer to be set. The structure 1467 1467 of the data buffer should be EFI_IPSEC_PAD_DATA. 1468 @param[in] Context Pointer to one entry selector that describes 1469 the expected position the new data entry will 1468 @param[in] Context Pointer to one entry selector that describes 1469 the expected position the new data entry will 1470 1470 be added. If Context is NULL, the new entry will 1471 1471 be appended the end of database. … … 1491 1491 LIST_ENTRY *EntryInsertBefore; 1492 1492 UINTN PadEntrySize; 1493 1493 1494 1494 PadId = (Selector == NULL) ? NULL : &Selector->PadId; 1495 1495 PadData = (Data == NULL) ? NULL : (EFI_IPSEC_PAD_DATA *) Data; … … 1509 1509 PadEntry = IPSEC_PAD_ENTRY_FROM_LIST (Entry); 1510 1510 1511 if (PadId == NULL || 1511 if (PadId == NULL || 1512 1512 ComparePadId ((EFI_IPSEC_CONFIG_SELECTOR *) PadEntry->Id, (EFI_IPSEC_CONFIG_SELECTOR *) PadId) 1513 1513 ) { … … 1609 1609 1610 1610 /** 1611 This function lookup the data entry from IPsec SPD. Return the configuration 1611 This function lookup the data entry from IPsec SPD. Return the configuration 1612 1612 value of the specified SPD Entry. 1613 1613 1614 @param[in] Selector Pointer to an entry selector which is an identifier 1614 @param[in] Selector Pointer to an entry selector which is an identifier 1615 1615 of the SPD entry. 1616 1616 @param[in, out] DataSize On output the size of data returned in Data. 1617 @param[out] Data The buffer to return the contents of the IPsec 1618 configuration data. The type of the data buffer 1619 is associated with the DataType. 1620 1617 @param[out] Data The buffer to return the contents of the IPsec 1618 configuration data. The type of the data buffer 1619 is associated with the DataType. 1620 1621 1621 @retval EFI_SUCCESS The specified configuration data was obtained successfully. 1622 1622 @retval EFI_INVALID_PARAMETER Data is NULL and *DataSize is not zero. … … 1710 1710 1711 1711 /** 1712 This function lookup the data entry from IPsec SAD. Return the configuration 1712 This function lookup the data entry from IPsec SAD. Return the configuration 1713 1713 value of the specified SAD Entry. 1714 1714 1715 @param[in] Selector Pointer to an entry selector which is an identifier 1715 @param[in] Selector Pointer to an entry selector which is an identifier 1716 1716 of the SAD entry. 1717 1717 @param[in, out] DataSize On output, the size of data returned in Data. 1718 @param[out] Data The buffer to return the contents of the IPsec 1719 configuration data. The type of the data buffer 1720 is associated with the DataType. 1721 1718 @param[out] Data The buffer to return the contents of the IPsec 1719 configuration data. The type of the data buffer 1720 is associated with the DataType. 1721 1722 1722 @retval EFI_SUCCESS The specified configuration data was obtained successfully. 1723 1723 @retval EFI_NOT_FOUND The configuration data specified by Selector is not found. … … 1760 1760 // |AuthKey 1761 1761 // |EncryptKey (Optional) 1762 // |SpdSelector (Optional) 1763 // 1762 // |SpdSelector (Optional) 1763 // 1764 1764 RequiredSize = ALIGN_VARIABLE (sizeof (EFI_IPSEC_SA_DATA2)); 1765 1765 … … 1774 1774 RequiredSize += SIZE_OF_SPD_SELECTOR (SadEntry->Data->SpdSelector); 1775 1775 } 1776 1776 1777 1777 if (*DataSize < RequiredSize) { 1778 1778 *DataSize = RequiredSize; 1779 1779 return EFI_BUFFER_TOO_SMALL; 1780 1780 } 1781 1781 1782 1782 // 1783 1783 // Fill the data fields of SAD entry. … … 1872 1872 SIZE_OF_SPD_SELECTOR (SadEntry->Data->SpdSelector) 1873 1873 ); 1874 1874 1875 1875 DuplicateSpdSelector ( 1876 1876 (EFI_IPSEC_CONFIG_SELECTOR *) SaData->SpdSelector, … … 1894 1894 1895 1895 /** 1896 This function lookup the data entry from IPsec PAD. Return the configuration 1896 This function lookup the data entry from IPsec PAD. Return the configuration 1897 1897 value of the specified PAD Entry. 1898 1898 1899 @param[in] Selector Pointer to an entry selector which is an identifier 1899 @param[in] Selector Pointer to an entry selector which is an identifier 1900 1900 of the PAD entry. 1901 1901 @param[in, out] DataSize On output the size of data returned in Data. 1902 @param[out] Data The buffer to return the contents of the IPsec 1903 configuration data. The type of the data buffer 1904 is associated with the DataType. 1905 1902 @param[out] Data The buffer to return the contents of the IPsec 1903 configuration data. The type of the data buffer 1904 is associated with the DataType. 1905 1906 1906 @retval EFI_SUCCESS The specified configuration data was obtained successfully. 1907 1907 @retval EFI_NOT_FOUND The configuration data specified by Selector is not found. … … 2066 2066 /** 2067 2067 Calculate the a whole size of IPSEC_SPD_DATA which includes the buffer size pointed 2068 to by the pointer members and the buffer size used by the Sa List. 2068 to by the pointer members and the buffer size used by the Sa List. 2069 2069 2070 2070 @param[in] SpdData Pointer to the specified IPSEC_SPD_DATA. … … 2102 2102 2103 2103 Get the all variables which start with the string contained in VaraiableName. 2104 Since all IPsec related variable store in continual space, those kinds of 2105 variable can be searched by the EfiGetNextVariableName. Those variables also are 2104 Since all IPsec related variable store in continual space, those kinds of 2105 variable can be searched by the EfiGetNextVariableName. Those variables also are 2106 2106 returned in a continual buffer. 2107 2107 2108 2108 @param[in] VariableName Pointer to a specified Variable Name. 2109 2109 @param[in] VendorGuid Pointer to a specified Vendor Guid. 2110 @param[in] Attributes Point to memory location to return the attributes 2111 of variable. If the point is NULL, the parameter 2110 @param[in] Attributes Point to memory location to return the attributes 2111 of variable. If the point is NULL, the parameter 2112 2112 would be ignored. 2113 @param[in, out] DataSize As input, point to the maximum size of return 2114 Data-Buffer. As output, point to the actual 2113 @param[in, out] DataSize As input, point to the maximum size of return 2114 Data-Buffer. As output, point to the actual 2115 2115 size of the returned Data-Buffer. 2116 2116 @param[in] Data Point to return Data-Buffer. 2117 2117 2118 2118 @retval EFI_ABORTED If the Variable size which contained in the variable 2119 structure doesn't match the variable size obtained 2119 structure doesn't match the variable size obtained 2120 2120 from the EFIGetVariable. 2121 2121 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has 2122 been updated with the size needed to complete the request. 2122 been updated with the size needed to complete the request. 2123 2123 @retval EFI_SUCCESS The function completed successfully. 2124 2124 @retval others Other errors found during the variable getting. … … 2153 2153 VariableNameI = AllocateZeroPool (VariableNameISize); 2154 2154 ASSERT (VariableNameI != NULL); 2155 2155 2156 2156 // 2157 2157 // Construct the varible name of ipsecconfig meta data. … … 2292 2292 Null-Terminated Unicode String. 2293 2293 @param[in] VendorGuid Unify identifier for vendor. 2294 @param[in] Attributes Point to memory location to return the attributes of 2294 @param[in] Attributes Point to memory location to return the attributes of 2295 2295 variable. If the point is NULL, the parameter would be ignored. 2296 2296 @param[in] DataSize The size in bytes of Data-Buffer. … … 2299 2299 @retval EFI_SUCCESS The firmware successfully stored the variable and its data, as 2300 2300 defined by the Attributes. 2301 @retval others Storing the variables failed. 2301 @retval others Storing the variables failed. 2302 2302 2303 2303 **/ … … 2329 2329 return Status; 2330 2330 } 2331 2331 2332 2332 // 2333 2333 // "VariableName + Info/0001/0002/... + NULL" … … 2346 2346 UnicodeSPrint (VariableNameI, VariableNameSize, L"%s%s", VariableName, L"Info"); 2347 2347 MaximumVariableSize -= VariableNameSize; 2348 2348 2349 2349 IpSecVariableInfo.VariableCount = (UINT32) ((DataSize + (UINTN) MaximumVariableSize - 1) / (UINTN) MaximumVariableSize); 2350 2350 IpSecVariableInfo.VariableSize = (UINT32) DataSize; … … 2371 2371 // The index of variable name begin from 0001, and the varaible name 2372 2372 // likes "VariableName0001", "VaraiableName0002".... 2373 // 2373 // 2374 2374 UnicodeSPrint (VariableNameI, VariableNameSize, L"%s%04d", VariableName, VariableIndex + 1); 2375 2375 Status = gRT->SetVariable ( … … 2398 2398 2399 2399 /** 2400 Return the configuration value for the EFI IPsec driver. 2400 Return the configuration value for the EFI IPsec driver. 2401 2401 2402 2402 This function lookup the data entry from IPsec database or IKEv2 configuration 2403 2403 information. The expected data type and unique identification are described in 2404 DataType and Selector parameters. 2404 DataType and Selector parameters. 2405 2405 2406 2406 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance. 2407 2407 @param[in] DataType The type of data to retrieve. 2408 @param[in] Selector Pointer to an entry selector that is an identifier of the IPsec 2408 @param[in] Selector Pointer to an entry selector that is an identifier of the IPsec 2409 2409 configuration data entry. 2410 2410 @param[in, out] DataSize On output the size of data returned in Data. 2411 @param[out] Data The buffer to return the contents of the IPsec configuration data. 2412 The type of the data buffer associated with the DataType. 2413 2411 @param[out] Data The buffer to return the contents of the IPsec configuration data. 2412 The type of the data buffer associated with the DataType. 2413 2414 2414 @retval EFI_SUCCESS The specified configuration data was obtained successfully. 2415 2415 @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE: … … 2451 2451 /** 2452 2452 Set the security association, security policy and peer authorization configuration 2453 information for the EFI IPsec driver. 2453 information for the EFI IPsec driver. 2454 2454 2455 2455 This function is used to set the IPsec configuration information of type DataType for … … 2458 2458 a data entry. The selector structure depends on DataType's definition. 2459 2459 Using SetData() with a Data of NULL causes the IPsec configuration data entry identified 2460 by DataType and Selector to be deleted. 2460 by DataType and Selector to be deleted. 2461 2461 2462 2462 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance. 2463 2463 @param[in] DataType The type of data to be set. 2464 @param[in] Selector Pointer to an entry selector on operated configuration data 2465 specified by DataType. A NULL Selector causes the entire 2464 @param[in] Selector Pointer to an entry selector on operated configuration data 2465 specified by DataType. A NULL Selector causes the entire 2466 2466 specified-type configuration information to be flushed. 2467 @param[in] Data The data buffer to be set. The structure of the data buffer is 2467 @param[in] Data The data buffer to be set. The structure of the data buffer is 2468 2468 associated with the DataType. 2469 2469 @param[in] InsertBefore Pointer to one entry selector which describes the expected 2470 2470 position the new data entry will be added. If InsertBefore is NULL, 2471 2471 the new entry will be appended to the end of the database. 2472 2472 2473 2473 @retval EFI_SUCCESS The specified configuration entry data was set successfully. 2474 2474 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: … … 2497 2497 return EFI_UNSUPPORTED; 2498 2498 } 2499 2499 2500 2500 Status = mSetPolicyEntry[DataType](Selector, Data, InsertBefore); 2501 2501 … … 2511 2511 2512 2512 /** 2513 Enumerates the current selector for IPsec configuration data entry. 2513 Enumerates the current selector for IPsec configuration data entry. 2514 2514 2515 2515 This function is called multiple times to retrieve the entry Selector in IPsec 2516 configuration database. On each call to GetNextSelector(), the next entry 2516 configuration database. On each call to GetNextSelector(), the next entry 2517 2517 Selector are retrieved into the output interface. 2518 2519 If the entire IPsec configuration database has been iterated, the error 2518 2519 If the entire IPsec configuration database has been iterated, the error 2520 2520 EFI_NOT_FOUND is returned. 2521 If the Selector buffer is too small for the next Selector copy, an 2522 EFI_BUFFER_TOO_SMALL error is returned, and SelectorSize is updated to reflect 2521 If the Selector buffer is too small for the next Selector copy, an 2522 EFI_BUFFER_TOO_SMALL error is returned, and SelectorSize is updated to reflect 2523 2523 the size of buffer needed. 2524 2524 2525 2525 On the initial call to GetNextSelector() to start the IPsec configuration database 2526 search, a pointer to the buffer with all zero value is passed in Selector. Calls 2527 to SetData() between calls to GetNextSelector may produce unpredictable results. 2526 search, a pointer to the buffer with all zero value is passed in Selector. Calls 2527 to SetData() between calls to GetNextSelector may produce unpredictable results. 2528 2528 2529 2529 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance. 2530 2530 @param[in] DataType The type of IPsec configuration data to retrieve. 2531 2531 @param[in, out] SelectorSize The size of the Selector buffer. 2532 @param[in, out] Selector On input, supplies the pointer to last Selector that was 2532 @param[in, out] Selector On input, supplies the pointer to last Selector that was 2533 2533 returned by GetNextSelector(). 2534 2534 On output, returns one copy of the current entry Selector 2535 of a given DataType. 2536 2535 of a given DataType. 2536 2537 2537 @retval EFI_SUCCESS The specified configuration data was obtained successfully. 2538 2538 @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE: … … 2543 2543 @retval EFI_UNSUPPORTED The specified DataType is not supported. 2544 2544 @retval EFI_BUFFER_TOO_SMALL The SelectorSize is too small for the result. This parameter 2545 has been updated with the size needed to complete the search 2545 has been updated with the size needed to complete the search 2546 2546 request. 2547 2547 … … 2592 2592 /** 2593 2593 Register an event that is to be signaled whenever a configuration process on the 2594 specified IPsec configuration information is done. 2594 specified IPsec configuration information is done. 2595 2595 2596 2596 The register function is not surpport now and always returns EFI_UNSUPPORTED. 2597 2597 2598 2598 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance. 2599 2599 @param[in] DataType The type of data to be registered the event for. 2600 2600 @param[in] Event The event to be registered. 2601 2601 2602 2602 @retval EFI_SUCCESS The event is registered successfully. 2603 2603 @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL. … … 2620 2620 /** 2621 2621 Remove the specified event that was previously registered on the specified IPsec 2622 configuration data. 2622 configuration data. 2623 2623 2624 2624 This function is not support now and alwasy return EFI_UNSUPPORTED. … … 2627 2627 @param[in] DataType The configuration data type to remove the registered event for. 2628 2628 @param[in] Event The event to be unregistered. 2629 2629 2630 2630 @retval EFI_SUCCESS The event was removed successfully. 2631 @retval EFI_NOT_FOUND The Event specified by DataType could not be found in the 2631 @retval EFI_NOT_FOUND The Event specified by DataType could not be found in the 2632 2632 database. 2633 2633 @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL. … … 2651 2651 2652 2652 This function is a caller defined function, and it is called by the IpSecVisitConfigData(). 2653 The orignal caller is IpSecConfigSave(), which calls the IpsecVisitConfigData() to 2653 The orignal caller is IpSecConfigSave(), which calls the IpsecVisitConfigData() to 2654 2654 copy all types of IPsec Config datas into one buffer and store this buffer into firmware in 2655 2655 the form of several variables. 2656 2656 2657 2657 @param[in] Type A specified IPSEC_CONFIG_DATA_TYPE. 2658 2658 @param[in] Selector Points to a EFI_IPSEC_CONFIG_SELECTOR to be copied … … 2682 2682 UINTN EntrySize; 2683 2683 UINT8 *TempPoint; 2684 2684 2685 2685 if (Type == IPsecConfigDataTypeSad) { 2686 2686 // … … 2698 2698 EntrySize = ALIGN_VARIABLE (EntrySize + sizeof (SelectorHeader)); 2699 2699 EntrySize = ALIGN_VARIABLE (EntrySize + DataSize); 2700 2700 2701 2701 //EntrySize = SelectorSize + DataSize + 2 * sizeof (SelectorHeader); 2702 2702 if (Buffer->Capacity - Buffer->Size < EntrySize) { … … 2706 2706 Buffer->Capacity += EntrySize; 2707 2707 TempPoint = AllocatePool (Buffer->Capacity); 2708 2708 2709 2709 if (TempPoint == NULL) { 2710 2710 return EFI_OUT_OF_RESOURCES; … … 2715 2715 CopyMem (TempPoint, Buffer->Ptr, Buffer->Size); 2716 2716 FreePool (Buffer->Ptr); 2717 2718 Buffer->Ptr = TempPoint; 2717 2718 Buffer->Ptr = TempPoint; 2719 2719 } 2720 2720 … … 2733 2733 ); 2734 2734 Buffer->Size = ALIGN_VARIABLE (Buffer->Size + sizeof (SelectorHeader)); 2735 2735 2736 2736 // 2737 2737 // Copy the selector into buffer. … … 2765 2765 ); 2766 2766 Buffer->Size = ALIGN_VARIABLE (Buffer->Size + DataSize); 2767 2767 2768 2768 mUnfixPolicyEntry[Type](Selector, Data); 2769 2769 … … 2976 2976 to the internal data structure. 2977 2977 2978 This founction is called by IpSecConfigInitialize() which is to intialize the 2978 This founction is called by IpSecConfigInitialize() which is to intialize the 2979 2979 IPsecConfiguration Protocol. 2980 2980 … … 3054 3054 Type = (EFI_IPSEC_CONFIG_DATA_TYPE) (Header->Type & IPSEC_VAR_ITEM_HEADER_CONTENT_BIT); 3055 3055 ASSERT (((Header->Type & 0x80) == IPSEC_VAR_ITEM_HEADER_LOGO_BIT) && (Type < IPsecConfigDataTypeMaximum)); 3056 3056 3057 3057 Selector = (EFI_IPSEC_CONFIG_SELECTOR *) ALIGN_POINTER (Header + 1, sizeof (UINTN)); 3058 3058 Header = (IPSEC_VAR_ITEM_HEADER *) ALIGN_POINTER ( 3059 (UINT8 *) Selector + Header->Size, 3059 (UINT8 *) Selector + Header->Size, 3060 3060 sizeof (UINTN) 3061 3061 ); -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecConfigImpl.h
r48674 r58466 346 346 347 347 Compare two SPD Selector by the fields of LocalAddressCount/RemoteAddressCount/ 348 NextLayerProtocol/LocalPort/LocalPortRange/RemotePort/RemotePortRange and the 348 NextLayerProtocol/LocalPort/LocalPortRange/RemotePort/RemotePortRange and the 349 349 Local Addresses and remote Addresses. 350 350 … … 353 353 354 354 @retval TRUE The first SPD Selector is subordinate Selector of second SPD Selector. 355 @retval FALSE The first SPD Selector is not subordinate Selector of second 355 @retval FALSE The first SPD Selector is not subordinate Selector of second 356 356 SPD Selector. 357 357 358 358 **/ 359 359 BOOLEAN -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecCryptIo.c
r58459 r58466 20 20 GLOBAL_REMOVE_IF_UNREFERENCED ENCRYPT_ALGORITHM mIpsecEncryptAlgorithmList[IPSEC_ENCRYPT_ALGORITHM_LIST_SIZE] = { 21 21 {IKE_EALG_NULL, 0, 0, 1, NULL, NULL, NULL, NULL}, 22 {IKE_EALG_NONE, 0, 0, 1, NULL, NULL, NULL, NULL}, 22 {IKE_EALG_NONE, 0, 0, 1, NULL, NULL, NULL, NULL}, 23 23 {IKE_EALG_3DESCBC, 24, 8, 8, TdesGetContextSize, TdesInit, TdesCbcEncrypt, TdesCbcDecrypt}, 24 24 {IKE_EALG_AESCBC, 16, 16, 16, AesGetContextSize, AesInit, AesCbcEncrypt, AesCbcDecrypt} … … 187 187 return IpSecCryptoIoGenerateRandomBytes (IvBuffer, IvSize); 188 188 } 189 189 190 190 return EFI_SUCCESS; 191 191 } … … 197 197 198 198 @return the index. 199 199 200 200 **/ 201 201 UINTN … … 205 205 { 206 206 UINT8 Index; 207 207 208 208 for (Index = 0; Index < IPSEC_ENCRYPT_ALGORITHM_LIST_SIZE; Index++) { 209 209 if (AlgorithmId == mIpsecEncryptAlgorithmList[Index].AlgorithmId) { … … 211 211 } 212 212 } 213 213 214 214 return (UINTN) -1; 215 215 } … … 221 221 222 222 @return the index. 223 223 224 224 **/ 225 225 UINTN … … 229 229 { 230 230 UINT8 Index; 231 231 232 232 for (Index = 0; Index < IPSEC_AUTH_ALGORITHM_LIST_SIZE; Index++) { 233 233 if (AlgorithmId == mIpsecAuthAlgorithmList[Index].AlgorithmId) { … … 238 238 } 239 239 } 240 240 241 241 return (UINTN) -1; 242 242 } … … 276 276 OUT UINT8 *OutData 277 277 ) 278 { 278 { 279 279 UINTN Index; 280 280 UINTN ContextSize; 281 281 UINT8 *Context; 282 282 EFI_STATUS Status; 283 283 284 284 Status = EFI_UNSUPPORTED; 285 285 286 286 switch (AlgorithmId) { 287 287 … … 324 324 FreePool (Context); 325 325 } 326 326 327 327 return Status; 328 328 } … … 362 362 OUT UINT8 *OutData 363 363 ) 364 { 364 { 365 365 UINTN Index; 366 366 UINTN ContextSize; … … 398 398 if (mIpsecEncryptAlgorithmList[Index].CipherInitiate (Context, Key, KeyBits)) { 399 399 if (mIpsecEncryptAlgorithmList[Index].CipherDecrypt (Context, InData, InDataLength, Ivec, OutData)) { 400 Status = EFI_SUCCESS; 400 Status = EFI_SUCCESS; 401 401 } 402 402 } … … 421 421 the result into the OutData buffer. If the OutDataSize is larger than the related 422 422 HMAC alogrithm output size, return EFI_INVALID_PARAMETER. 423 423 424 424 @param[in] AlgorithmId The authentication Identification. 425 425 @param[in] Key Pointer of the authentication key. … … 520 520 521 521 goto Exit; 522 } 523 522 } 523 524 524 default: 525 525 return Status; … … 578 578 Status = EFI_UNSUPPORTED; 579 579 OutHashData = NULL; 580 580 581 581 OutHashSize = IpSecGetHmacDigestLength (AlgorithmId); 582 582 // 583 583 // If the expected hash data size is larger than the related Hash algorithm 584 // output length, return EFI_INVALID_PARAMETER. 584 // output length, return EFI_INVALID_PARAMETER. 585 585 // 586 586 if (OutDataSize > OutHashSize) { … … 591 591 return EFI_OUT_OF_RESOURCES; 592 592 } 593 593 594 594 switch (AlgorithmId) { 595 595 … … 612 612 goto Exit; 613 613 } 614 614 615 615 // 616 616 // Initiate Hash context and hash the input data. … … 632 632 // the key length size, so copy the part of hash data to the OutData. 633 633 // 634 CopyMem (OutData, OutHashData, OutDataSize); 634 CopyMem (OutData, OutHashData, OutDataSize); 635 635 Status = EFI_SUCCESS; 636 636 } 637 638 goto Exit; 639 } 640 637 638 goto Exit; 639 } 640 641 641 default: 642 642 return Status; … … 686 686 OUT UINT8 *PublicKey, 687 687 IN OUT UINTN *PublicKeySize 688 ) 688 ) 689 689 { 690 690 EFI_STATUS Status; 691 691 692 692 *DhContext = DhNew (); 693 693 ASSERT (*DhContext != NULL); … … 708 708 DhContext = NULL; 709 709 } 710 710 711 711 return Status; 712 712 } … … 732 732 EFI_STATUS 733 733 IpSecCryptoIoDhComputeKey ( 734 IN OUT UINT8 *DhContext, 734 IN OUT UINT8 *DhContext, 735 735 IN CONST UINT8 *PeerPublicKey, 736 736 IN UINTN PeerPublicKeySize, … … 753 753 @retval EFI_SUCCESS The operation perfoms successfully. 754 754 @retval EFI_INVALID_PARAMETER The DhContext is NULL. 755 755 756 756 **/ 757 757 EFI_STATUS … … 759 759 IN OUT UINT8 **DhContext 760 760 ) 761 { 761 { 762 762 if (*DhContext == NULL) { 763 763 return EFI_INVALID_PARAMETER; … … 808 808 @param[out] OutData The pointer to the signed data. 809 809 @param[in, out] OutDataSize Pointer to contain the size of out data. 810 810 811 811 **/ 812 812 VOID … … 825 825 UINT8 *Signature; 826 826 UINTN SigSize; 827 827 828 828 SigSize = 0; 829 829 RsaContext = NULL; … … 845 845 // Sign data 846 846 // 847 Signature = NULL; 847 Signature = NULL; 848 848 if (!RsaPkcs1Sign (RsaContext, InData, InDataSize, Signature, &SigSize)) { 849 849 Signature = AllocateZeroPool (SigSize); 850 850 } else { 851 851 return; 852 } 852 } 853 853 854 854 RsaPkcs1Sign (RsaContext, InData, InDataSize, Signature, &SigSize); … … 877 877 @retval TRUE Valid signature encoded in PKCS1-v1_5. 878 878 @retval FALSE Invalid signature or invalid RSA context. 879 879 880 880 **/ 881 881 BOOLEAN … … 913 913 // 914 914 RsaGetPublicKeyFromX509 ((CONST UINT8 *)InCert, CertLen, (VOID **)&RsaContext); 915 915 916 916 // 917 917 // Verify data … … 965 965 966 966 *PublicKeyLen = 0; 967 967 968 968 RsaGetKey (RsaContext, RsaKeyN, NULL, PublicKeyLen); 969 969 970 970 *PublicKey = AllocateZeroPool (*PublicKeyLen); 971 971 ASSERT (*PublicKey != NULL); … … 990 990 @param[out] CertSubject Pointer to the retrieved certificate subject. 991 991 @param[out] SubjectSize The size of Certificate Subject in bytes. 992 992 993 993 @retval EFI_SUCCESS Retrieved the certificate subject successfully. 994 994 @retval EFI_INVALID_PARAMETER The certificate is malformed. 995 995 996 996 **/ 997 997 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecCryptIo.h
r48674 r58466 48 48 /** 49 49 Prototype of HMAC GetContextSize. 50 50 51 51 Retrieves the size, in bytes, of the context buffer required. 52 52 53 53 @return The size, in bytes, of the context buffer required. 54 54 … … 62 62 /** 63 63 Prototype of HMAC Operation Initiating. 64 64 65 65 Initialization with a new context. 66 66 … … 68 68 @param[in] Key Pointer to the key for HMAC. 69 69 @param[in] KeySize The length of the Key in bytes. 70 70 71 71 @retval TRUE Initialization Successfully. 72 72 … … 252 252 /** 253 253 Prototype of Hash Update 254 254 255 255 Digests the input data and updates hash context. 256 256 … … 355 355 // 356 356 // The Key length of the Algorithm 357 // 357 // 358 358 UINTN DigestLength; 359 359 // … … 579 579 the result into the OutData buffer. If the OutDataSize is larger than the related 580 580 HMAC alogrithm output size, return EFI_INVALID_PARAMETER. 581 581 582 582 @param[in] AlgorithmId The authentication Identification. 583 583 @param[in] Key Pointer of the authentication key. … … 705 705 @retval EFI_SUCCESS The operation perfoms successfully. 706 706 @retval EFI_INVALID_PARAMETER The DhContext is NULL. 707 707 708 708 **/ 709 709 EFI_STATUS … … 741 741 @param[out] OutData The pointer to the signed data. 742 742 @param[in, out] OutDataSize Pointer to contain the size of out data. 743 743 744 744 **/ 745 745 VOID … … 770 770 @retval TRUE Valid signature encoded in PKCS1-v1_5. 771 771 @retval FALSE Invalid signature or invalid RSA context. 772 772 773 773 **/ 774 774 BOOLEAN … … 811 811 @param[out] CertSubject Pointer to the retrieved certificate subject. 812 812 @param[out] SubjectSize The size of Certificate Subject in bytes. 813 813 814 814 @retval EFI_SUCCESS Retrieved the certificate subject successfully. 815 815 @retval EFI_INVALID_PARAMETER The certificate is malformed. 816 816 817 817 **/ 818 818 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecDebug.c
r58459 r58466 168 168 { 169 169 if (Previous >= IKE_STATE_NUM || Current >= IKE_STATE_NUM) { 170 return; 171 } 172 170 return; 171 } 172 173 173 if (Previous == Current) { 174 174 if (IkeVersion == 1) { … … 176 176 } else if (IkeVersion == 2) { 177 177 DEBUG ((DEBUG_INFO, "\n****Current state is %a\n", mIkev2StateStr[Previous])); 178 } 178 } 179 179 } else { 180 180 if (IkeVersion == 1) { … … 182 182 } else { 183 183 DEBUG ((DEBUG_INFO, "\n****Change state from %a to %a\n", mIkev2StateStr[Previous], mIkev2StateStr[Current])); 184 } 184 } 185 185 } 186 186 } … … 224 224 TypeStr = mExchangeStr[2]; 225 225 break; 226 226 227 227 case IKE_XCG_TYPE_SA_INIT: 228 228 TypeStr = mExchangeStr[3]; … … 240 240 TypeStr = mExchangeStr[6]; 241 241 break; 242 242 243 243 default: 244 244 TypeStr = mExchangeStr[7]; … … 276 276 @param[in] IkePayload Point to payload to be printed. 277 277 @param[in] IkeVersion The specified version of IKE. 278 278 279 279 **/ 280 280 VOID -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecDebug.h
r58459 r58466 58 58 IkeDumpState ( 59 59 IN UINT32 Previous, 60 IN UINT32 Current, 60 IN UINT32 Current, 61 61 IN UINT8 IkeVersion 62 62 ); … … 82 82 @param[in] IkePayload Point to payload to be printed. 83 83 @param[in] IkeVersion The specified version of IKE. 84 84 85 85 **/ 86 86 VOID -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecDriver.c
r58459 r58466 29 29 device to start. 30 30 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 31 31 32 32 @retval EFI_SUCCES This driver supports this device. 33 33 @retval EFI_ALREADY_STARTED This driver is already running on this device. … … 46 46 EFI_STATUS Status; 47 47 EFI_GUID *UdpServiceBindingGuid; 48 48 49 49 if (IpVersion == IP_VERSION_4) { 50 50 UdpServiceBindingGuid = &gEfiUdp4ServiceBindingProtocolGuid; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecDxe.inf
r58459 r58466 64 64 Ikev2/Payload.c 65 65 Ikev2/Exchange.c 66 66 67 67 68 68 … … 86 86 DpcLib 87 87 UdpIoLib 88 NetLib 88 NetLib 89 89 PcdLib 90 90 91 91 [Protocols] 92 92 gEfiIp4ConfigProtocolGuid ## SOMETIMES_CONSUMES 93 gEfiUdp4ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES 93 gEfiUdp4ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES 94 94 gEfiUdp4ProtocolGuid ## SOMETIMES_CONSUMES 95 gEfiUdp6ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES 95 gEfiUdp6ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES 96 96 gEfiUdp6ProtocolGuid ## SOMETIMES_CONSUMES 97 97 gEfiIpSecConfigProtocolGuid ## PRODUCES 98 98 gEfiIpSec2ProtocolGuid ## PRODUCES 99 99 100 100 [Pcd] 101 101 gEfiNetworkPkgTokenSpaceGuid.PcdIpsecCertificateEnabled ## SOMETIMES_CONSUMES -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecImpl.h
r48674 r58466 151 151 This function processes the inbound traffic with IPsec. 152 152 153 It checks the received packet security property, trims the ESP/AH header, and then 153 It checks the received packet security property, trims the ESP/AH header, and then 154 154 returns without an IPsec protected IP Header and FragmentTable. 155 155 156 156 @param[in] IpVersion The version of IP. 157 @param[in, out] IpHead Points to IP header containing the ESP/AH header 157 @param[in, out] IpHead Points to IP header containing the ESP/AH header 158 158 to be trimed on input, and without ESP/AH header 159 159 on return. … … 281 281 IN UINT8 *IpPayload, 282 282 IN UINT8 Protocol, 283 IN BOOLEAN IsOutbound, 283 IN BOOLEAN IsOutbound, 284 284 OUT EFI_IPSEC_ACTION *Action 285 285 ); -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/IpSecDxe/IpSecMain.c
r48674 r58466 71 71 BOOLEAN IsOutbound; 72 72 73 if (OptionsBuffer == NULL || 74 OptionsLength == NULL || 75 FragmentTable == NULL || 73 if (OptionsBuffer == NULL || 74 OptionsLength == NULL || 75 FragmentTable == NULL || 76 76 FragmentCount == NULL 77 77 ) { … … 84 84 *RecycleSignal = NULL; 85 85 SpdList = &mConfigData[IPsecConfigDataTypeSpd]; 86 86 87 87 if (!IsOutbound) { 88 88 // … … 109 109 110 110 if (Status == EFI_SUCCESS) { 111 111 112 112 // 113 113 // Check the spd entry if the packet is accessible. … … 121 121 NET_LIST_FOR_EACH (Entry, SpdList) { 122 122 SpdEntry = IPSEC_SPD_ENTRY_FROM_LIST (Entry); 123 if (IsSubSpdSelector ( 123 if (IsSubSpdSelector ( 124 124 (EFI_IPSEC_CONFIG_SELECTOR *) SpdSelector, 125 125 (EFI_IPSEC_CONFIG_SELECTOR *) SpdEntry->Selector … … 127 127 Status = EFI_SUCCESS; 128 128 } 129 } 130 goto ON_EXIT; 131 } 132 } 133 134 Status = EFI_ACCESS_DENIED; 129 } 130 goto ON_EXIT; 131 } 132 } 133 134 Status = EFI_ACCESS_DENIED; 135 135 136 136 NET_LIST_FOR_EACH (Entry, SpdList) { … … 146 146 IpPayload, 147 147 OldLastHead, 148 IsOutbound, 148 IsOutbound, 149 149 &Action 150 150 ))) { … … 223 223 224 224 case EfiIPsecActionDiscard: 225 goto ON_EXIT; 226 } 227 } 228 225 goto ON_EXIT; 226 } 227 } 228 229 229 // 230 230 // If don't find the related SPD entry, return the EFI_ACCESS_DENIED and discard it. 231 231 // But it the packet is NS/NA, it should be by passed even not find the related SPD entry. 232 232 // 233 if (OldLastHead == IP6_ICMP && 233 if (OldLastHead == IP6_ICMP && 234 234 (*IpPayload == ICMP_V6_NEIGHBOR_SOLICIT || *IpPayload == ICMP_V6_NEIGHBOR_ADVERTISE) 235 235 ){ 236 236 Status = EFI_SUCCESS; 237 237 } 238 238 239 239 ON_EXIT: 240 240 return Status; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Mtftp6Dxe/ComponentName.c
r58459 r58466 234 234 @param Mtftp6[in] A pointer to the EFI_MTFTP6_PROTOCOL. 235 235 236 236 237 237 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 238 238 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 239 239 240 240 **/ 241 241 EFI_STATUS … … 262 262 return Status; 263 263 } 264 UnicodeSPrint (HandleName, sizeof (HandleName), 264 UnicodeSPrint (HandleName, sizeof (HandleName), 265 265 L"MTFTPv6(ServerIp=%s, InitialServerPort=%d)", 266 266 Address, … … 275 275 gMtftp6ControllerNameTable = NULL; 276 276 } 277 277 278 278 Status = AddUnicodeString2 ( 279 279 "eng", … … 286 286 return Status; 287 287 } 288 288 289 289 return AddUnicodeString2 ( 290 290 "en", … … 384 384 return EFI_UNSUPPORTED; 385 385 } 386 387 // 388 // Make sure this driver produced ChildHandle 389 // 386 387 // 388 // Make sure this driver produced ChildHandle 389 // 390 390 Status = EfiTestChildHandle ( 391 391 ControllerHandle, 392 ChildHandle, 392 ChildHandle, 393 393 &gEfiUdp6ProtocolGuid 394 394 ); … … 417 417 Status = UpdateName (Mtftp6); 418 418 if (EFI_ERROR (Status)) { 419 return Status; 419 return Status; 420 420 } 421 421 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Mtftp6Dxe/Mtftp6Driver.c
r58459 r58466 239 239 /** 240 240 Callback function which provided by user to remove one node in NetDestroyLinkList process. 241 241 242 242 @param[in] Entry The entry to be removed. 243 243 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList. … … 474 474 LIST_ENTRY *List; 475 475 MTFTP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context; 476 476 477 477 // 478 478 // Locate the Nic handle to retrieve the Mtftp6 private data. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/NetworkPkg.dec
-
Property svn:eol-style
set to
native
-
Property svn:eol-style
set to
-
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/NetworkPkg.dsc
r58459 r58466 47 47 OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf 48 48 IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf 49 DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf 49 DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf 50 50 51 51 [LibraryClasses.common.UEFI_DRIVER] -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/ComponentName.c
r58459 r58466 232 232 @param Tcp4[in] A pointer to the EFI_TCP4_PROTOCOL. 233 233 234 234 235 235 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 236 236 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 237 237 238 238 **/ 239 239 EFI_STATUS … … 277 277 gTcpControllerNameTable = NULL; 278 278 } 279 279 280 280 Status = AddUnicodeString2 ( 281 281 "eng", … … 288 288 return Status; 289 289 } 290 290 291 291 return AddUnicodeString2 ( 292 292 "en", … … 303 303 @param Tcp6[in] A pointer to the EFI_TCP6_PROTOCOL. 304 304 305 305 306 306 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 307 307 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 308 308 309 309 **/ 310 310 EFI_STATUS … … 344 344 gTcpControllerNameTable = NULL; 345 345 } 346 346 347 347 Status = AddUnicodeString2 ( 348 348 "eng", … … 355 355 return Status; 356 356 } 357 357 358 358 return AddUnicodeString2 ( 359 359 "en", -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/TcpDispatcher.c
r58459 r58466 360 360 IpProtocolGuid = &gEfiIp6ProtocolGuid; 361 361 } 362 362 363 363 Tcb = AllocateZeroPool (sizeof (TCP_CB)); 364 364 … … 398 398 return Status; 399 399 } 400 400 401 401 InitializeListHead (&Tcb->List); 402 402 InitializeListHead (&Tcb->SndQue); … … 430 430 IpProtocolGuid = &gEfiIp6ProtocolGuid; 431 431 } 432 432 433 433 ProtoData = (TCP_PROTO_DATA *) Sk->ProtoReserved; 434 434 Tcb = ProtoData->TcpPcb; … … 447 447 Sk->SockHandle 448 448 ); 449 449 450 450 IpIoRemoveIp (ProtoData->TcpService->IpIo, Tcb->IpInfo); 451 451 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/TcpDriver.c
r58459 r58466 366 366 /** 367 367 Callback function which provided by user to remove one node in NetDestroyLinkList process. 368 368 369 369 @param[in] Entry The entry to be removed. 370 370 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList. … … 411 411 of children is zero stop the entire bus driver. 412 412 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 413 if NumberOfChildren is 0. 413 if NumberOfChildren is 0. 414 414 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6 415 415 … … 546 546 return EFI_ALREADY_STARTED; 547 547 } 548 548 549 549 // 550 550 // Test for the Ip4ServiceBinding Protocol … … 663 663 return EFI_ALREADY_STARTED; 664 664 } 665 665 666 666 // 667 667 // Test for the Ip6ServiceBinding Protocol -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/TcpDxe/TcpDxe.inf
r58459 r58466 3 3 # 4 4 # This module provides EFI TCPv4 Protocol and EFI TCPv6 Protocol to send and receive data stream. 5 # It might provide TCPv4 Protocol or TCPv6 Protocol or both of them that depends on 5 # It might provide TCPv4 Protocol or TCPv6 Protocol or both of them that depends on 6 6 # which network stack has been loaded in system. 7 7 # -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Udp6Dxe/ComponentName.c
r58459 r58466 238 238 @param Udp6[in] A pointer to the EFI_UDP6_PROTOCOL. 239 239 240 240 241 241 @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 242 242 @retval EFI_INVALID_PARAMETER The input parameter is invalid. 243 243 244 244 **/ 245 245 EFI_STATUS -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Udp6Dxe/Udp6Driver.c
r58459 r58466 179 179 /** 180 180 Callback function which provided by user to remove one node in NetDestroyLinkList process. 181 181 182 182 @param[in] Entry The entry to be removed. 183 183 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList. … … 297 297 NULL 298 298 ); 299 299 300 300 Udp6CleanService (Udp6Service); 301 301 … … 409 409 goto ON_ERROR; 410 410 } 411 411 412 412 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); 413 413 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Udp6Dxe/Udp6Dxe.inf
r58459 r58466 1 1 ## @file Udp6Dxe.inf 2 2 # UDP packet service based on IPv6 stack. 3 # 3 # 4 4 # This module produces EFI UDPv6 Protocol which provides simple packet-oriented 5 5 # services to transmit and receive UDP packets. 6 # 6 # 7 7 # Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 8 8 # -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Udp6Dxe/Udp6Impl.c
r58459 r58466 365 365 IpIoDestroy (Udp6Service->IpIo); 366 366 Udp6Service->IpIo = NULL; 367 367 368 368 return Status; 369 369 } … … 391 391 IpIoDestroy (Udp6Service->IpIo); 392 392 Udp6Service->IpIo = NULL; 393 393 394 394 ZeroMem (Udp6Service, sizeof (UDP6_SERVICE_DATA)); 395 395 } … … 1932 1932 ) 1933 1933 { 1934 } 1934 } 1935 1935 1936 1936 /** -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Udp6Dxe/Udp6Impl.h
r58459 r58466 145 145 IN EFI_HANDLE ControllerHandle 146 146 ); 147 147 148 148 /** 149 149 This function cleans the udp instance. … … 156 156 IN OUT UDP6_INSTANCE_DATA *Instance 157 157 ); 158 158 159 159 /** 160 160 This function intializes the new created udp instance. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Udp6Dxe/Udp6Main.c
r58459 r58466 285 285 ASSERT (IsListEmpty (&Instance->DeliveredDgramQue)); 286 286 } 287 287 288 288 ON_EXIT: 289 289 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/ComponentName.c
r58459 r58466 325 325 return EFI_UNSUPPORTED; 326 326 } 327 327 328 328 NicHandle = PxeBcGetNicByIp4Children (ControllerHandle); 329 329 if (NicHandle == NULL) { -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c
r58459 r58466 102 102 // According to the PXE specification 2.1, Table 2-1 PXE DHCP Options, 103 103 // we must not consider a boot prompt or boot menu if all of the following hold: 104 // - the PXE_DISCOVERY_CONTROL tag(6) is present inside the Vendor Options(43), and has bit 3 set 104 // - the PXE_DISCOVERY_CONTROL tag(6) is present inside the Vendor Options(43), and has bit 3 set 105 105 // - a boot file name has been presented in the initial DHCP or ProxyDHCP offer packet. 106 106 // … … 109 109 return EFI_ABORTED; 110 110 } 111 111 112 112 if (!IS_VALID_BOOT_PROMPT (VendorOpt->BitMap)) { 113 113 return EFI_TIMEOUT; … … 471 471 PXEBC_VENDOR_OPTION *VendorOpt; 472 472 PXEBC_BOOT_SVR_ENTRY *Entry; 473 473 474 474 PxeBc = &Private->PxeBc; 475 475 Mode = PxeBc->Mode; … … 779 779 *DiscoverInfo = AllocatePool (sizeof (*Info) + (Info->IpCnt - 1) * sizeof (**SrvList)); 780 780 if (*DiscoverInfo == NULL) { 781 return EFI_OUT_OF_RESOURCES; 782 } 781 return EFI_OUT_OF_RESOURCES; 782 } 783 783 CopyMem (*DiscoverInfo, Info, sizeof (*Info)); 784 784 Info = *DiscoverInfo; … … 941 941 &Mode->PxeReply.Dhcpv4, 942 942 Private->PxeReply.Dhcp4.Packet.Ack.Length 943 ); 943 ); 944 944 } 945 945 Mode->ProxyOfferReceived = TRUE; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c
r58459 r58466 483 483 } 484 484 // 485 // Second, Check if bootfilename and serverhostname is overloaded to carry DHCP options refers to rfc-2132. 485 // Second, Check if bootfilename and serverhostname is overloaded to carry DHCP options refers to rfc-2132. 486 486 // If yes, try to parse options from the BootFileName field, then ServerName field. 487 487 // -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.h
r58459 r58466 149 149 #define IS_VALID_BOOT_SERVERS(x) \ 150 150 ((((x)[0]) & BIT (PXEBC_VENDOR_TAG_BOOT_SERVERS)) \ 151 == BIT (PXEBC_VENDOR_TAG_BOOT_SERVERS)) 151 == BIT (PXEBC_VENDOR_TAG_BOOT_SERVERS)) 152 152 153 153 #define IS_VALID_BOOT_PROMPT(x) \ -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
r58459 r58466 720 720 return EFI_NOT_FOUND; 721 721 } 722 722 723 723 // 724 724 // Add Server ID Option. … … 748 748 749 749 // 750 // Update Elapsed option in the package 750 // Update Elapsed option in the package 751 751 // 752 752 Option = PxeBcDhcp6SeekOption ( … … 758 758 CalcElapsedTime (Private); 759 759 WriteUnaligned16 ((UINT16*)(Option + 4), HTONS((UINT16) Private->ElapsedTime)); 760 } 760 } 761 761 762 762 Status = PxeBc->UdpWrite ( … … 792 792 return Status; 793 793 } 794 794 795 795 Status = PxeBc->UdpRead ( 796 796 PxeBc, … … 1667 1667 return Status; 1668 1668 } 1669 1669 1670 1670 Status = PxeBc->UdpRead ( 1671 1671 PxeBc, … … 1817 1817 1818 1818 do { 1819 1819 1820 1820 TimerStatus = gBS->CheckEvent (Timer); 1821 1821 if (!EFI_ERROR (TimerStatus)) { … … 1823 1823 } 1824 1824 } while (TimerStatus == EFI_NOT_READY); 1825 1825 1826 1826 gBS->CloseEvent (Timer); 1827 1827 } -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
r58459 r58466 255 255 ); 256 256 257 if (Private->Snp != NULL) { 257 if (Private->Snp != NULL) { 258 258 // 259 259 // Close SNP from the child virtual handle … … 265 265 Private->Ip4Nic->Controller 266 266 ); 267 267 268 268 gBS->UninstallProtocolInterface ( 269 269 Private->Ip4Nic->Controller, … … 702 702 703 703 // 704 // Open SNP on the child handle BY_DRIVER. It will prevent any additionally 704 // Open SNP on the child handle BY_DRIVER. It will prevent any additionally 705 705 // layering to perform the experiment. 706 706 // … … 839 839 for (Index = 0; Index < Private->Snp->Mode->HwAddressSize; Index++) { 840 840 Private->IaId |= (Private->Snp->Mode->CurrentAddress.Addr[Index] << ((Index << 3) & 31)); 841 } 841 } 842 842 } 843 843 … … 1004 1004 goto ON_ERROR; 1005 1005 } 1006 1006 1007 1007 if (Private->Snp != NULL) { 1008 1008 // … … 1021 1021 1022 1022 // 1023 // Open SNP on the child handle BY_DRIVER. It will prevent any additionally 1023 // Open SNP on the child handle BY_DRIVER. It will prevent any additionally 1024 1024 // layering to perform the experiment. 1025 1025 // … … 1146 1146 device to be started. 1147 1147 @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. 1148 1148 1149 1149 @retval EFI_SUCCESS This driver supports this device. 1150 1150 @retval EFI_UNSUPPORTED This driver does not support this device. … … 1163 1163 EFI_GUID *DhcpServiceBindingGuid; 1164 1164 EFI_GUID *MtftpServiceBindingGuid; 1165 1165 1166 1166 if (IpVersion == IP_VERSION_4) { 1167 1167 DhcpServiceBindingGuid = &gEfiDhcp4ServiceBindingProtocolGuid; … … 1306 1306 // 1307 1307 // Install PxeBaseCodePrivate protocol onto the real NIC handler. 1308 // PxeBaseCodePrivate protocol is only used to keep the relationship between 1308 // PxeBaseCodePrivate protocol is only used to keep the relationship between 1309 1309 // NIC handle and virtual child handles. 1310 1310 // gEfiCallerIdGuid will be used as its protocol guid. … … 1323 1323 // Try to locate SNP protocol. 1324 1324 // 1325 NetLibGetSnpHandle(ControllerHandle, &Private->Snp); 1325 NetLibGetSnpHandle(ControllerHandle, &Private->Snp); 1326 1326 } 1327 1327 -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
r58459 r58466 92 92 goto ON_ERROR; 93 93 } 94 94 95 95 // 96 96 // Configure block size for TFTP as a default value to handle all link layers. … … 137 137 goto ON_ERROR; 138 138 } 139 139 140 140 // 141 141 // Configure block size for TFTP as a default value to handle all link layers. … … 725 725 FreePool (NewCreatedInfo); 726 726 } 727 727 728 728 if (Mode->UsingIpv6) { 729 729 Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData); … … 731 731 Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData); 732 732 } 733 733 734 734 // 735 735 // Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP … … 1622 1622 // 1623 1623 Private->Udp4Read->Configure (Private->Udp4Read, NULL); 1624 1624 1625 1625 // 1626 1626 // Configure the UDP instance with the new configuration. … … 1632 1632 return Status; 1633 1633 } 1634 1634 1635 1635 // 1636 1636 // In not Promiscuous mode, need to join the new multicast group. … … 1661 1661 // 1662 1662 Private->Udp6Read->Configure (Private->Udp6Read, NULL); 1663 1663 1664 1664 // 1665 1665 // Configure the UDP instance with the new configuration. … … 1670 1670 return Status; 1671 1671 } 1672 1672 1673 1673 // 1674 1674 // In not Promiscuous mode, need to join the new multicast group. -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
r58459 r58466 102 102 103 103 PXEBC_PRIVATE_PROTOCOL Id; 104 EFI_SIMPLE_NETWORK_PROTOCOL *Snp; 104 EFI_SIMPLE_NETWORK_PROTOCOL *Snp; 105 105 106 106 PXEBC_VIRTUAL_NIC *Ip4Nic; -
trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
r58459 r58466 1 1 ## @file 2 2 # Access PXE-compatible devices for network access and network booting. 3 # 3 # 4 4 # This driver provides PXE Base Code Protocol which is used to accessing 5 5 # PXE-compatible device for network access or booting. It could work together … … 74 74 ## TO_START 75 75 ## SOMETIMES_CONSUMES 76 gEfiDevicePathProtocolGuid 76 gEfiDevicePathProtocolGuid 77 77 gEfiNetworkInterfaceIdentifierProtocolGuid_31 ## SOMETIMES_CONSUMES 78 78 gEfiArpServiceBindingProtocolGuid ## TO_START
Note:
See TracChangeset
for help on using the changeset viewer.