forked from nanoframework/nf-interpreter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hashing and cryptography libraries (nanoframework#2803)
- Loading branch information
1 parent
043366e
commit 4fe58c7
Showing
25 changed files
with
662 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# | ||
# Copyright (c) .NET Foundation and Contributors | ||
# See LICENSE file in the project root for full license information. | ||
# | ||
|
||
# native code directory | ||
set(BASE_PATH_FOR_THIS_MODULE ${BASE_PATH_FOR_CLASS_LIBRARIES_MODULES}/nanoFramework.System.IO.Hashing) | ||
|
||
|
||
# set include directories | ||
list(APPEND nanoFramework.System.IO.Hashing_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/CLR/Core) | ||
list(APPEND nanoFramework.System.IO.Hashing_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/CLR/Include) | ||
list(APPEND nanoFramework.System.IO.Hashing_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/HAL/Include) | ||
list(APPEND nanoFramework.System.IO.Hashing_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/PAL/Include) | ||
list(APPEND nanoFramework.System.IO.Hashing_INCLUDE_DIRS ${BASE_PATH_FOR_THIS_MODULE}) | ||
list(APPEND nanoFramework.System.IO.Hashing_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/nanoFramework.System.IO.Hashing) | ||
|
||
# source files | ||
set(nanoFramework.System.IO.Hashing_SRCS | ||
|
||
nf_sys_io_hashing.cpp | ||
|
||
|
||
nf_sys_io_hashing_System_IO_Hashing_Crc32.cpp | ||
|
||
) | ||
|
||
foreach(SRC_FILE ${nanoFramework.System.IO.Hashing_SRCS}) | ||
|
||
set(nanoFramework.System.IO.Hashing_SRC_FILE SRC_FILE-NOTFOUND) | ||
|
||
find_file(nanoFramework.System.IO.Hashing_SRC_FILE ${SRC_FILE} | ||
PATHS | ||
${BASE_PATH_FOR_THIS_MODULE} | ||
${TARGET_BASE_LOCATION} | ||
${PROJECT_SOURCE_DIR}/src/nanoFramework.System.IO.Hashing | ||
|
||
CMAKE_FIND_ROOT_PATH_BOTH | ||
) | ||
|
||
if (BUILD_VERBOSE) | ||
message("${SRC_FILE} >> ${nanoFramework.System.IO.Hashing_SRC_FILE}") | ||
endif() | ||
|
||
list(APPEND nanoFramework.System.IO.Hashing_SOURCES ${nanoFramework.System.IO.Hashing_SRC_FILE}) | ||
|
||
endforeach() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(nanoFramework.System.IO.Hashing DEFAULT_MSG nanoFramework.System.IO.Hashing_INCLUDE_DIRS nanoFramework.System.IO.Hashing_SOURCES) |
51 changes: 51 additions & 0 deletions
51
CMake/Modules/FindnanoFramework.System.Security.Cryptography.cmake
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) .NET Foundation and Contributors | ||
# See LICENSE file in the project root for full license information. | ||
# | ||
|
||
# native code directory | ||
set(BASE_PATH_FOR_THIS_MODULE ${BASE_PATH_FOR_CLASS_LIBRARIES_MODULES}/nanoFramework.System.Security.Cryptography) | ||
|
||
|
||
# set include directories | ||
list(APPEND nanoFramework.System.Security.Cryptography_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/CLR/Core) | ||
list(APPEND nanoFramework.System.Security.Cryptography_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/CLR/Include) | ||
list(APPEND nanoFramework.System.Security.Cryptography_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/HAL/Include) | ||
list(APPEND nanoFramework.System.Security.Cryptography_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/PAL/Include) | ||
list(APPEND nanoFramework.System.Security.Cryptography_INCLUDE_DIRS ${BASE_PATH_FOR_THIS_MODULE}) | ||
list(APPEND nanoFramework.System.Security.Cryptography_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/nanoFramework.System.Security.Cryptography) | ||
|
||
# source files | ||
set(nanoFramework.System.Security.Cryptography_SRCS | ||
|
||
nf_sys_sec_cryptography.cpp | ||
|
||
|
||
nf_sys_sec_cryptography_System_Security_Cryptography_HMACSHA256.cpp | ||
|
||
) | ||
|
||
foreach(SRC_FILE ${nanoFramework.System.Security.Cryptography_SRCS}) | ||
|
||
set(nanoFramework.System.Security.Cryptography_SRC_FILE SRC_FILE-NOTFOUND) | ||
|
||
find_file(nanoFramework.System.Security.Cryptography_SRC_FILE ${SRC_FILE} | ||
PATHS | ||
${BASE_PATH_FOR_THIS_MODULE} | ||
${TARGET_BASE_LOCATION} | ||
${PROJECT_SOURCE_DIR}/src/nanoFramework.System.Security.Cryptography | ||
|
||
CMAKE_FIND_ROOT_PATH_BOTH | ||
) | ||
|
||
if (BUILD_VERBOSE) | ||
message("${SRC_FILE} >> ${nanoFramework.System.Security.Cryptography_SRC_FILE}") | ||
endif() | ||
|
||
list(APPEND nanoFramework.System.Security.Cryptography_SOURCES ${nanoFramework.System.Security.Cryptography_SRC_FILE}) | ||
|
||
endforeach() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(nanoFramework.System.Security.Cryptography DEFAULT_MSG nanoFramework.System.Security.Cryptography_INCLUDE_DIRS nanoFramework.System.Security.Cryptography_SOURCES) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// Copyright (c) .NET Foundation and Contributors | ||
// See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#include "nf_sys_io_hashing.h" | ||
|
||
// clang-format off | ||
|
||
static const CLR_RT_MethodHandler method_lookup[] = | ||
{ | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
Library_nf_sys_io_hashing_System_IO_Hashing_Crc32::ComputeHash___STATIC__U4__U4__SystemSpanByte, | ||
}; | ||
|
||
const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_System_IO_Hashing = | ||
{ | ||
"nanoFramework.System.IO.Hashing", | ||
0xEBD8ED20, | ||
method_lookup, | ||
{ 100, 0, 0, 1 } | ||
}; | ||
|
||
// clang-format on |
Oops, something went wrong.