-
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work on configuration block implementation
- Add support for nanoframework/nf-debugger#173. - Improve Monitor_UpdateConfiguration command to handle configuration blocks larger then the WP buffer size. - Add new configuration block to store X509 CA Root certificate bundles. - Tested for STM32. - **WIP for ESP32** Signed-off-by: José Simões <jose.simoes@eclo.solutions>
- Loading branch information
1 parent
a9ad279
commit 1586348
Showing
30 changed files
with
444 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ pr: | |
branches: | ||
include: | ||
- master | ||
- develop | ||
- develop/* | ||
- release/* | ||
autoCancel: true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/DeviceInterfaces/System.Net/sys_net_native_System_Net_Security_CertificateManager.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// Copyright (c) 2018 The nanoFramework project contributors | ||
// Portions Copyright (c) Microsoft Corporation. All rights reserved. | ||
// See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#include "sys_net_native.h" | ||
|
||
HRESULT Library_sys_net_native_System_Net_Security_CertificateManager::AddCaCertificateBundle___STATIC__BOOLEAN__SZARRAY_U1( CLR_RT_StackFrame& stack ) | ||
{ | ||
NATIVE_PROFILE_CLR_NETWORK(); | ||
NANOCLR_HEADER(); | ||
|
||
CLR_RT_HeapBlock_Array* arrayCA = stack.Arg0().DereferenceArray(); | ||
|
||
CLR_UINT8* certificateBinary; | ||
uint32_t certificateSize; | ||
|
||
// we only have one CA root bundle, so this is fixed to 0 | ||
uint32_t configIndex = 0; | ||
|
||
// check for empty array | ||
FAULT_ON_NULL(arrayCA); | ||
|
||
certificateSize = (int)arrayCA->m_numOfElements; | ||
|
||
// get a pointer to the the binary data for the certificate | ||
certificateBinary = arrayCA->GetFirstElement(); | ||
|
||
if(g_TargetConfiguration.CertificateStore->Count == 0) | ||
{ | ||
// not found, add the certificate bundle | ||
if(ConfigurationManager_StoreConfigurationBlock(certificateBinary, DeviceConfigurationOption_X509CaRootBundle, configIndex, certificateSize, 0) != TRUE) | ||
{ | ||
NANOCLR_SET_AND_LEAVE(CLR_E_FAIL); | ||
} | ||
} | ||
else | ||
{ | ||
// update the configuration block | ||
if(ConfigurationManager_UpdateConfigurationBlock(certificateBinary, DeviceConfigurationOption_X509CaRootBundle, configIndex) != TRUE) | ||
{ | ||
NANOCLR_SET_AND_LEAVE(CLR_E_FAIL); | ||
} | ||
} | ||
|
||
// reach here, we should be OK | ||
stack.SetResult_Boolean(TRUE); | ||
|
||
NANOCLR_NOCLEANUP(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.