Compare commits
36 Commits
master
...
develop-Ci
Author | SHA1 | Date | |
---|---|---|---|
|
af3afcbe7b | ||
|
687fd9f497 | ||
|
e79d512aee | ||
|
4f753bc49c | ||
|
c856e44fb9 | ||
|
1cf9d96dd1 | ||
|
3fbfb12294 | ||
|
a98a3d2067 | ||
|
15b983dbed | ||
|
c2fc5feb34 | ||
|
c4b462eb21 | ||
|
84fd2373f4 | ||
|
a3f9ee10c8 | ||
|
6871ae8d8c | ||
|
09c5022ff4 | ||
|
638f75b55f | ||
|
e4855466ef | ||
|
3430231d1b | ||
|
85a4c67256 | ||
|
983ef35471 | ||
|
355a51f01d | ||
|
0b268960ff | ||
|
10d62cf634 | ||
|
d9f277c5e8 | ||
|
0f5d02d5a9 | ||
|
8be0af5639 | ||
|
753cf13ac4 | ||
|
021ca1c1d2 | ||
|
7458b66358 | ||
|
c2521bb736 | ||
|
2218319590 | ||
|
7a29718e68 | ||
|
e7fc9bf478 | ||
|
f34539f561 | ||
|
99a3575e2b | ||
|
7cd8ba0d1e |
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
out/
|
||||
compile_commands.json
|
||||
Makefile.in
|
||||
build*
|
||||
.vscode
|
||||
lib
|
||||
test
|
||||
.idea
|
||||
*.a
|
||||
*.so
|
||||
cmake-build*
|
||||
.DS_Store
|
||||
*.cache
|
||||
CMakeLists.txt.user
|
21
.vscode/c_cpp_properties.json
vendored
Normal file
21
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/AWSM/include",
|
||||
"${workspaceFolder}/AWSMServer/include",
|
||||
"${workspaceFolder}/utils/AWSMProtobuf/include",
|
||||
"${workspaceFolder}/utils/VSClock/include",
|
||||
"${workspaceFolder}/utils/VSConfig/include",
|
||||
"${workspaceFolder}/utils/ZMQLayout/include"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "gnu++17",
|
||||
"intelliSenseMode": "linux-gcc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
9
.vscode/settings.json
vendored
Normal file
9
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"awsdf.h": "c",
|
||||
"sdf.h": "c",
|
||||
"sdf_dev_manage.h": "c",
|
||||
"awsmcall.h": "c",
|
||||
"awsm.pb-c.h": "c"
|
||||
}
|
||||
}
|
BIN
AWSM/AWSMClientTest
Executable file
BIN
AWSM/AWSMClientTest
Executable file
Binary file not shown.
23
AWSM/CMakeLists.txt
Normal file
23
AWSM/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
|
||||
PROJECT(smrpc)
|
||||
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -O3")
|
||||
AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/src src_list)
|
||||
|
||||
#ADD_EXECUTABLE(${PROJECT_NAME} ${src_list} ${PROJECT_SOURCE_DIR}/SMtest.c)
|
||||
ADD_LIBRARY(${PROJECT_NAME} SHARED ${src_list})
|
||||
|
||||
SET_TARGET_PROPERTIES(smrpc PROPERTIES OUTPUT_NAME "sm")
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
TARGET_LINK_LIBRARIES(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
stdc++
|
||||
VSClock
|
||||
VSConfig
|
||||
ZMQLayout
|
||||
AWSMProtobuf
|
||||
)
|
373
AWSM/SMtest.c
Normal file
373
AWSM/SMtest.c
Normal file
@ -0,0 +1,373 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "AWSM.h"
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define CP printf("[%s:%d]\n", __FILE__, __LINE__);
|
||||
|
||||
#define add_error(str) sprintf(ERROR_list + strlen(ERROR_list), "%s 0x%02x\n", #str, rv)
|
||||
#define show(str)\
|
||||
printf("%s_len = %d\n%s = {", #str, str##_len, #str);\
|
||||
for(int i=0; i < str##_len; i++)\
|
||||
printf(" 0x%02x,", str[i]);\
|
||||
printf("};\n\n")
|
||||
#define title(str) printf("/***** %s *****/\n", #str)
|
||||
|
||||
#define SUCCESS 0
|
||||
|
||||
#define CryptKey 0
|
||||
#define SignKey 1
|
||||
|
||||
|
||||
unsigned char EccPrikey[] =
|
||||
{
|
||||
0xa9,0x28,0xa3,0xc2,0x79,0xf1,0x12,0x78,0x4e,0x6b,0x0c,0x59,0xb7,0x22,0xce,0x60,
|
||||
0xa7,0x70,0x3b,0x93,0x94,0xf0,0xe5,0x93,0x9f,0x7d,0x88,0xfb,0xaf,0xd7,0x98,0xbe
|
||||
};
|
||||
/*
|
||||
{
|
||||
0x64,0xfa,0xf7,0x68,0x63,0x9c,0xe1,0xeb,0x02,0x46,0x18,0xec,0x01,0x36,0x36,0xc5,
|
||||
0xeb,0x4e,0x2f,0x36,0xe7,0x51,0x2b,0x3c,0x9c,0x0c,0xbf,0x04,0x01,0x3e,0x52,0x8b
|
||||
};
|
||||
*/
|
||||
unsigned char EccPubkey[] =
|
||||
{
|
||||
0x84,0xb1,0xbd,0x45,0x06,0x19,0x9e,0xdb,0x0b,0x50,0x88,0xdf,0xc4,0x89,0x74,0xab,
|
||||
0x03,0x31,0x54,0x4b,0x8b,0xf0,0xdf,0x84,0x75,0x31,0x4e,0x05,0xb5,0x16,0xf8,0x2d,
|
||||
0x5d,0x4e,0xc9,0x98,0x22,0x22,0x44,0xfd,0x6d,0x93,0xd3,0xf6,0x6b,0xd9,0x74,0x33,
|
||||
0x6a,0x4a,0x59,0xe3,0xda,0xfd,0x6a,0x80,0xc9,0x72,0xab,0x55,0xbc,0x20,0xf1,0x1b
|
||||
};
|
||||
/*
|
||||
{
|
||||
0x6c,0x59,0xe3,0xd8,0xdc,0xd0,0xfd,0xe8,0x3a,0x1c,0x67,0x8b,0xef,0x8a,0x7e,0x41,
|
||||
0x65,0x0d,0x04,0xc0,0xf8,0xf1,0x0f,0x06,0x00,0x6b,0x12,0x71,0x71,0xb2,0xfa,0x89,
|
||||
0x51,0xec,0xe0,0x8e,0x15,0x1e,0xb9,0xef,0x5e,0x74,0xed,0xe8,0xb6,0xdb,0xdc,0xb6,
|
||||
0x4f,0x61,0x7e,0xb9,0x62,0xa8,0xb4,0x67,0x3c,0x16,0x97,0xc0,0x4d,0x5b,0x32,0x2b
|
||||
};
|
||||
*/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
char ERROR_list[2048];
|
||||
memset(ERROR_list, 0, sizeof ERROR_list);
|
||||
/**/
|
||||
title(Device_Init);
|
||||
rv = Device_Init();
|
||||
printf("Device_Init rv = 0x%02x\n", rv);
|
||||
if(rv != SUCCESS) return 0;
|
||||
/**/
|
||||
|
||||
/*/
|
||||
title(Clear_Device_App);
|
||||
Clear_Device_App();
|
||||
|
||||
return;
|
||||
/**/
|
||||
|
||||
/*/
|
||||
unsigned int RetryCount=0;
|
||||
|
||||
rv = Verify_Application_PIN("111111", &RetryCount);
|
||||
printf("rv = 0x%02x RetryCount = %d\n", rv, RetryCount);
|
||||
|
||||
rv = Unlock_Application_PIN("AdminPin", "UserPin", &RetryCount);
|
||||
printf("rv = 0x%02x RetryCount = %d\n", rv, RetryCount);
|
||||
|
||||
rv = Verify_Application_PIN("111111", &RetryCount);
|
||||
printf("rv = 0x%02x RetryCount = %d\n", rv, RetryCount);
|
||||
rv = Verify_Application_PIN("UserPin", &RetryCount);
|
||||
printf("rv = 0x%02x RetryCount = %d\n", rv, RetryCount);
|
||||
|
||||
rv = Change_Application_PIN("UserPin", "1111111", RetryCount);
|
||||
printf("rv = 0x%02x RetryCount = %d\n", rv, RetryCount);
|
||||
|
||||
rv = Verify_Application_PIN("1111111", &RetryCount);
|
||||
printf("rv = 0x%02x RetryCount = %d\n", rv, RetryCount);
|
||||
rv = Verify_Application_PIN("UserPin", &RetryCount);
|
||||
printf("rv = 0x%02x RetryCount = %d\n", rv, RetryCount);
|
||||
|
||||
rv = Change_Application_PIN("1111111", "UserPin", RetryCount);
|
||||
printf("rv = 0x%02x RetryCount = %d\n", rv, RetryCount);
|
||||
|
||||
rv = Verify_Application_PIN("UserPin", &RetryCount);
|
||||
printf("rv = 0x%02x RetryCount = %d\n", rv, RetryCount);
|
||||
|
||||
/**/
|
||||
|
||||
unsigned char random[20];
|
||||
unsigned int random_len = 16;
|
||||
title(Generate_Rand);
|
||||
rv = Generate_Rand(random, random_len);
|
||||
if(rv != SUCCESS) add_error(Generate_Rand);
|
||||
else printf("Generate_Rand SUCCESS\n\n");
|
||||
show(random);
|
||||
|
||||
unsigned char Hash_Data[35];
|
||||
unsigned int Hash_Data_len = 32;
|
||||
|
||||
title(Generate_Hash);
|
||||
rv = Generate_Hash(random, random_len, Hash_Data, &Hash_Data_len, EccPubkey, SGD_SM3);
|
||||
if(rv != SUCCESS) add_error(Generate_Hash);
|
||||
else printf("Generate_Hash SUCCESS\n\n");
|
||||
show(Hash_Data);
|
||||
|
||||
title(Generate_Hash);
|
||||
rv = Generate_Hash(random, random_len, Hash_Data, &Hash_Data_len, NULL, SGD_SM3);
|
||||
if(rv != SUCCESS) add_error(Generate_Hash);
|
||||
else printf("Generate_Hash SUCCESS\n\n");
|
||||
show(Hash_Data);
|
||||
|
||||
unsigned char Sign_Data[65];
|
||||
unsigned int Sign_Data_len = 65;
|
||||
title(Generate_SignData_ExtPrikey);
|
||||
rv = Generate_SignData_ExtPrikey(EccPrikey, Hash_Data, Hash_Data_len, Sign_Data, &Sign_Data_len);
|
||||
if(rv != SUCCESS) add_error(Generate_SignData_ExtPrikey);
|
||||
show(Sign_Data);
|
||||
|
||||
title(Verify_SignData_ExtPubkey);
|
||||
rv = Verify_SignData_ExtPubkey(EccPubkey, Hash_Data, Hash_Data_len, Sign_Data, Sign_Data_len);
|
||||
if(rv != SUCCESS) add_error(Verify_SignData_ExtPubkey);
|
||||
else printf("Verify_SignData_ExtPubkey SUCCESS\n\n");
|
||||
|
||||
unsigned char vkek_in[1024];
|
||||
unsigned int vkek_in_len = 16;
|
||||
title(Generate_Rand);
|
||||
rv = Generate_Rand(vkek_in, vkek_in_len);
|
||||
if(rv != SUCCESS) add_error(Generate_Rand);
|
||||
else printf("Generate_Rand SUCCESS\n\n");
|
||||
|
||||
unsigned char ECC_Encrypt_Data[1024];
|
||||
unsigned int ECC_Encrypt_Data_len = 1024;
|
||||
title(SM2_3_Encrypt_ExtPubkey);
|
||||
rv = SM2_3_Encrypt_ExtPubkey(EccPubkey, vkek_in, vkek_in_len, ECC_Encrypt_Data, &ECC_Encrypt_Data_len);
|
||||
if(rv != SUCCESS) add_error(SM2_3_Encrypt_ExtPubkey);
|
||||
show(ECC_Encrypt_Data);
|
||||
|
||||
unsigned char vkek_out[1024];
|
||||
unsigned int vkek_out_len = 16;
|
||||
title(SM2_3_Decrypt_ExtPrikey);
|
||||
rv = SM2_3_Decrypt_ExtPrikey(EccPrikey, ECC_Encrypt_Data, ECC_Encrypt_Data_len, vkek_out, &vkek_out_len);
|
||||
if(rv != SUCCESS) add_error(SM2_3_Decrypt_ExtPrikey);
|
||||
|
||||
show(vkek_in);
|
||||
show(vkek_out);
|
||||
|
||||
//unsigned char KeyValue[16] = { 0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38 };
|
||||
unsigned char KeyValue[16] = { 0 };
|
||||
unsigned int Key_len = 16;
|
||||
unsigned char IV[16] = { 0 };
|
||||
unsigned char EncryptData[200];
|
||||
unsigned int EncryptData_len = 200;
|
||||
unsigned char DecryptData[200];
|
||||
unsigned int DecryptData_len = 200;
|
||||
unsigned char in[64];
|
||||
unsigned int in_len = 64;
|
||||
|
||||
title(Generate_Rand);
|
||||
rv = Generate_Rand(in, in_len);
|
||||
if(rv != SUCCESS) add_error(Generate_Rand);
|
||||
show(in);
|
||||
|
||||
title(SM1_Encrypt);
|
||||
rv = SM1_Encrypt(P_AlG_ECB, IV, KeyValue, Key_len, in, in_len, EncryptData, &EncryptData_len);
|
||||
if(rv != SUCCESS) add_error(SM1_Encrypt);
|
||||
show(EncryptData);
|
||||
|
||||
title(SM1_Decrypt);
|
||||
rv = SM1_Decrypt(P_AlG_ECB, IV, KeyValue, Key_len, EncryptData, EncryptData_len, DecryptData, &DecryptData_len);
|
||||
if(rv != SUCCESS) add_error(SM1_Decrypt);
|
||||
show(DecryptData);
|
||||
|
||||
memset(EncryptData, 0, sizeof EncryptData);
|
||||
EncryptData_len = 200;
|
||||
memset(DecryptData, 0, sizeof DecryptData);
|
||||
DecryptData_len= 200;
|
||||
|
||||
title(SM4_Encrypt);
|
||||
rv = SM4_Encrypt(P_AlG_OFB, IV, KeyValue, Key_len, in, in_len, EncryptData, &EncryptData_len);
|
||||
if(rv != SUCCESS) add_error(SM4_Encrypt);
|
||||
show(EncryptData);
|
||||
|
||||
title(SM4_Decrypt);
|
||||
rv = SM4_Decrypt(P_AlG_OFB, IV, KeyValue, Key_len, EncryptData, EncryptData_len, DecryptData, &DecryptData_len);
|
||||
if(rv != SUCCESS) add_error(SM4_Decrypt);
|
||||
show(DecryptData);
|
||||
|
||||
unsigned char hw_code[23] = { 0 };
|
||||
title(Get_Hwcode);
|
||||
rv = Get_Hwcode(hw_code);
|
||||
if(rv != SUCCESS) add_error(Get_Hwcode);
|
||||
printf("hw_code rv = %02x is: %s\n\n", rv, hw_code);
|
||||
|
||||
unsigned char DevInfo[2048] = { 0 };
|
||||
title(Get_DevInfo);
|
||||
rv = Get_DevInfo(hw_code);
|
||||
if(rv != SUCCESS) add_error(Get_DevInfo);
|
||||
printf("DevInfo rv = %02x is: %s\n\n", rv, DevInfo);
|
||||
|
||||
unsigned char Publickey[65];
|
||||
unsigned char Publickey_len = 64;
|
||||
/*/
|
||||
title(Generate_ECCKeyPair);
|
||||
rv = Generate_ECCKeyPair();
|
||||
if(rv != SUCCESS) add_error(Generate_ECCKeyPair);
|
||||
else printf("Generate_ECCKeyPair SUCCESS\n\n");
|
||||
/**/
|
||||
|
||||
memset(Publickey, 0, sizeof Publickey);
|
||||
title(Export_publickey);
|
||||
rv = Export_publickey(CryptKey, Publickey);
|
||||
if (rv != SUCCESS) add_error(Export_publickey);
|
||||
else { show(Publickey); }
|
||||
|
||||
title(Export_publickey);
|
||||
rv = Export_publickey(SignKey, Publickey);
|
||||
if(rv != SUCCESS) add_error(Export_publickey);
|
||||
else { show(Publickey); }
|
||||
|
||||
unsigned char SignTure[65];
|
||||
unsigned int SignTure_len = 65;
|
||||
title(Generate_SignData_IntPrikey);
|
||||
rv = Generate_SignData_IntPrikey(Hash_Data, Hash_Data_len, SignTure, &SignTure_len);
|
||||
if(rv != SUCCESS) add_error(Generate_SignData_IntPrikey);
|
||||
show(SignTure);
|
||||
|
||||
title(Verify_SignData_ExtPubkey);
|
||||
rv = Verify_SignData_ExtPubkey(Publickey, Hash_Data, Hash_Data_len, SignTure, SignTure_len);
|
||||
if(rv != SUCCESS) add_error(Verify_SignData_ExtPubkey);
|
||||
else printf("Verify_SignData_ExtPubkey SUCCESS\n\n");
|
||||
|
||||
memset(vkek_in, 0, sizeof vkek_in);
|
||||
memset(vkek_out, 0, sizeof vkek_out);
|
||||
memset(ECC_Encrypt_Data, 0, sizeof ECC_Encrypt_Data);
|
||||
|
||||
vkek_in_len = 128;
|
||||
vkek_out_len = 512;
|
||||
ECC_Encrypt_Data_len = 1024;
|
||||
title(Generate_Rand);
|
||||
rv = Generate_Rand(vkek_in, vkek_in_len);
|
||||
if(rv != SUCCESS) add_error(Generate_Rand);
|
||||
else printf("Generate_Rand SUCCESS\n\n");
|
||||
|
||||
title(SM2_3_Encrypt_ExtPubkey);
|
||||
rv = SM2_3_Encrypt_ExtPubkey(Publickey, vkek_in, vkek_in_len, ECC_Encrypt_Data, &ECC_Encrypt_Data_len);
|
||||
if(rv != SUCCESS) add_error(SM2_3_Encrypt_ExtPubkey);
|
||||
show(ECC_Encrypt_Data);
|
||||
|
||||
title(SM2_3_Decrypt_IntPrikey);
|
||||
rv = SM2_3_Decrypt_IntPrikey(ECC_Encrypt_Data, ECC_Encrypt_Data_len, vkek_out, &vkek_out_len);
|
||||
if(rv != SUCCESS) add_error(SM2_3_Decrypt_IntPrikey);
|
||||
|
||||
show(vkek_in);
|
||||
show(vkek_out);
|
||||
|
||||
memset(Publickey, 0, sizeof Publickey);
|
||||
title(Export_publickey);
|
||||
rv = Export_publickey(CryptKey, Publickey);
|
||||
if(rv != SUCCESS) add_error(Export_publickey);
|
||||
show(Publickey);
|
||||
|
||||
title(Generate_Rand);
|
||||
rv = Generate_Rand(vkek_in, vkek_in_len);
|
||||
if(rv != SUCCESS) add_error(Generate_Rand);
|
||||
else printf("Generate_Rand SUCCESS\n\n");
|
||||
|
||||
title(SM2_3_Encrypt_ExtPubkey);
|
||||
rv = SM2_3_Encrypt_ExtPubkey(Publickey, vkek_in, vkek_in_len, ECC_Encrypt_Data, &ECC_Encrypt_Data_len);
|
||||
if(rv != SUCCESS) add_error(SM2_3_Encrypt_ExtPubkey);
|
||||
show(ECC_Encrypt_Data);
|
||||
|
||||
title(SM2_3_Decrypt_IntCryptPrikey);
|
||||
rv = SM2_3_Decrypt_IntCryptPrikey(ECC_Encrypt_Data, ECC_Encrypt_Data_len, vkek_out, &vkek_out_len);
|
||||
if(rv != SUCCESS) add_error(SM2_3_Decrypt_IntCryptPrikey);
|
||||
|
||||
show(vkek_in);
|
||||
show(vkek_out);
|
||||
|
||||
unsigned char ans[2049];
|
||||
unsigned int ans_len = 2049;
|
||||
|
||||
char temp_data1[] = "asdddasdasdwaccdcqwwedacawe\0";
|
||||
unsigned int temp_data1_len = 29;
|
||||
title(Import_Certificate);
|
||||
rv = Import_Certificate(1, temp_data1, temp_data1_len);
|
||||
if(rv != SUCCESS) add_error(Import_Certificate);
|
||||
|
||||
char temp_data2[] = "xcvzxcvkehuuxcaw\0";
|
||||
unsigned int temp_data2_len = 18;
|
||||
title(Import_Certificate);
|
||||
rv = Import_Certificate(2, temp_data2, temp_data2_len);
|
||||
if(rv != SUCCESS) add_error(Import_Certificate);
|
||||
|
||||
char *temp_data3 = (char *)malloc(sizeof(char) * (2048 + 1));
|
||||
memset(temp_data3, 0, sizeof(char) * (2048 + 1));
|
||||
unsigned int temp_data3_len = 2048;
|
||||
title(Import_Certificate);
|
||||
rv = Import_Certificate(3, temp_data3, temp_data3_len);
|
||||
if(rv != SUCCESS) add_error(Import_Certificate);
|
||||
free(temp_data3);
|
||||
|
||||
// char temp_data4[] = "fkeubckhaugwmksndksahiuahcww\0";
|
||||
// unsigned int temp_data4_len = strlen(temp_data4) + 1;
|
||||
// title(Import_Certificate);
|
||||
// rv = Import_Certificate(4, temp_data4, temp_data4_len);
|
||||
// if(rv != SUCCESS) add_error(Import_Certificate);
|
||||
|
||||
title(Export_Certificate);
|
||||
rv = Export_Certificate(1, ans, &ans_len);
|
||||
if(rv != SUCCESS) add_error(Export_Certificate);
|
||||
printf("ans = %s\n\n", ans);
|
||||
|
||||
title(Export_Certificate);
|
||||
rv = Export_Certificate(2, ans, &ans_len);
|
||||
if(rv != SUCCESS) add_error(Export_Certificate);
|
||||
printf("ans = %s\n\n", ans);
|
||||
|
||||
title(Export_Certificate);
|
||||
rv = Export_Certificate(3, ans, &ans_len);
|
||||
if(rv != SUCCESS) add_error(Export_Certificate);
|
||||
printf("ans = %s\n\n", ans);
|
||||
|
||||
// title(Export_Certificate);
|
||||
// rv = Export_Certificate(4, ans, &ans_len);
|
||||
// if(rv != SUCCESS) add_error(Export_Certificate);
|
||||
// printf("ans = %s\n\n", ans);
|
||||
|
||||
// title(Device_Status);
|
||||
// rv = Device_Status();
|
||||
// if(rv != SUCCESS) add_error(Device_Status);
|
||||
// else printf("Device_Status SUCCESS\n\n");
|
||||
|
||||
|
||||
// unsigned char temp_data5[] = "vkek";
|
||||
// unsigned char temp_data6[] = "keyvision";
|
||||
// title(Set_SM);
|
||||
// rv = Set_SM(temp_data5, sizeof(temp_data5), temp_data6, sizeof(temp_data6));
|
||||
// if(rv != SUCCESS) add_error(Set_SM);
|
||||
// else printf("Set_SM SUCCESS\n\n");
|
||||
|
||||
// unsigned char *ans1 = malloc(64);
|
||||
// unsigned int ans1Len = 64;
|
||||
// unsigned char *ans2 = malloc(64);
|
||||
// unsigned int ans2Len = 64;
|
||||
// title(Get_SM);
|
||||
// rv = Get_SM(&ans1, &ans1Len, &ans2, &ans2Len);
|
||||
// if(rv != SUCCESS) add_error(Get_SM);
|
||||
// else printf("Set_SM SUCCESS\n\n");
|
||||
// printf("ans1 = %s\n\n", ans1);
|
||||
// printf("ans2 = %s\n\n", ans2);
|
||||
|
||||
|
||||
|
||||
Close_Device();
|
||||
|
||||
printf("%s",ERROR_list);
|
||||
|
||||
//system("pause");
|
||||
|
||||
return 0;
|
||||
}
|
403
AWSM/include/AWSM.h
Normal file
403
AWSM/include/AWSM.h
Normal file
@ -0,0 +1,403 @@
|
||||
#ifndef __AWSM_H__
|
||||
#define __AWSM_H__
|
||||
|
||||
// PIN<49>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define ADMIN_TYPE 0
|
||||
#define USER_TYPE 1
|
||||
|
||||
#define ECCPRIVATEKEYBITLENGTH 256
|
||||
#define ECCPRIVATEKEYLENGTH 32
|
||||
|
||||
// <20>㷨<EFBFBD><E3B7A8>־
|
||||
// SM1
|
||||
#define SGD_SM1_ECB 0x00000101
|
||||
#define SGD_SM1_CBC 0x00000102
|
||||
#define SGD_SM1_CFB 0x00000104
|
||||
#define SGD_SM1_OFB 0x00000108
|
||||
#define SGD_SM1_MAC 0x00000110
|
||||
// SM4
|
||||
#define SGD_SMS4_ECB 0x00000401
|
||||
#define SGD_SMS4_CBC 0x00000402
|
||||
#define SGD_SMS4_CFB 0x00000404
|
||||
#define SGD_SMS4_OFB 0x00000408
|
||||
// AES
|
||||
#define SGD_AES128_ECB 0x00000801
|
||||
#define SGD_AES128_CBC 0x00000802
|
||||
#define SGD_AES128_CFB 0x00000804
|
||||
#define SGD_AES128_OFB 0x00000808
|
||||
|
||||
#define SGD_AES192_ECB 0x00000811
|
||||
#define SGD_AES192_CBC 0x00000812
|
||||
#define SGD_AES192_CFB 0x00000814
|
||||
#define SGD_AES192_OFB 0x00000818
|
||||
|
||||
#define SGD_AES256_ECB 0x00000821
|
||||
#define SGD_AES256_CBC 0x00000822
|
||||
#define SGD_AES256_CFB 0x00000824
|
||||
#define SGD_AES256_OFB 0x00000828
|
||||
// DES
|
||||
#define SGD_DES_ECB 0x00001001
|
||||
#define SGD_DES_CBC 0x00001002
|
||||
#define SGD_DES_CFB 0x00001004
|
||||
#define SGD_DES_OFB 0x00001008
|
||||
// 3DES_2KEY
|
||||
#define SGD_D3DES_ECB 0x00001011
|
||||
#define SGD_D3DES_CBC 0x00001012
|
||||
#define SGD_D3DES_CFB 0x00001014
|
||||
#define SGD_D3DES_OFB 0x00001018
|
||||
// 3DES_3KEY
|
||||
#define SGD_T3DES_ECB 0x00001021
|
||||
#define SGD_T3DES_CBC 0x00001022
|
||||
#define SGD_T3DES_CFB 0x00001024
|
||||
#define SGD_T3DES_OFB 0x00001028
|
||||
|
||||
// <20>ǶԳ<C7B6>
|
||||
#define SGD_RSA 0x00010000
|
||||
#define SGD_SM2_1 0x00020100 // <20><>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD>㷨
|
||||
#define SGD_SM2_2 0x00020200 // <20><>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD>Э<EFBFBD><D0AD>
|
||||
#define SGD_SM2_3 0x00020400 // <20><>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD>㷨
|
||||
|
||||
// <20>Ӵ<EFBFBD><D3B4>㷨<EFBFBD><E3B7A8>־
|
||||
#define SGD_SM3 0x00000001
|
||||
#define SGD_SHA1 0x00000002
|
||||
#define SGD_SHA256 0x00000004
|
||||
|
||||
#define SKF_USE_ENCDEC 0x01 // <20><><EFBFBD>ڼ<EFBFBD><DABC>ܽ<EFBFBD><DCBD><EFBFBD>
|
||||
#define SKF_USE_SIGVER 0x02 // <20><><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>֤
|
||||
|
||||
/**
|
||||
* @enum 对称加密算法模式
|
||||
*/
|
||||
enum PerformanceAlgMode { P_AlG_ECB, P_AlG_CBC, P_AlG_CFB, P_AlG_OFB };
|
||||
|
||||
enum EccKeyPairType { CryptKey, SignatureKey };
|
||||
|
||||
/**
|
||||
* @brief 设备初始化
|
||||
*
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Device_Init();
|
||||
|
||||
/**
|
||||
* @brief 设备初始化
|
||||
*
|
||||
* @param IP 服务器IP
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Device_Init_IP(unsigned char *IP);
|
||||
|
||||
// int Unlock_Application_PIN(unsigned char *AdminPin, unsigned char
|
||||
// *NewUserPIN, unsigned int *RetryCount);
|
||||
|
||||
// int Change_Application_PIN(unsigned char *Old, unsigned char *New, unsigned
|
||||
// int *RetryCount);
|
||||
|
||||
// int Verify_Application_PIN(unsigned char *PIN, unsigned int *RetryCount);
|
||||
|
||||
int Generate_Hash_Init(void *ctx, unsigned char *EccPublickey);
|
||||
|
||||
int Generate_Hash_Update(void *ctx, unsigned char *Source_Data,
|
||||
unsigned int SourceDataLen);
|
||||
|
||||
int Generate_Hash_Final(void *ctx, unsigned char *HashData,
|
||||
unsigned int *HashDataLen);
|
||||
|
||||
/**
|
||||
* @brief 生成哈希
|
||||
*
|
||||
* @param SourceData 待哈希源数据
|
||||
* @param SourceDataLen 待哈希源数据长度
|
||||
* @param HashData 哈希数据缓冲区
|
||||
* @param HashDataLen 哈希数据缓冲区长度
|
||||
* @param EccPublickey 公钥明文数据
|
||||
* @param HashType 哈希类型 SGD_SM3
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Generate_Hash(unsigned char *SourceData, unsigned int SourceDataLen,
|
||||
unsigned char *HashData, unsigned int *HashDataLen,
|
||||
unsigned char *EccPublickey, unsigned int HashType);
|
||||
|
||||
/**
|
||||
* @brief 生成随机数
|
||||
*
|
||||
* @param ucRandom 生成随机数缓冲区
|
||||
* @param ulRandomLen 生成随机数缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Generate_Rand(unsigned char *ucRandom, unsigned int ulRandomLen);
|
||||
|
||||
/**
|
||||
* @brief 内部私钥签名
|
||||
*
|
||||
* @param SignData 待签名源数据
|
||||
* @param SignDataLen 待签名源数据长度
|
||||
* @param EccSignBlobData 签名数据缓冲区
|
||||
* @param EccSignBlobDatalen 签名数据缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Generate_SignData_IntPrikey(unsigned char *SignData,
|
||||
unsigned int SignDataLen,
|
||||
unsigned char *EccSignBlobData,
|
||||
unsigned int *EccSignBlobDatalen);
|
||||
|
||||
/**
|
||||
* @brief 外部私钥签名
|
||||
*
|
||||
* @param EccPrikey 外部私钥明文数据
|
||||
* @param SignData 待签名源数据
|
||||
* @param SignDataLen 待签名源数据长度
|
||||
* @param EccSignBlobData 生成签名数据缓冲区
|
||||
* @param EccSignBlobDataLen 生成签名数据缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Generate_SignData_ExtPrikey(unsigned char *EccPrikey,
|
||||
unsigned char *SignData,
|
||||
unsigned int SignDataLen,
|
||||
unsigned char *EccSignBlobData,
|
||||
unsigned int *EccSignBlobDataLen);
|
||||
|
||||
/**
|
||||
* @brief 外部公钥验签
|
||||
*
|
||||
* @param EccPublickey 公钥明文数据
|
||||
* @param SignatureData 签名源数据
|
||||
* @param SignDataLen 签名源数据长度
|
||||
* @param EccSignBlobData 签名数据
|
||||
* @param EccSignBlobDataLen 签名数据长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Verify_SignData_ExtPubkey(unsigned char *EccPublickey,
|
||||
unsigned char *SignatureData,
|
||||
unsigned int SignDataLen,
|
||||
unsigned char *EccSignBlobData,
|
||||
unsigned int EccSignBlobDataLen);
|
||||
|
||||
/**
|
||||
* @brief 外部公钥加密
|
||||
*
|
||||
* @param EPublickey 公钥明文数据
|
||||
* @param InData 待加密源数据
|
||||
* @param InDataLen 待加密源数据长度
|
||||
* @param ECCCIPPHERData 加密数据缓冲区
|
||||
* @param ECCCIPPHERDataLen 加密数据缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int SM2_3_Encrypt_ExtPubkey(unsigned char *EPublickey, unsigned char *InData,
|
||||
unsigned int InDataLen,
|
||||
unsigned char *ECCCIPPHERData,
|
||||
unsigned int *ECCCIPPHERDataLen);
|
||||
|
||||
/**
|
||||
* @brief 外部私钥解密
|
||||
*
|
||||
* @param EPrikey 私钥明文数据
|
||||
* @param ECCCIPPHERData 待解密数据
|
||||
* @param ECCCIPPHERDataLen 待解密数据长度
|
||||
* @param OutData 解密数据缓冲区
|
||||
* @param OutDataLen 解密数据缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int SM2_3_Decrypt_ExtPrikey(unsigned char *EPrikey,
|
||||
unsigned char *ECCCIPPHERData,
|
||||
unsigned int ECCCIPPHERDataLen,
|
||||
unsigned char *OutData, unsigned int *OutDataLen);
|
||||
|
||||
/**
|
||||
* @brief 内部签名私钥解密
|
||||
*
|
||||
* @param ECCCIPPHERData 待解密数据
|
||||
* @param ECCCIPPHERDataLen 待解密数据长度
|
||||
* @param OutData 解密数据缓冲区
|
||||
* @param OutDataLen 解密数据缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int SM2_3_Decrypt_IntPrikey(unsigned char *ECCCIPPHERData,
|
||||
unsigned int ECCCIPPHERDataLen,
|
||||
unsigned char *OutData, unsigned int *OutDataLen);
|
||||
|
||||
/**
|
||||
* @brief 内部加密私钥解密
|
||||
*
|
||||
* @param ECCCIPPHERData 待解密数据
|
||||
* @param ECCCIPPHERDataLen 待解密数据长度
|
||||
* @param OutData 解密数据缓冲区
|
||||
* @param OutDataLen 解密数据缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int SM2_3_Decrypt_IntCryptPrikey(unsigned char *ECCCIPPHERData,
|
||||
unsigned int ECCCIPPHERDataLen,
|
||||
unsigned char *OutData,
|
||||
unsigned int *OutDataLen);
|
||||
|
||||
/**
|
||||
* @brief SM1加密
|
||||
*
|
||||
* @param AlgMode 算法类型 enum PerformanceAlgMode
|
||||
* @param pIv IV
|
||||
* @param Key Key
|
||||
* @param KeyLen Key长度
|
||||
* @param InData 待加密源数据
|
||||
* @param InDataLen 待加密源数据长度
|
||||
* @param OutData 加密数据缓冲区
|
||||
* @param OutDataLen 加密数据缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int SM1_Encrypt(const int AlgMode, unsigned char *pIv, unsigned char *Key,
|
||||
unsigned int KeyLen, unsigned char *InData,
|
||||
unsigned int InDataLen, unsigned char *OutData,
|
||||
unsigned int *OutDataLen);
|
||||
|
||||
/**
|
||||
* @brief SM1解密
|
||||
*
|
||||
* @param AlgMode 算法类型 enum PerformanceAlgMode
|
||||
* @param pIv IV
|
||||
* @param Key Key
|
||||
* @param KeyLen Key长度
|
||||
* @param InData 待解密数据
|
||||
* @param InDataLen 待解密数据长度
|
||||
* @param OutData 解密数据缓冲区
|
||||
* @param OutDataLen 解密数据缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int SM1_Decrypt(const int AlgMode, unsigned char *pIv, unsigned char *Key,
|
||||
unsigned int KeyLen, unsigned char *InData,
|
||||
unsigned int InDataLen, unsigned char *OutData,
|
||||
unsigned int *OutDataLen);
|
||||
|
||||
/**
|
||||
* @brief SM4加密
|
||||
*
|
||||
* @param AlgMode 算法类型 enum PerformanceAlgMode
|
||||
* @param pIv IV
|
||||
* @param Key Key
|
||||
* @param KeyLen Key长度
|
||||
* @param InData 待加密源数据
|
||||
* @param InDataLen 待加密源数据长度
|
||||
* @param OutData 加密数据缓冲区
|
||||
* @param OutDataLen 加密数据缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int SM4_Encrypt(const int AlgMode, unsigned char *pIv, unsigned char *Key,
|
||||
unsigned int KeyLen, unsigned char *InData,
|
||||
unsigned int InDataLen, unsigned char *OutData,
|
||||
unsigned int *OutDataLen);
|
||||
|
||||
/**
|
||||
* @brief SM4解密
|
||||
*
|
||||
* @param AlgMode 算法类型 enum PerformanceAlgMode
|
||||
* @param pIv IV
|
||||
* @param Key Key
|
||||
* @param KeyLen Key长度
|
||||
* @param InData 待解密源数据
|
||||
* @param InDataLen 待解密源数据长度
|
||||
* @param OutData 解密数据缓冲区
|
||||
* @param OutDataLen 解密数据缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int SM4_Decrypt(const int AlgMode, unsigned char *pIv, unsigned char *Key,
|
||||
unsigned int KeyLen, unsigned char *InData,
|
||||
unsigned int InDataLen, unsigned char *OutData,
|
||||
unsigned int *OutDataLen);
|
||||
|
||||
/**
|
||||
* @brief 内部生成新加密公私钥对
|
||||
*
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Generate_ECCKeyPair();
|
||||
|
||||
/**
|
||||
* @brief 导出公钥
|
||||
*
|
||||
* @param KeyPairtype 公钥类型 enum EccKeyPairType
|
||||
* @param publickey 公钥明文数据缓冲区
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Export_publickey(unsigned int KeyPairtype, unsigned char *publickey);
|
||||
|
||||
/**
|
||||
* @brief 导入公钥
|
||||
*
|
||||
* @param KeyPairtype 公钥类型 enum EccKeyPairType
|
||||
* @param Privatkey 私钥明文数据
|
||||
* @param Publickey 公钥明文数据
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Import_ECCKeyPair(unsigned int KeyPairtype, unsigned char *Privatkey,
|
||||
unsigned char *Publickey);
|
||||
|
||||
// int Import_ECCKeyPair_Ciphertext(unsigned char *KeyPairCiphertext, unsigned
|
||||
// int KeyPairCiphertextLen);
|
||||
|
||||
/**
|
||||
* @brief 文件导入证书
|
||||
*
|
||||
* @param CerType 证书类型
|
||||
* @param InData 待导入数据
|
||||
* @param InDataLen 待导入数据长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Import_Certificate(unsigned int CerType, char *InData,
|
||||
unsigned int InDataLen);
|
||||
|
||||
/**
|
||||
* @brief 文件导出证书
|
||||
*
|
||||
* @param CerType 证书类型
|
||||
* @param OutData 导出数据缓冲区
|
||||
* @param OutDataLen 导出数据缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Export_Certificate(unsigned int CerType, char *OutData,
|
||||
unsigned int *OutDataLen);
|
||||
|
||||
/**
|
||||
* @brief 导入文件
|
||||
*
|
||||
* @param FileName 文件名
|
||||
* @param InData 待导入数据
|
||||
* @param InDataLen 待导入数据长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int ImportFile(char *FileName, char *InData, int InDataLen);
|
||||
|
||||
/**
|
||||
* @brief 文件导出
|
||||
*
|
||||
* @param FileName 文件名
|
||||
* @param OutData 导出数据缓冲区
|
||||
* @param OutDataLen 导出数据缓冲区长度
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int ExportFile(char *FileName, char *OutData, int *OutDataLen);
|
||||
|
||||
/**
|
||||
* @brief 获取HWCode
|
||||
*
|
||||
* @param HwCode HWCode缓冲区
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Get_Hwcode(unsigned char *HwCode);
|
||||
|
||||
/**
|
||||
* @brief 获取设备信息
|
||||
*
|
||||
* @param DevInfo 设备信息缓冲区
|
||||
* @return int 0成功,其他失败
|
||||
*/
|
||||
int Get_DevInfo(unsigned char *DevInfo);
|
||||
|
||||
// int Device_Status();
|
||||
|
||||
/**
|
||||
* @brief 关闭设备
|
||||
*
|
||||
*/
|
||||
void Close_Device();
|
||||
|
||||
// void Clear_Device_App();
|
||||
|
||||
#endif
|
1765
AWSM/src/AWSM.c
Normal file
1765
AWSM/src/AWSM.c
Normal file
File diff suppressed because it is too large
Load Diff
94
AWSMServer/AWSMServer.c
Normal file
94
AWSMServer/AWSMServer.c
Normal file
@ -0,0 +1,94 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "VSConfig.h"
|
||||
|
||||
#include "ZMQLayout.h"
|
||||
|
||||
#include "AWSMCall.h"
|
||||
|
||||
#define CallXXX(XXX, XXXLEN) \
|
||||
if( psZMQBuf->iBufLen >= (XXXLEN) && !strncmp(psZMQBuf->pcBuf, (#XXX), (XXXLEN))) \
|
||||
{ \
|
||||
psReply = Call##XXX (psZMQBuf->pcBuf + (XXXLEN), psZMQBuf->iBufLen - (XXXLEN)); \
|
||||
}
|
||||
|
||||
static char pcAddress[512] = "tcp://localhost:60006";
|
||||
|
||||
int main()
|
||||
{
|
||||
int rv = AWSMCallInit();
|
||||
if(rv) { printf("rv = %x", rv); return 0; }
|
||||
|
||||
static char pcIP[128] = "localhost";
|
||||
static char pcPort[32] = "60006";
|
||||
|
||||
VSConfig_s psConfig[] =
|
||||
VSConfigStart
|
||||
VSConfigString("IP", pcIP, 128, "IP")
|
||||
VSConfigString("Port", pcPort, 32, "Port")
|
||||
VSConfigEnd
|
||||
|
||||
if(!VSConfig(psConfig, "../config/AWSMRPC.conf") || !VSConfig(psConfig, "/etc/awconfig/AWSMRPC.conf"))
|
||||
snprintf(pcAddress, 512, "tcp://%s:%s", pcIP, pcPort);
|
||||
|
||||
printf("%s\n", pcAddress);
|
||||
pZMQ_s psZMQ = ZMQServerInit(pcAddress);
|
||||
if(!psZMQ) { printf("ZMQServerInit fail\n"); return 0; }
|
||||
|
||||
int iCnt = 0;
|
||||
|
||||
pZMQBuf_s psZMQBuf = NULL;
|
||||
pAWSMProtobuf_s psReply = NULL;
|
||||
while(1)
|
||||
{
|
||||
psZMQBuf = ZMQRecv(psZMQ, -1);
|
||||
if(!psZMQBuf) { printf("ZMQRecv fail\n"); break; }
|
||||
|
||||
CallXXX(HashInit, 8)
|
||||
else CallXXX(HashUpdate, 10)
|
||||
else CallXXX(HashFinal, 9)
|
||||
else CallXXX(Hash, 4)
|
||||
else CallXXX(Rand, 4)
|
||||
else CallXXX(SignatureByIntPrikey, 20)
|
||||
else CallXXX(SignatureByExtPrikey, 20)
|
||||
else CallXXX(VerifySignature, 15)
|
||||
else CallXXX(SM2EncryptByExtPubKey, 21)
|
||||
else CallXXX(SM2DecryptByExtPrikey, 21)
|
||||
else CallXXX(SM2DecryptByIntPrikey, 21)
|
||||
else CallXXX(SM2DecryptByIntCryptPrikey, 26)
|
||||
else CallXXX(SM1Encrypt, 10)
|
||||
else CallXXX(SM1Decrypt, 10)
|
||||
else CallXXX(SM4Encrypt, 10)
|
||||
else CallXXX(SM4Decrypt, 10)
|
||||
else CallXXX(GenerateECCKeyPair, 18)
|
||||
else CallXXX(ExportPubkey, 12)
|
||||
else CallXXX(ImportKeyPair, 13)
|
||||
else CallXXX(ImportCertificate, 17)
|
||||
else CallXXX(ExportCertificate, 17)
|
||||
else CallXXX(ImportFile, 10)
|
||||
else CallXXX(ExportFile, 10)
|
||||
else CallXXX(GetHwcode, 9)
|
||||
else CallXXX(GetDevInfo, 10)
|
||||
|
||||
if(psReply)
|
||||
{
|
||||
ZMQSend(psZMQ, psReply->pcBuf, psReply->iBufLen);
|
||||
AWSMProtobufDestroy(psReply); psReply = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ZMQSend(psZMQ, "{ \"code\":501, \"msg\"=\"Unknow method\" }", 38);
|
||||
}
|
||||
if(psZMQBuf) ZMQBufDestroy(psZMQBuf); psZMQBuf = NULL;
|
||||
|
||||
}
|
||||
|
||||
ZMQDestroy(psZMQ);
|
||||
|
||||
AWSMCallDestroy();
|
||||
|
||||
return 0;
|
||||
}
|
23
AWSMServer/CMakeLists.txt
Normal file
23
AWSMServer/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(AWSMServer LANGUAGES C)
|
||||
|
||||
aux_source_directory(${PROJECT_SOURCE_DIR}/src src_list)
|
||||
aux_source_directory(${PROJECT_SOURCE_DIR}/src/sm2sm3_enc src_list)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${src_list} ${PROJECT_SOURCE_DIR}/AWSMServer.c)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PRIVATE ${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
target_link_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/lib)
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
PUBLIC pthread
|
||||
m
|
||||
server-sm
|
||||
stdc++
|
||||
VSConfig
|
||||
VSClock
|
||||
ZMQLayout
|
||||
AWSMProtobuf)
|
231
AWSMServer/include/AWSKF.h
Executable file
231
AWSMServer/include/AWSKF.h
Executable file
@ -0,0 +1,231 @@
|
||||
/**
|
||||
* 芯片库接口封装
|
||||
*
|
||||
* 芯片实现功能包括,生成随机数、sm1对称加密算法、sm2签名加密算法、sm3杂凑算法、sm4对称加密算法、安全文件存储
|
||||
*
|
||||
* @author void_sora
|
||||
* @date 2021/02/20
|
||||
* @version 0.9
|
||||
*/
|
||||
#ifndef __AWSKF_H__
|
||||
#define __AWSKF_H__
|
||||
|
||||
// PIN<49>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define ADMIN_TYPE 0
|
||||
#define USER_TYPE 1
|
||||
|
||||
#define ECCPRIVATEKEYBITLENGTH 256
|
||||
#define ECCPRIVATEKEYLENGTH 32
|
||||
|
||||
//<2F>㷨<EFBFBD><E3B7A8>־
|
||||
// SM1
|
||||
#define SGD_SM1_ECB 0x00000101
|
||||
#define SGD_SM1_CBC 0x00000102
|
||||
#define SGD_SM1_CFB 0x00000104
|
||||
#define SGD_SM1_OFB 0x00000108
|
||||
#define SGD_SM1_MAC 0x00000110
|
||||
// SM4
|
||||
#define SGD_SMS4_ECB 0x00000401
|
||||
#define SGD_SMS4_CBC 0x00000402
|
||||
#define SGD_SMS4_CFB 0x00000404
|
||||
#define SGD_SMS4_OFB 0x00000408
|
||||
// AES
|
||||
#define SGD_AES128_ECB 0x00000801
|
||||
#define SGD_AES128_CBC 0x00000802
|
||||
#define SGD_AES128_CFB 0x00000804
|
||||
#define SGD_AES128_OFB 0x00000808
|
||||
|
||||
#define SGD_AES192_ECB 0x00000811
|
||||
#define SGD_AES192_CBC 0x00000812
|
||||
#define SGD_AES192_CFB 0x00000814
|
||||
#define SGD_AES192_OFB 0x00000818
|
||||
|
||||
#define SGD_AES256_ECB 0x00000821
|
||||
#define SGD_AES256_CBC 0x00000822
|
||||
#define SGD_AES256_CFB 0x00000824
|
||||
#define SGD_AES256_OFB 0x00000828
|
||||
// DES
|
||||
#define SGD_DES_ECB 0x00001001
|
||||
#define SGD_DES_CBC 0x00001002
|
||||
#define SGD_DES_CFB 0x00001004
|
||||
#define SGD_DES_OFB 0x00001008
|
||||
// 3DES_2KEY
|
||||
#define SGD_D3DES_ECB 0x00001011
|
||||
#define SGD_D3DES_CBC 0x00001012
|
||||
#define SGD_D3DES_CFB 0x00001014
|
||||
#define SGD_D3DES_OFB 0x00001018
|
||||
// 3DES_3KEY
|
||||
#define SGD_T3DES_ECB 0x00001021
|
||||
#define SGD_T3DES_CBC 0x00001022
|
||||
#define SGD_T3DES_CFB 0x00001024
|
||||
#define SGD_T3DES_OFB 0x00001028
|
||||
|
||||
//<2F>ǶԳ<C7B6>
|
||||
#define SGD_RSA 0x00010000
|
||||
#define SGD_SM2_1 0x00020100 // <20><>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD>㷨
|
||||
#define SGD_SM2_2 0x00020200 // <20><>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD>Э<EFBFBD><D0AD>
|
||||
#define SGD_SM2_3 0x00020400 // <20><>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD>㷨
|
||||
|
||||
//<2F>Ӵ<EFBFBD><D3B4>㷨<EFBFBD><E3B7A8>־
|
||||
#define SGD_SM3 0x00000001
|
||||
#define SGD_SHA1 0x00000002
|
||||
#define SGD_SHA256 0x00000004
|
||||
|
||||
|
||||
#define SKF_USE_ENCDEC 0x01 //<2F><><EFBFBD>ڼ<EFBFBD><DABC>ܽ<EFBFBD><DCBD><EFBFBD>
|
||||
#define SKF_USE_SIGVER 0x02 //<2F><><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>֤
|
||||
|
||||
|
||||
/**
|
||||
* @enum 对称加密算法模式
|
||||
*/
|
||||
enum PerformanceAlgMode
|
||||
{
|
||||
P_AlG_ECB,
|
||||
P_AlG_CBC,
|
||||
P_AlG_CFB,
|
||||
P_AlG_OFB
|
||||
};
|
||||
|
||||
enum EccKeyPairType
|
||||
{
|
||||
CryptKey,
|
||||
SignatureKey
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct AWSKF隐式结构。
|
||||
*/
|
||||
typedef struct AWSKF_S AWSKF_s, *pAWSKF_s;
|
||||
|
||||
/**
|
||||
* @struct AWSKF方法结结构体
|
||||
*/
|
||||
typedef struct AWSKF_F
|
||||
{
|
||||
pAWSKF_s (*Malloc)();
|
||||
|
||||
void (*Free)(pAWSKF_s spAWSKF);
|
||||
|
||||
int (*ChangeDeviceAuthKey)(pAWSKF_s spAWSKF, unsigned char *OldAuthKey, unsigned char *NewAuthKey);
|
||||
|
||||
int (*Create)(pAWSKF_s spAWSKF, unsigned char *DeviceAuthKey, unsigned char *AdminPIN, unsigned char *PIN, unsigned int ContainerCount);
|
||||
|
||||
int (*Open)(pAWSKF_s spAWSKF, unsigned char *PIN);
|
||||
|
||||
int (*Close)(pAWSKF_s spAWSKF);
|
||||
|
||||
int (*Destroy)(unsigned char *DeviceAuthKey);
|
||||
|
||||
int (*GetContainerCount)(pAWSKF_s spAWSKF);
|
||||
|
||||
int (*ChangePIN)(pAWSKF_s spAWSKF, unsigned char *OldPIN, unsigned char *NewPIN);
|
||||
|
||||
int (*UnlockPIN)(pAWSKF_s spAWSKF);
|
||||
|
||||
|
||||
int (*GenerateRandom)(pAWSKF_s spAWSKF, unsigned char *Random, unsigned int RandomLen);
|
||||
|
||||
int (*GenerateHashInit)(pAWSKF_s spAWSKF, unsigned char *Publickey);
|
||||
|
||||
int (*GenerateHashUpdate)(pAWSKF_s spAWSKF, unsigned char *SourceData, unsigned int SourceDataLen);
|
||||
|
||||
int (*GenerateHashFinal)(pAWSKF_s spAWSKF, unsigned char *Hash, unsigned int *HashLen);
|
||||
|
||||
int (*GenerateHash)(pAWSKF_s spAWSKF, unsigned char *SourceData, unsigned int SourceDataLen, unsigned char *Hash, unsigned int *HashLen, unsigned char *Publickey);
|
||||
|
||||
int (*GetHwcode)(pAWSKF_s spAWSKF, unsigned char *HwCode, unsigned int *HwCodeLen);
|
||||
|
||||
int (*GetDevInfo)(pAWSKF_s spAWSKF, unsigned char *DevInfo, unsigned int *DevInfoLen);
|
||||
|
||||
int (*FreeData)(unsigned char *Data);
|
||||
|
||||
|
||||
|
||||
int (*FileInit)(pAWSKF_s spAWSKF, char *FileName, unsigned int FileSize);
|
||||
|
||||
int (*GetFileNameList)(pAWSKF_s spAWSKF, char *FileList, unsigned int *FileListSize);
|
||||
|
||||
int (*FileWrite)(pAWSKF_s spAWSKF, char *FileName, unsigned int Offset, unsigned char *Data, unsigned int DataLen);
|
||||
|
||||
int (*FileRead)(pAWSKF_s spAWSKF, unsigned char *FileName, unsigned int Offset, unsigned char *Data, unsigned int *DataLen);
|
||||
|
||||
int (*FileDestroy)(pAWSKF_s spAWSKF, unsigned char *FileName);
|
||||
|
||||
|
||||
|
||||
int (*GenerateEccKeyPair)(pAWSKF_s spAWSKF, unsigned char *Prikey, unsigned char *Pubkey);
|
||||
|
||||
int (*ResetContainerEccKeyPair)(pAWSKF_s spAWSKF, unsigned int ContainerNumber);
|
||||
|
||||
int (*ImportPlaintextContainerECCKeyPair)(
|
||||
pAWSKF_s spAWSKF, unsigned int ContainerNumber, unsigned int KeyPairtype,
|
||||
unsigned char *Prikey, unsigned char *Pubkey);
|
||||
|
||||
int (*ImportContainerECCKeyPair)(
|
||||
pAWSKF_s spAWSKF, unsigned int ContainerNumber,
|
||||
unsigned char *KeyPairCiphertext, unsigned int KeyPairCiphertextLen);
|
||||
|
||||
int (*ExportContainerPubkey)(pAWSKF_s spAWSKF, unsigned int ContainerNumber, unsigned int KeyPairtype, unsigned char *Pubkey);
|
||||
|
||||
|
||||
|
||||
int (*GenerateSignatureExt)(
|
||||
pAWSKF_s spAWSKF, unsigned char *Prikey,
|
||||
unsigned char *Data, unsigned int DataLen, unsigned char *Signature, unsigned int *SignatureLen);
|
||||
|
||||
int (*GenerateSignatureInt)(
|
||||
pAWSKF_s spAWSKF, unsigned int ContainerNumber,
|
||||
unsigned char *Data, unsigned int DataLen, unsigned char *Signature, unsigned int *SignatureLen);
|
||||
|
||||
int (*VerifySignatureExt)(
|
||||
pAWSKF_s spAWSKF, unsigned char *Pubkey,
|
||||
unsigned char *Data, unsigned int DataLen, unsigned char *Signature, unsigned int SignatureLen);
|
||||
|
||||
int (*VerifySignatureInt)(
|
||||
pAWSKF_s spAWSKF, unsigned int ContainerNumber,
|
||||
unsigned char *Data, unsigned int DataLen, unsigned char *Signature, unsigned int SignatureLen);
|
||||
|
||||
|
||||
|
||||
int (*SM2EncryptExt)(
|
||||
pAWSKF_s spAWSKF, unsigned char *Pubkey,
|
||||
unsigned char *Data, unsigned int DataLen, unsigned char *Ciphertext, unsigned int *CiphertextLen);
|
||||
|
||||
int (*SM2EncryptInt)(
|
||||
pAWSKF_s spAWSKF, unsigned int ContainerNumber, unsigned int KeyPairtype,
|
||||
unsigned char *Data, unsigned int DataLen, unsigned char *Ciphertext, unsigned int *CiphertextLen);
|
||||
|
||||
int (*SM2DecryptExt)(
|
||||
pAWSKF_s spAWSKF, unsigned char *PriKey,
|
||||
unsigned char *Ciphertext, unsigned int CiphertextLen, unsigned char *Data, unsigned int *DataLen);
|
||||
|
||||
int (*SM2DecryptInt)(
|
||||
pAWSKF_s spAWSKF, unsigned int ContainerNumber, unsigned int KeyPairtype,
|
||||
unsigned char *Ciphertext, unsigned int CiphertextLen, unsigned char *Data, unsigned int *DataLen);
|
||||
|
||||
|
||||
|
||||
int (*SM1Encrypt)(
|
||||
pAWSKF_s spAWSKF, int AlgMode, unsigned char *pIv, unsigned char *Key,
|
||||
unsigned char *Data, unsigned int DataLen, unsigned char *Ciphertext, unsigned int *CiphertextLen);
|
||||
|
||||
int (*SM1Decrypt)(
|
||||
pAWSKF_s spAWSKF, int AlgMode, unsigned char *pIv, unsigned char *Key,
|
||||
unsigned char *Ciphertext, unsigned int CiphertextLen, unsigned char *Data, unsigned int *DataLen);
|
||||
|
||||
int (*SM4Encrypt)(
|
||||
pAWSKF_s spAWSKF, int AlgMode, unsigned char *pIv, unsigned char *Key,
|
||||
unsigned char *Data, unsigned int DataLen, unsigned char *Ciphertext, unsigned int *CiphertextLen);
|
||||
|
||||
int (*SM4Decrypt)(
|
||||
pAWSKF_s spAWSKF, int AlgMode, unsigned char *pIv, unsigned char *Key,
|
||||
unsigned char *Ciphertext, unsigned int CiphertextLen, unsigned char *Data, unsigned int *DataLen);
|
||||
|
||||
}AWSKF_f, *pAWSKF_f;
|
||||
|
||||
pAWSKF_f AWSKFFunInit();
|
||||
|
||||
void AWSKFFunDestroy(pAWSKF_f fpAWSKF);
|
||||
|
||||
#endif
|
81
AWSMServer/include/AWSMCall.h
Normal file
81
AWSMServer/include/AWSMCall.h
Normal file
@ -0,0 +1,81 @@
|
||||
#ifndef __AWSMCALL_H__
|
||||
#define __AWSMCALL_H__
|
||||
|
||||
#include "AWSM.pb-c.h"
|
||||
|
||||
typedef struct AWSMProtobuf_S {
|
||||
char *pcBuf;
|
||||
int iBufLen;
|
||||
} AWSMProtobuf_s, *pAWSMProtobuf_s;
|
||||
|
||||
void AWSMProtobufDestroy(pAWSMProtobuf_s);
|
||||
|
||||
int AWSMCallInit();
|
||||
|
||||
void AWSMCallDestroy();
|
||||
|
||||
pAWSMProtobuf_s CallInit(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallDestroy(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallHashInit(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
pAWSMProtobuf_s CallHashUpdate(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
pAWSMProtobuf_s CallHashFinal(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallHash(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallRand(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallSignatureByIntPrikey(const char *pcProtoBuf,
|
||||
const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallSignatureByExtPrikey(const char *pcProtoBuf,
|
||||
const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallVerifySignature(const char *pcProtoBuf,
|
||||
const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallSM2EncryptByExtPubKey(const char *pcProtoBuf,
|
||||
const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallSM2DecryptByExtPrikey(const char *pcProtoBuf,
|
||||
const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallSM2DecryptByIntPrikey(const char *pcProtoBuf,
|
||||
const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallSM2DecryptByIntCryptPrikey(const char *pcProtoBuf,
|
||||
const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallSM1Encrypt(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallSM1Decrypt(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallSM4Encrypt(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallSM4Decrypt(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallGenerateECCKeyPair(const char *pcProtoBuf,
|
||||
const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallExportPubkey(const char *pcProtoBuf,
|
||||
const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallImportKeyPair(const char *pcProtoBuf,
|
||||
const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallImportCertificate(const char *pcProtoBuf,
|
||||
const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallExportCertificate(const char *pcProtoBuf,
|
||||
const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallImportFile(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallExportFile(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallGetHwcode(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
pAWSMProtobuf_s CallGetDevInfo(const char *pcProtoBuf, const int iProtoBufLen);
|
||||
|
||||
#endif
|
1481
AWSMServer/src/AWSMCall.c
Normal file
1481
AWSMServer/src/AWSMCall.c
Normal file
File diff suppressed because it is too large
Load Diff
278
AWSMServer/src/map.c
Normal file
278
AWSMServer/src/map.c
Normal file
@ -0,0 +1,278 @@
|
||||
#include "map.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
struct cell {
|
||||
struct cell *next;
|
||||
void *value;
|
||||
char key[];
|
||||
} cell;
|
||||
|
||||
struct map {
|
||||
struct cell **elems;
|
||||
int capacity;
|
||||
int size;
|
||||
};
|
||||
|
||||
// Internal helper functions. Implemented at the bottom of this file.
|
||||
static unsigned int hash(const char *key);
|
||||
static void extend_if_necessary(map m);
|
||||
|
||||
/**
|
||||
* Create a new, empty map.
|
||||
*
|
||||
* The returned map has dynamically allocated memory associated with it, and
|
||||
* this memory must be reclaimed after use with `map_destroy`.
|
||||
*/
|
||||
map map_create() {
|
||||
|
||||
// Allocate space for the map's primary data structure. More space will be
|
||||
// allocated in the future when values are added to the map.
|
||||
map m = malloc(sizeof(map));
|
||||
assert(m != NULL);
|
||||
m->elems = calloc(1, sizeof(struct cell *));
|
||||
assert(m->elems != NULL);
|
||||
|
||||
// Initialize metadata. The map starts with capacity for one entry.
|
||||
m->capacity = 1;
|
||||
m->size = 0;
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
/**
|
||||
* Free the memory used for a map after use.
|
||||
*
|
||||
* Note that this routine does not free any memory that was allocated for the
|
||||
* values stored in the map. That memory must be freed by the client as
|
||||
* appropriate.
|
||||
*/
|
||||
void map_destroy(map m) {
|
||||
|
||||
// Loop over each cell in the map and free it.
|
||||
for (int i = 0; i < m->capacity; i += 1) {
|
||||
struct cell *curr = m->elems[i];
|
||||
while (curr != NULL) {
|
||||
struct cell *next = curr->next;
|
||||
free(curr);
|
||||
curr = next;
|
||||
}
|
||||
}
|
||||
|
||||
free(m->elems);
|
||||
free(m);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of a map.
|
||||
*/
|
||||
int map_size(const map m) { return m->size; }
|
||||
|
||||
/**
|
||||
* Determine whether a map contains a given key.
|
||||
*
|
||||
* Keys are case-sensitive.
|
||||
*/
|
||||
bool map_contains(const map m, const char *key) {
|
||||
int b = hash(key) % m->capacity;
|
||||
|
||||
// Search linearly for a matching key through the appropriate linked list.
|
||||
for (struct cell *curr = m->elems[b]; curr != NULL; curr = curr->next) {
|
||||
if (strcmp(curr->key, key) == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool map_contains_by_uint64(const map m, uint64_t key) {
|
||||
char buf[20];
|
||||
sprintf(buf, "%lu", key);
|
||||
return map_contains(m, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for a given key within a map.
|
||||
*
|
||||
* This will add a new key if it does not exist. If the key already exists, the
|
||||
* new value will replace the old one.
|
||||
*/
|
||||
void map_set(map m, const char *key, void *value) {
|
||||
int b = hash(key) % m->capacity;
|
||||
|
||||
// First, look for an existing entry with the given key in the map. If it
|
||||
// exists, simply update its value.
|
||||
for (struct cell *curr = m->elems[b]; curr != NULL; curr = curr->next) {
|
||||
if (strcmp(curr->key, key) == 0) {
|
||||
curr->value = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
extend_if_necessary(m);
|
||||
b = hash(key) % m->capacity;
|
||||
|
||||
// No existing key was found, so insert it as a new entry at the head of the
|
||||
// list.
|
||||
struct cell *new = malloc(sizeof(struct cell) + strlen(key) + 1);
|
||||
new->next = m->elems[b];
|
||||
new->value = value;
|
||||
strcpy(new->key, key);
|
||||
m->elems[b] = new;
|
||||
m->size += 1;
|
||||
}
|
||||
void map_set_by_uint64(map m, uint64_t key, void *value) {
|
||||
char buf[20];
|
||||
sprintf(buf, "%lu", key);
|
||||
map_set(m, buf, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the value for a given key in a map.
|
||||
*
|
||||
* Crashes if the map does not contain the given key.
|
||||
*/
|
||||
void *map_get(const map m, const char *key) {
|
||||
int b = hash(key) % m->capacity;
|
||||
|
||||
// Search linearly for a matching key through the appropriate linked list.
|
||||
for (struct cell *curr = m->elems[b]; curr != NULL; curr = curr->next) {
|
||||
if (strcmp(curr->key, key) == 0)
|
||||
return curr->value;
|
||||
}
|
||||
|
||||
// Key not found.
|
||||
bool key_found = false;
|
||||
assert(key_found);
|
||||
exit(1);
|
||||
}
|
||||
void *map_get_by_uint64(const map m, uint64_t key) {
|
||||
char buf[20];
|
||||
sprintf(buf, "%lu", key);
|
||||
return map_get(m, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a key and its value from a map.
|
||||
*
|
||||
* Crashes if the map does not already contain the key.
|
||||
*/
|
||||
void *map_remove(map m, const char *key) {
|
||||
int b = hash(key) % m->capacity;
|
||||
|
||||
// Here, use a double pointer to make removal easier.
|
||||
struct cell **curr;
|
||||
for (curr = &m->elems[b]; *curr != NULL; curr = &(*curr)->next) {
|
||||
if (strcmp((*curr)->key, key) == 0) {
|
||||
|
||||
// Bridge the linked list accross the removed element.
|
||||
struct cell *found = *curr;
|
||||
*curr = (*curr)->next;
|
||||
|
||||
void *value = found->value;
|
||||
free(found);
|
||||
m->size -= 1;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
// Key not found.
|
||||
bool key_found = false;
|
||||
assert(key_found);
|
||||
exit(1);
|
||||
}
|
||||
void *map_remove_by_uint64(map m, uint64_t key) {
|
||||
char buf[20];
|
||||
sprintf(buf, "%lu", key);
|
||||
return map_remove(m, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "first" key (arbitrarily ordered) in a map. If the map is empty,
|
||||
* returns NULL.
|
||||
*/
|
||||
const char *map_first(map m) {
|
||||
|
||||
// Find and return the first cell in the first non-empty bucket.
|
||||
for (int i = 0; i < m->capacity; i += 1) {
|
||||
if (m->elems[i] != NULL) {
|
||||
return m->elems[i]->key;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next key after a given key within a map.
|
||||
*
|
||||
* Used for iteration. Returns NULL if there are no more keys. Note that the
|
||||
* provided `key` must have been returned from a previous call to `map_first`
|
||||
* or `map_next`. Passing other strings produces undefined behavior.
|
||||
*/
|
||||
const char *map_next(map m, const char *key) {
|
||||
|
||||
// First, get a reference to the current cell and check its successor.
|
||||
struct cell *curr = (void *)(key - sizeof(struct cell));
|
||||
if (curr->next != NULL) {
|
||||
return curr->next->key;
|
||||
}
|
||||
|
||||
// If no immediate successor exists, begin searching the rest of the buckets.
|
||||
int b = hash(key) % m->capacity;
|
||||
for (int i = b + 1; i < m->capacity; i += 1) {
|
||||
if (m->elems[i] != NULL) {
|
||||
return m->elems[i]->key;
|
||||
}
|
||||
}
|
||||
|
||||
// No more keys.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal helper; hash a string key.
|
||||
*/
|
||||
static unsigned int hash(const char *key) {
|
||||
unsigned int hash = -1;
|
||||
while (*key) {
|
||||
hash *= 31;
|
||||
hash ^= (unsigned char)*key;
|
||||
key += 1;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
/*
|
||||
* Grow the capacity of the hash map by a factor of two, only when the map's
|
||||
* load becomes greater than one.
|
||||
*/
|
||||
static void extend_if_necessary(map m) {
|
||||
if (m->size == m->capacity) {
|
||||
|
||||
// Save old values first, since all map entries will need to be copied over.
|
||||
int capacity = m->capacity;
|
||||
struct cell **elems = m->elems;
|
||||
|
||||
// Doubling the capacity when necessary allows for an amortized constant
|
||||
// runtime for extension.
|
||||
m->capacity *= 2;
|
||||
m->elems = calloc(m->capacity, sizeof(struct cell *));
|
||||
|
||||
for (int i = 0; i < capacity; i += 1) {
|
||||
struct cell *curr = elems[i];
|
||||
while (curr != NULL) {
|
||||
struct cell *next = curr->next;
|
||||
|
||||
// Move the entry from the old data structure to the new.
|
||||
int b = hash(curr->key) % m->capacity;
|
||||
curr->next = m->elems[b];
|
||||
m->elems[b] = curr;
|
||||
|
||||
curr = next;
|
||||
}
|
||||
}
|
||||
|
||||
free(elems);
|
||||
}
|
||||
}
|
89
AWSMServer/src/map.h
Normal file
89
AWSMServer/src/map.h
Normal file
@ -0,0 +1,89 @@
|
||||
#ifndef __MAP_H
|
||||
#define __MAP_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Hash map implementation for C.
|
||||
*
|
||||
* This hash map uses strings as keys, and allows association of any arbitrary
|
||||
* value type through the use of `void *` pointers. Additionally, this
|
||||
* implementation leaves memory management of stored values to the client (for
|
||||
* example, destroying a map using `map_destroy` will free the memory for the
|
||||
* map itself, but it will not free memory that was used to store its values).
|
||||
*/
|
||||
typedef struct map *map;
|
||||
|
||||
/**
|
||||
* Create a new, empty map.
|
||||
*
|
||||
* The returned map has dynamically allocated memory associated with it, and
|
||||
* this memory must be reclaimed after use with `map_destroy`.
|
||||
*/
|
||||
map map_create();
|
||||
|
||||
/**
|
||||
* Free the memory used for a map after use.
|
||||
*
|
||||
* Note that this routine does not free any memory that was allocated for the
|
||||
* values stored in the map. That memory must be freed by the client as
|
||||
* appropriate.
|
||||
*/
|
||||
void map_destroy(map m);
|
||||
|
||||
/**
|
||||
* Get the size of a map.
|
||||
*/
|
||||
int map_size(const map m);
|
||||
|
||||
/**
|
||||
* Determine whether a map contains a given key.
|
||||
*
|
||||
* Keys are case-sensitive.
|
||||
*/
|
||||
bool map_contains(const map m, const char *key);
|
||||
bool map_contains_by_uint64(const map m, uint64_t key);
|
||||
|
||||
/**
|
||||
* Set the value for a given key within a map.
|
||||
*
|
||||
* This will add a new key if it does not exist. If the key already exists, the
|
||||
* new value will replace the old one.
|
||||
*/
|
||||
void map_set(map m, const char *key, void *value);
|
||||
void map_set_by_uint64(map m, uint64_t key, void *value);
|
||||
|
||||
/**
|
||||
* Retrieve the value for a given key in a map.
|
||||
*
|
||||
* Crashes if the map does not contain the given key.
|
||||
*/
|
||||
void *map_get(const map m, const char *key);
|
||||
void *map_get_by_uint64(const map m, uint64_t key);
|
||||
|
||||
/**
|
||||
* Remove a key and return its value from a map.
|
||||
*
|
||||
* Crashes if the map does not already contain the key.
|
||||
*/
|
||||
void *map_remove(map m, const char *key);
|
||||
void *map_remove_by_uint64(map m, uint64_t key);
|
||||
|
||||
/**
|
||||
* Iterate over a map's keys.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* for (char *key = map_first(m); key != NULL; key = map_next(m, key)) {
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* Note that the `key` passed to `map_next` must have come from a previous call
|
||||
* to `map_first` or `map_next`. Passing strings from other sources produces
|
||||
* undefined behavior.
|
||||
*/
|
||||
const char *map_first(map m);
|
||||
const char *map_next(map m, const char *key);
|
||||
|
||||
#endif
|
829
AWSMServer/src/sm2sm3_enc/big.c
Normal file
829
AWSMServer/src/sm2sm3_enc/big.c
Normal file
@ -0,0 +1,829 @@
|
||||
#include "typedef.h"
|
||||
#include "big.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u64 m_low;
|
||||
u64 m_high;
|
||||
} uint128_t;
|
||||
|
||||
void vli_clear(u64 *vli, u8 ndigits)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ndigits; ++i) {
|
||||
vli[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns true if vli == 0, false otherwise. */
|
||||
int vli_is_zero(u64 *vli, u8 ndigits)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ndigits; ++i) {
|
||||
if (vli[i])
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Returns nonzero if bit bit of vli is set. */
|
||||
u64 vli_test_bit(u64 *vli, u8 bit, u8 ndigits)
|
||||
{
|
||||
return (vli[bit/64] & ((u64)1 << (bit % 64)));
|
||||
}
|
||||
|
||||
/* Counts the number of 64-bit "digits" in vli. */
|
||||
u32 vli_num_digits(u64 *vli, u8 ndigits)
|
||||
{
|
||||
int i;
|
||||
/* Search from the end until we find a non-zero digit.
|
||||
* We do it in reverse because we expect that most digits will
|
||||
* be nonzero.
|
||||
*/
|
||||
for (i = ndigits - 1; i >= 0 && vli[i] == 0; --i);
|
||||
|
||||
return (i + 1);
|
||||
}
|
||||
|
||||
/* Counts the number of bits required for vli. */
|
||||
u32 vli_num_bits(u64 *vli, u8 ndigits)
|
||||
{
|
||||
u32 i, num_digits;
|
||||
u64 digit;
|
||||
|
||||
num_digits = vli_num_digits(vli, ndigits);
|
||||
if (num_digits == 0)
|
||||
return 0;
|
||||
|
||||
digit = vli[num_digits - 1];
|
||||
for (i = 0; digit; ++i)
|
||||
digit >>= 1;
|
||||
|
||||
return ((num_digits - 1) * 64 + i);
|
||||
}
|
||||
|
||||
/* Sets dest = src. */
|
||||
void vli_set(u64 *dest, u64 *src, u8 ndigits)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < ndigits; ++i)
|
||||
dest[i] = src[i];
|
||||
}
|
||||
|
||||
/* Returns sign of left - right. */
|
||||
int vli_cmp(u64 *left, u64 *right, u8 ndigits)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = ndigits - 1; i >= 0; --i) {
|
||||
if (left[i] > right[i])
|
||||
return 1;
|
||||
else if (left[i] < right[i])
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Computes result = in << c, returning carry. Can modify in place
|
||||
* (if result == in). 0 < shift < 64.
|
||||
*/
|
||||
u64 vli_lshift(u64 *result, u64 *in, u32 shift, u8 ndigits)
|
||||
{
|
||||
u64 carry = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ndigits; ++i) {
|
||||
u64 temp = in[i];
|
||||
result[i] = (temp << shift) | carry;
|
||||
carry = shift ? temp >> (64 - shift) : 0;
|
||||
}
|
||||
|
||||
return carry;
|
||||
}
|
||||
|
||||
/* Computes result = in >> c, returning carry. Can modify in place
|
||||
* (if result == in). 0 < shift < 64.
|
||||
*/
|
||||
u64 vli_rshift(u64 *result, u64 *in, u32 shift, u8 ndigits)
|
||||
{
|
||||
u64 carry = 0;
|
||||
int i;
|
||||
|
||||
for (i = ndigits -1; i >= 0; --i) {
|
||||
u64 temp = in[i];
|
||||
result[i] = (temp >> shift) | carry;
|
||||
carry = shift ? temp << (64 - shift) : 0;
|
||||
}
|
||||
|
||||
return carry;
|
||||
}
|
||||
|
||||
/* Computes result = left + right, returning carry. Can modify in place. */
|
||||
u64 vli_add(u64 *result, u64 *left, u64 *right, u8 ndigits)
|
||||
{
|
||||
u64 carry = 0;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < ndigits; ++i) {
|
||||
u64 sum;
|
||||
|
||||
sum = left[i] + right[i] + carry;
|
||||
if (sum != left[i]) {
|
||||
carry = (sum < left[i]);
|
||||
}
|
||||
result[i] = sum;
|
||||
}
|
||||
|
||||
return carry;
|
||||
}
|
||||
|
||||
/* Computes result = left - right, returning borrow. Can modify in place. */
|
||||
u64 vli_sub(u64 *result, u64 *left, u64 *right, u8 ndigits)
|
||||
{
|
||||
u64 borrow = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ndigits; ++i) {
|
||||
u64 diff;
|
||||
|
||||
diff = left[i] - right[i] - borrow;
|
||||
if (diff != left[i])
|
||||
borrow = (diff > left[i]);
|
||||
|
||||
result[i] = diff;
|
||||
}
|
||||
|
||||
return borrow;
|
||||
}
|
||||
|
||||
static uint128_t mul_64_64(u64 left, u64 right)
|
||||
{
|
||||
u64 a0 = left & 0xffffffffull;
|
||||
u64 a1 = left >> 32;
|
||||
u64 b0 = right & 0xffffffffull;
|
||||
u64 b1 = right >> 32;
|
||||
u64 m0 = a0 * b0;
|
||||
u64 m1 = a0 * b1;
|
||||
u64 m2 = a1 * b0;
|
||||
u64 m3 = a1 * b1;
|
||||
uint128_t result;
|
||||
|
||||
m2 += (m0 >> 32);
|
||||
m2 += m1;
|
||||
|
||||
/* Overflow */
|
||||
if (m2 < m1)
|
||||
m3 += 0x100000000ull;
|
||||
|
||||
result.m_low = (m0 & 0xffffffffull) | (m2 << 32);
|
||||
result.m_high = m3 + (m2 >> 32);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static uint128_t add_128_128(uint128_t a, uint128_t b)
|
||||
{
|
||||
uint128_t result;
|
||||
|
||||
result.m_low = a.m_low + b.m_low;
|
||||
result.m_high = a.m_high + b.m_high + (result.m_low < a.m_low);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static u64 vli_add_digit_mul(u64 *result, u64 *b, u64 c, u64 *d, u8 digits)
|
||||
{
|
||||
uint128_t mul;
|
||||
u64 carry;
|
||||
u32 i;
|
||||
|
||||
if (c == 0)
|
||||
return 0;
|
||||
|
||||
carry = 0;
|
||||
for (i = 0; i < digits; i++) {
|
||||
mul = mul_64_64(c, d[i]);
|
||||
if ((result[i] = b[i] + carry) < carry) {
|
||||
carry = 1;
|
||||
} else {
|
||||
carry = 0;
|
||||
}
|
||||
if ((result[i] += mul.m_low) < mul.m_low) {
|
||||
carry++;
|
||||
}
|
||||
carry += mul.m_high;
|
||||
}
|
||||
|
||||
return carry;
|
||||
}
|
||||
|
||||
void bn_mult(u64 *result, u64 *left, u64 *right, u8 ndigits)
|
||||
{
|
||||
u64 t[2*128];
|
||||
u32 bdigits, cdigits, i;
|
||||
|
||||
vli_clear(t, 2*ndigits);
|
||||
|
||||
bdigits = vli_num_digits(left, ndigits);
|
||||
cdigits = vli_num_digits(right, ndigits);
|
||||
|
||||
for(i=0; i<bdigits; i++) {
|
||||
t[i+cdigits] += vli_add_digit_mul(&t[i], &t[i], left[i], right, cdigits);
|
||||
}
|
||||
|
||||
vli_set(result, t, 2*ndigits);
|
||||
}
|
||||
|
||||
#define BN_DIGIT_BITS 32
|
||||
#define BN_MAX_DIGIT 0xFFFFFFFF
|
||||
static u32 vli_sub_digit_mult(u32 *a, u32 *b, u32 c, u32 *d, u32 digits)
|
||||
{
|
||||
u64 result;
|
||||
u32 borrow, rh, rl;
|
||||
u32 i;
|
||||
|
||||
if(c == 0)
|
||||
return 0;
|
||||
|
||||
borrow = 0;
|
||||
for(i=0; i<digits; i++) {
|
||||
result = (u64)c * d[i];
|
||||
rl = result & BN_MAX_DIGIT;
|
||||
rh = (result >> BN_DIGIT_BITS) & BN_MAX_DIGIT;
|
||||
if((a[i] = b[i] - borrow) > (BN_MAX_DIGIT - borrow)) {
|
||||
borrow = 1;
|
||||
} else {
|
||||
borrow = 0;
|
||||
}
|
||||
if((a[i] -= rl) > (BN_MAX_DIGIT - rl)) {
|
||||
borrow++;
|
||||
}
|
||||
borrow += rh;
|
||||
}
|
||||
|
||||
return borrow;
|
||||
}
|
||||
|
||||
static u32 bn_digit_bits(u32 a)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for(i = 0; i< sizeof(a) * 8; i++) {
|
||||
if(a == 0) break;
|
||||
a >>= 1;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void bn_div(u32 *a, u32 *b, u32 *c, u32 cdigits, u32 *d, u32 ddigits)
|
||||
{
|
||||
u32 ai, t, cc[128+1], dd[128/2];
|
||||
u32 dddigits, shift;
|
||||
u64 tmp;
|
||||
int i;
|
||||
|
||||
dddigits = ddigits;
|
||||
|
||||
shift = BN_DIGIT_BITS - bn_digit_bits(d[dddigits-1]);
|
||||
vli_clear((u64*)cc, dddigits/2);
|
||||
cc[cdigits] = vli_lshift((u64*)cc, (u64*)c, shift, cdigits/2);
|
||||
vli_lshift((u64*)dd, (u64*)d, shift, dddigits/2);
|
||||
t = dd[dddigits-1];
|
||||
|
||||
vli_clear((u64*)a, cdigits/2);
|
||||
i = cdigits - dddigits;
|
||||
for(; i>=0; i--) {
|
||||
if(t == BN_MAX_DIGIT) {
|
||||
ai = cc[i+dddigits];
|
||||
} else {
|
||||
tmp = cc[i+dddigits-1];
|
||||
tmp += (u64)cc[i+dddigits] << BN_DIGIT_BITS;
|
||||
ai = tmp / (t + 1);
|
||||
}
|
||||
|
||||
cc[i+dddigits] -= vli_sub_digit_mult(&cc[i], &cc[i], ai, dd, dddigits);
|
||||
while(cc[i+dddigits] || (vli_cmp((u64*)&cc[i], (u64*)dd, dddigits/2) >= 0)) {
|
||||
ai++;
|
||||
cc[i+dddigits] -= vli_sub((u64*)&cc[i], (u64*)&cc[i], (u64*)dd, dddigits/2);
|
||||
}
|
||||
a[i] = ai;
|
||||
}
|
||||
|
||||
vli_rshift((u64*)b, (u64*)cc, shift, dddigits/2);
|
||||
}
|
||||
|
||||
void vli_div(u64 *result, u64 *remainder, u64 *left, u64 cdigits, u64 *right, u8 ddigits)
|
||||
{
|
||||
bn_div((u32*)result, (u32*)remainder, (u32*)left, cdigits*2, (u32*)right, ddigits*2);
|
||||
}
|
||||
|
||||
void bn_mod(u64 *result, u64 *left, u64 *right, u8 ndigits)
|
||||
{
|
||||
u64 t[2*128];
|
||||
|
||||
vli_div(t, result, left, ndigits*2, right, ndigits);
|
||||
}
|
||||
|
||||
void _vli_mult(u64 *result, u64 *left, u64 *right, u8 ndigits)
|
||||
{
|
||||
uint128_t r01 = { 0, 0 };
|
||||
u64 r2 = 0;
|
||||
unsigned int i, k;
|
||||
|
||||
/* Compute each digit of result in sequence, maintaining the
|
||||
* carries.
|
||||
*/
|
||||
for (k = 0; k < ndigits * 2 - 1; k++) {
|
||||
unsigned int min;
|
||||
|
||||
if (k < ndigits)
|
||||
min = 0;
|
||||
else
|
||||
min = (k + 1) - ndigits;
|
||||
|
||||
for (i = min; i <= k && i < ndigits; i++) {
|
||||
uint128_t product;
|
||||
|
||||
product = mul_64_64(left[i], right[k - i]);
|
||||
|
||||
r01 = add_128_128(r01, product);
|
||||
r2 += (r01.m_high < product.m_high);
|
||||
}
|
||||
|
||||
result[k] = r01.m_low;
|
||||
r01.m_low = r01.m_high;
|
||||
r01.m_high = r2;
|
||||
r2 = 0;
|
||||
}
|
||||
|
||||
result[ndigits * 2 - 1] = r01.m_low;
|
||||
}
|
||||
|
||||
void vli_mult(u64 *result, u64 *left, u64 *right, u8 ndigits)
|
||||
{
|
||||
#if 1
|
||||
bn_mult(result, left, right, ndigits);
|
||||
#else
|
||||
_vli_mult(result, left, right, ndigits);
|
||||
#endif
|
||||
}
|
||||
|
||||
void vli_square(u64 *result, u64 *left, u8 ndigits)
|
||||
{
|
||||
uint128_t r01 = { 0, 0 };
|
||||
u64 r2 = 0;
|
||||
int i, k;
|
||||
|
||||
for (k = 0; k < ndigits * 2 - 1; k++) {
|
||||
unsigned int min;
|
||||
|
||||
if (k < ndigits)
|
||||
min = 0;
|
||||
else
|
||||
min = (k + 1) - ndigits;
|
||||
|
||||
for (i = min; i <= k && i <= k - i; i++) {
|
||||
uint128_t product;
|
||||
|
||||
product = mul_64_64(left[i], left[k - i]);
|
||||
|
||||
if (i < k - i) {
|
||||
r2 += product.m_high >> 63;
|
||||
product.m_high = (product.m_high << 1) |
|
||||
(product.m_low >> 63);
|
||||
product.m_low <<= 1;
|
||||
}
|
||||
|
||||
r01 = add_128_128(r01, product);
|
||||
r2 += (r01.m_high < product.m_high);
|
||||
}
|
||||
|
||||
result[k] = r01.m_low;
|
||||
r01.m_low = r01.m_high;
|
||||
r01.m_high = r2;
|
||||
r2 = 0;
|
||||
}
|
||||
|
||||
result[ndigits * 2 - 1] = r01.m_low;
|
||||
}
|
||||
|
||||
/* Computes result = (left + right) % mod.
|
||||
Assumes that left < mod and right < mod, result != mod. */
|
||||
void vli_mod_add(u64 *result, u64 *left, u64 *right, u64 *mod, u8 ndigits)
|
||||
{
|
||||
u64 carry;
|
||||
|
||||
carry = vli_add(result, left, right, ndigits);
|
||||
/* result > mod (result = mod + remainder), so subtract mod to
|
||||
* get remainder.
|
||||
*/
|
||||
|
||||
if(carry || vli_cmp(result, mod, ndigits) >= 0) {
|
||||
/* result > mod (result = mod + remainder), so subtract mod to get remainder. */
|
||||
vli_sub(result, result, mod, ndigits);
|
||||
}
|
||||
}
|
||||
|
||||
/* Computes result = (left - right) % mod.
|
||||
* Assumes that left < mod and right < mod, result != mod.
|
||||
*/
|
||||
void vli_mod_sub(u64 *result, u64 *left, u64 *right, u64 *mod, u8 ndigits)
|
||||
{
|
||||
u64 borrow;
|
||||
|
||||
borrow = vli_sub(result, left, right, ndigits);
|
||||
/* In this case, result == -diff == (max int) - diff.
|
||||
* Since -x % d == d - x, we can get the correct result from
|
||||
* result + mod (with overflow).
|
||||
*/
|
||||
if(borrow)
|
||||
vli_add(result, result, mod, ndigits);
|
||||
}
|
||||
|
||||
/* Computes result = product % curve_prime
|
||||
* from http://www.nsa.gov/ia/_files/nist-routines.pdf
|
||||
*/
|
||||
void vli_mmod_fast_nist_256(u64 *result, u64 *product, u64 *curve_prime, u8 ndigits)
|
||||
{
|
||||
u64 tmp[2 * 128];
|
||||
int carry;
|
||||
|
||||
/* t */
|
||||
vli_set(result, product, ndigits);
|
||||
|
||||
/* s1 */
|
||||
tmp[0] = 0;
|
||||
tmp[1] = product[5] & 0xffffffff00000000ull;
|
||||
tmp[2] = product[6];
|
||||
tmp[3] = product[7];
|
||||
carry = vli_lshift(tmp, tmp, 1, ndigits);
|
||||
carry += vli_add(result, result, tmp, ndigits);
|
||||
|
||||
/* s2 */
|
||||
tmp[1] = product[6] << 32;
|
||||
tmp[2] = (product[6] >> 32) | (product[7] << 32);
|
||||
tmp[3] = product[7] >> 32;
|
||||
carry += vli_lshift(tmp, tmp, 1, ndigits);
|
||||
carry += vli_add(result, result, tmp, ndigits);
|
||||
|
||||
/* s3 */
|
||||
tmp[0] = product[4];
|
||||
tmp[1] = product[5] & 0xffffffff;
|
||||
tmp[2] = 0;
|
||||
tmp[3] = product[7];
|
||||
carry += vli_add(result, result, tmp, ndigits);
|
||||
|
||||
/* s4 */
|
||||
tmp[0] = (product[4] >> 32) | (product[5] << 32);
|
||||
tmp[1] = (product[5] >> 32) | (product[6] & 0xffffffff00000000ull);
|
||||
tmp[2] = product[7];
|
||||
tmp[3] = (product[6] >> 32) | (product[4] << 32);
|
||||
carry += vli_add(result, result, tmp, ndigits);
|
||||
|
||||
/* d1 */
|
||||
tmp[0] = (product[5] >> 32) | (product[6] << 32);
|
||||
tmp[1] = (product[6] >> 32);
|
||||
tmp[2] = 0;
|
||||
tmp[3] = (product[4] & 0xffffffff) | (product[5] << 32);
|
||||
carry -= vli_sub(result, result, tmp, ndigits);
|
||||
|
||||
/* d2 */
|
||||
tmp[0] = product[6];
|
||||
tmp[1] = product[7];
|
||||
tmp[2] = 0;
|
||||
tmp[3] = (product[4] >> 32) | (product[5] & 0xffffffff00000000ull);
|
||||
carry -= vli_sub(result, result, tmp, ndigits);
|
||||
|
||||
/* d3 */
|
||||
tmp[0] = (product[6] >> 32) | (product[7] << 32);
|
||||
tmp[1] = (product[7] >> 32) | (product[4] << 32);
|
||||
tmp[2] = (product[4] >> 32) | (product[5] << 32);
|
||||
tmp[3] = (product[6] << 32);
|
||||
carry -= vli_sub(result, result, tmp, ndigits);
|
||||
|
||||
/* d4 */
|
||||
tmp[0] = product[7];
|
||||
tmp[1] = product[4] & 0xffffffff00000000ull;
|
||||
tmp[2] = product[5];
|
||||
tmp[3] = product[6] & 0xffffffff00000000ull;
|
||||
carry -= vli_sub(result, result, tmp, ndigits);
|
||||
|
||||
if (carry < 0) {
|
||||
do {
|
||||
carry += vli_add(result, result, curve_prime, ndigits);
|
||||
} while (carry < 0);
|
||||
} else {
|
||||
while (carry || vli_cmp(curve_prime, result, ndigits) != 1){
|
||||
carry -= vli_sub(result, result, curve_prime, ndigits);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vli_mmod_fast_sm2_256(u64 *result, u64 *_product, u64 *mod, u8 ndigits)
|
||||
{
|
||||
u32 tmp1[8];
|
||||
u32 tmp2[8];
|
||||
u32 tmp3[8];
|
||||
u32 *product = (u32 *)_product;
|
||||
int carry = 0;
|
||||
|
||||
vli_set(result, (u64 *)product, ndigits);
|
||||
vli_clear((u64 *)tmp1, ndigits);
|
||||
vli_clear((u64 *)tmp2, ndigits);
|
||||
vli_clear((u64 *)tmp3, ndigits);
|
||||
|
||||
/* Y0 */
|
||||
tmp1[0] = tmp1[3] = tmp1[7] = product[8];
|
||||
tmp2[2] = product[8];
|
||||
carry += vli_add(result, result, (u64 *)tmp1, ndigits);
|
||||
carry -= vli_sub(result, result, (u64 *)tmp2, ndigits);
|
||||
|
||||
/* Y1 */
|
||||
tmp1[0] = tmp1[1] = tmp1[4] = tmp1[7] = product[9];
|
||||
tmp1[3] = 0;
|
||||
tmp2[2] = product[9];
|
||||
carry += vli_add(result, result, (u64 *)tmp1, ndigits);
|
||||
carry -= vli_sub(result, result, (u64 *)tmp2, ndigits);
|
||||
|
||||
/* Y2 */
|
||||
tmp1[0] = tmp1[1] = tmp1[5] = tmp1[7] = product[10];
|
||||
tmp1[4] = 0;
|
||||
carry += vli_add(result, result, (u64 *)tmp1, ndigits);
|
||||
|
||||
/* Y3 */
|
||||
tmp1[0] = tmp1[1] = tmp1[3] = tmp1[6] = tmp1[7] = product[11];
|
||||
tmp1[5] = 0;
|
||||
carry += vli_add(result, result, (u64 *)tmp1, ndigits);
|
||||
|
||||
/* Y4 */
|
||||
tmp1[0] = tmp1[1] = tmp1[3] = tmp1[4] = tmp1[7] = tmp3[7] = product[12];
|
||||
tmp1[6] = 0;
|
||||
carry += vli_add(result, result, (u64 *)tmp1, ndigits);
|
||||
carry += vli_add(result, result, (u64 *)tmp3, ndigits);
|
||||
|
||||
/* Y5 */
|
||||
tmp1[0] = tmp1[1] = tmp1[3] = tmp1[4] = tmp1[5] = tmp1[7] = product[13];
|
||||
tmp2[2] = product[13];
|
||||
tmp3[0] = tmp3[3] = tmp3[7] = product[13];
|
||||
carry += vli_add(result, result, (u64 *)tmp1, ndigits);
|
||||
carry += vli_add(result, result, (u64 *)tmp3, ndigits);
|
||||
carry -= vli_sub(result, result, (u64 *)tmp2, ndigits);
|
||||
|
||||
/* Y6 */
|
||||
tmp1[0] = tmp1[1] = tmp1[3] = tmp1[4] = tmp1[5] = tmp1[6] = tmp1[7] = product[14];
|
||||
tmp2[2] = product[14];
|
||||
tmp3[0] = tmp3[1] = tmp3[4] = tmp3[7] = product[14];
|
||||
tmp3[3] = 0;
|
||||
carry += vli_add(result, result, (u64 *)tmp1, ndigits);
|
||||
carry += vli_add(result, result, (u64 *)tmp3, ndigits);
|
||||
carry -= vli_sub(result, result, (u64 *)tmp2, ndigits);
|
||||
|
||||
/* Y7 */
|
||||
tmp1[0] = tmp1[1] = tmp1[3] = tmp1[4] = tmp1[5] = tmp1[6] = tmp1[7] = product[15];
|
||||
tmp3[0] = tmp3[1] = tmp3[5] = product[15];
|
||||
tmp3[4] = 0;
|
||||
tmp3[7] = 0;
|
||||
tmp2[7] = product[15];
|
||||
tmp2[2] = 0;
|
||||
carry += vli_lshift((u64 *)tmp2, (u64 *)tmp2, 1, ndigits);
|
||||
carry += vli_add(result, result, (u64 *)tmp1, ndigits);
|
||||
carry += vli_add(result, result, (u64 *)tmp3, ndigits);
|
||||
carry += vli_add(result, result, (u64 *)tmp2, ndigits);
|
||||
if (carry < 0) {
|
||||
do {
|
||||
carry += vli_add(result, result, mod, ndigits);
|
||||
} while(carry < 0);
|
||||
} else {
|
||||
while (carry || vli_cmp(mod, result, ndigits) != 1)
|
||||
{
|
||||
carry -= vli_sub(result, result, mod, ndigits);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Computes result = (product) % mod. */
|
||||
void _vli_mod(u64 *result, u64 *product, u64 *mod, u8 ndigits)
|
||||
{
|
||||
u64 modMultiple[2 * 128];
|
||||
u32 digitShift, bitShift;
|
||||
u32 productBits;
|
||||
u32 modBits = vli_num_bits(mod, ndigits);
|
||||
|
||||
productBits = vli_num_bits(product + ndigits, ndigits);
|
||||
if (productBits) {
|
||||
productBits += ndigits * 64;
|
||||
} else {
|
||||
productBits = vli_num_bits(product, ndigits);
|
||||
}
|
||||
|
||||
if (productBits < modBits) {
|
||||
/* product < mod. */
|
||||
vli_set(result, product, ndigits);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Shift mod by (leftBits - modBits). This multiplies mod by the largest
|
||||
power of two possible while still resulting in a number less than left. */
|
||||
vli_clear(modMultiple, ndigits);
|
||||
vli_clear(modMultiple + ndigits, ndigits);
|
||||
digitShift = (productBits - modBits) / 64;
|
||||
bitShift = (productBits - modBits) % 64;
|
||||
if (bitShift) {
|
||||
modMultiple[digitShift + ndigits] = vli_lshift(modMultiple + digitShift, mod, bitShift, ndigits);
|
||||
} else {
|
||||
vli_set(modMultiple + digitShift, mod, ndigits);
|
||||
}
|
||||
|
||||
/* Subtract all multiples of mod to get the remainder. */
|
||||
vli_clear(result, ndigits);
|
||||
result[0] = 1; /* Use result as a temp var to store 1 (for subtraction) */
|
||||
while (productBits > ndigits * 64 || vli_cmp(modMultiple, mod, ndigits) >= 0)
|
||||
{
|
||||
u64 carry;
|
||||
int cmp = vli_cmp(modMultiple + ndigits, product + ndigits, ndigits);
|
||||
if (cmp < 0 || (cmp == 0 && vli_cmp(modMultiple, product, ndigits) <= 0)) {
|
||||
if (vli_sub(product, product, modMultiple, ndigits))
|
||||
{
|
||||
/* borrow */
|
||||
vli_sub(product + ndigits, product + ndigits, result, ndigits);
|
||||
}
|
||||
vli_sub(product + ndigits, product + ndigits, modMultiple + ndigits, ndigits);
|
||||
}
|
||||
carry = (modMultiple[ndigits] & 0x01) << 63;
|
||||
vli_rshift(modMultiple + ndigits, modMultiple + ndigits, 1, ndigits);
|
||||
vli_rshift(modMultiple, modMultiple, 1, ndigits);
|
||||
modMultiple[ndigits-1] |= carry;
|
||||
|
||||
--productBits;
|
||||
}
|
||||
vli_set(result, product, ndigits);
|
||||
}
|
||||
|
||||
/* Computes result = (product) % mod. */
|
||||
void vli_mod(u64 *result, u64 *product, u64 *mod, u8 ndigits)
|
||||
{
|
||||
bn_mod(result, product, mod, ndigits);
|
||||
}
|
||||
|
||||
/* Computes result = (left * right) % curve->p. */
|
||||
void vli_mod_mult_fast(u64 *result, u64 *left, u64 *right, u64 *mod, u8 ndigits)
|
||||
{
|
||||
u64 product[2 * 128];
|
||||
|
||||
vli_mult(product, left, right, ndigits);
|
||||
vli_mod(result, product, mod, ndigits);
|
||||
}
|
||||
|
||||
/* Computes result = left^2 % curve->p. */
|
||||
void vli_mod_square_fast(u64 *result, u64 *left, u64 *mod, u8 ndigits)
|
||||
{
|
||||
u64 product[2 * 128];
|
||||
|
||||
vli_square(product, left, ndigits);
|
||||
|
||||
vli_mod(result, product, mod, ndigits);
|
||||
}
|
||||
|
||||
/* Computes result = (left * right) % mod. */
|
||||
void vli_mod_mult(u64 *result, u64 *left, u64 *right, u64 *mod, u8 ndigits)
|
||||
{
|
||||
u64 product[2 * 1024];
|
||||
|
||||
vli_mult(product, left, right, ndigits);
|
||||
vli_mod(result, product, mod, ndigits);
|
||||
}
|
||||
|
||||
/* Computes result = left^2 % mod. */
|
||||
void vli_mod_square(u64 *result, u64 *left, u64 *mod, u8 ndigits)
|
||||
{
|
||||
u64 product[2 * 128];
|
||||
|
||||
vli_square(product, left, ndigits);
|
||||
vli_mod(result, product, mod, ndigits);
|
||||
}
|
||||
|
||||
#define DIGIT_2MSB(x) (u64)(((x) >> (VLI_DIGIT_BITS - 2)) & 0x03)
|
||||
/* Computes result = left^p % mod. */
|
||||
void vli_mod_exp(u64 *result, u64 *left, u64 *p, u64 *mod, u8 ndigits)
|
||||
{
|
||||
u64 bpower[3][128], t[128];
|
||||
u64 ci_bits, ci;
|
||||
u32 j, s;
|
||||
u32 digits;
|
||||
int i;
|
||||
|
||||
vli_set(bpower[0], left, ndigits);
|
||||
vli_mod_mult(bpower[1], bpower[0], left, mod, ndigits);
|
||||
vli_mod_mult(bpower[2], bpower[1], left, mod, ndigits);
|
||||
vli_clear(t, ndigits);
|
||||
t[0] = 1;
|
||||
|
||||
digits = vli_num_digits(p , ndigits);
|
||||
|
||||
i = digits - 1;
|
||||
for ( ; i >= 0; i--) {
|
||||
ci = p[i];
|
||||
ci_bits = VLI_DIGIT_BITS;
|
||||
|
||||
if (i == (digits - 1)) {
|
||||
while (!DIGIT_2MSB(ci)) {
|
||||
ci <<= 2;
|
||||
ci_bits -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
for( j = 0; j < ci_bits; j += 2) {
|
||||
vli_mod_mult(t, t, t, mod, ndigits);
|
||||
vli_mod_mult(t, t, t, mod, ndigits);
|
||||
if ((s = DIGIT_2MSB(ci)) != 0) {
|
||||
vli_mod_mult(t, t, bpower[s-1], mod, ndigits);
|
||||
}
|
||||
ci <<= 2;
|
||||
}
|
||||
}
|
||||
|
||||
vli_set(result, t, ndigits);
|
||||
}
|
||||
|
||||
#define EVEN(vli) (!(vli[0] & 1))
|
||||
/* Computes result = (1 / p_input) % mod. All VLIs are the same size.
|
||||
* See "From Euclid's GCD to Montgomery Multiplication to the Great Divide"
|
||||
* https://labs.oracle.com/techrep/2001/smli_tr-2001-95.pdf
|
||||
*/
|
||||
void vli_mod_inv(u64 *result, u64 *input, u64 *mod, u8 ndigits)
|
||||
{
|
||||
u64 a[128], b[128];
|
||||
u64 u[128], v[128];
|
||||
u64 carry;
|
||||
int cmp_result;
|
||||
|
||||
if (vli_is_zero(input, ndigits)) {
|
||||
vli_clear(result, ndigits);
|
||||
return;
|
||||
}
|
||||
|
||||
vli_set(a, input, ndigits);
|
||||
vli_set(b, mod, ndigits);
|
||||
vli_clear(u, ndigits);
|
||||
u[0] = 1;
|
||||
vli_clear(v, ndigits);
|
||||
|
||||
while ((cmp_result = vli_cmp(a, b, ndigits)) != 0) {
|
||||
carry = 0;
|
||||
|
||||
if (EVEN(a)) {
|
||||
vli_rshift(a, a, 1, ndigits);
|
||||
|
||||
if (!EVEN(u))
|
||||
carry = vli_add(u, u, mod, ndigits);
|
||||
|
||||
vli_rshift(u, u, 1, ndigits);
|
||||
if (carry)
|
||||
u[ndigits - 1] |= 0x8000000000000000ull;
|
||||
} else if (EVEN(b)) {
|
||||
vli_rshift(b, b, 1, ndigits);
|
||||
|
||||
if (!EVEN(v))
|
||||
carry = vli_add(v, v, mod, ndigits);
|
||||
|
||||
vli_rshift(v, v, 1, ndigits);
|
||||
if (carry)
|
||||
v[ndigits - 1] |= 0x8000000000000000ull;
|
||||
} else if (cmp_result > 0) {
|
||||
vli_sub(a, a, b, ndigits);
|
||||
vli_rshift(a, a, 1, ndigits);
|
||||
|
||||
if (vli_cmp(u, v, ndigits) < 0)
|
||||
vli_add(u, u, mod, ndigits);
|
||||
|
||||
vli_sub(u, u, v, ndigits);
|
||||
if (!EVEN(u))
|
||||
carry = vli_add(u, u, mod, ndigits);
|
||||
|
||||
vli_rshift(u, u, 1, ndigits);
|
||||
if (carry)
|
||||
u[ndigits - 1] |= 0x8000000000000000ull;
|
||||
} else {
|
||||
vli_sub(b, b, a, ndigits);
|
||||
vli_rshift(b, b, 1, ndigits);
|
||||
|
||||
if (vli_cmp(v, u, ndigits) < 0)
|
||||
vli_add(v, v, mod, ndigits);
|
||||
|
||||
vli_sub(v, v, u, ndigits);
|
||||
if (!EVEN(v))
|
||||
carry = vli_add(v, v, mod, ndigits);
|
||||
|
||||
vli_rshift(v, v, 1, ndigits);
|
||||
if (carry)
|
||||
v[ndigits - 1] |= 0x8000000000000000ull;
|
||||
}
|
||||
}
|
||||
|
||||
vli_set(result, u, ndigits);
|
||||
}
|
88
AWSMServer/src/sm2sm3_enc/big.h
Normal file
88
AWSMServer/src/sm2sm3_enc/big.h
Normal file
@ -0,0 +1,88 @@
|
||||
#ifndef _BIG_H_
|
||||
#define _BIG_H_
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
#define VLI_DIGIT_BITS 64
|
||||
#define VLI_DIGIT_BYTES (VLI_DIGIT_BITS/8)
|
||||
|
||||
void vli_clear(u64 *vli, u8 ndigits);
|
||||
|
||||
/* Returns true if vli == 0, false otherwise. */
|
||||
int vli_is_zero(u64 *vli, u8 ndigits);
|
||||
|
||||
/* Returns nonzero if bit bit of vli is set. */
|
||||
u64 vli_test_bit(u64 *vli, u8 bit, u8 ndigits);
|
||||
|
||||
/* Counts the number of 8-bit "digits" in vli. */
|
||||
u32 vli_num_digits(u64 *vli, u8 ndigits);
|
||||
|
||||
/* Counts the number of bits required for vli. */
|
||||
u32 vli_num_bits(u64 *vli, u8 ndigits);
|
||||
/* Sets dest = src. */
|
||||
|
||||
void vli_set(u64 *dest, u64 *src, u8 ndigits);
|
||||
|
||||
/* Returns sign of left - right. */
|
||||
int vli_cmp(u64 *left, u64 *right, u8 ndigits);
|
||||
|
||||
/* Computes result = in << c, returning carry. Can modify in place
|
||||
* (if result == in). 0 < shift < 8.
|
||||
*/
|
||||
u64 vli_lshift(u64 *result, u64 *in, u32 shift, u8 ndigits);
|
||||
|
||||
/* Computes result = (left * right) % curve->p. */
|
||||
void vli_mod_mult_fast(u64 *result, u64 *left, u64 *right, u64 *mod, u8 ndigits);
|
||||
|
||||
/* Computes result = left^2 % curve->p. */
|
||||
void vli_mod_square_fast(u64 *result, u64 *left, u64 *mod, u8 ndigits);
|
||||
|
||||
/* Computes result = in >> c, returning carry. Can modify in place
|
||||
* (if result == in). 0 < shift < 64.
|
||||
*/
|
||||
u64 vli_rshift(u64 *result, u64 *in, u32 shift, u8 ndigits);
|
||||
|
||||
/* Computes result = left + right, returning carry. Can modify in place. */
|
||||
u64 vli_add(u64 *result, u64 *left, u64 *right, u8 ndigits);
|
||||
|
||||
/* Computes result = left - right, returning borrow. Can modify in place. */
|
||||
u64 vli_sub(u64 *result, u64 *left, u64 *right, u8 ndigits);
|
||||
|
||||
/* Computes result = left * right. */
|
||||
void vli_mult(u64 *result, u64 *left, u64 *right, u8 ndigits);
|
||||
|
||||
/* Computes result = left^2. */
|
||||
void vli_square(u64 *result, u64 *left, u8 ndigits);
|
||||
|
||||
/* Computes result = (left + right) % mod.
|
||||
Assumes that left < mod and right < mod, result != mod. */
|
||||
void vli_mod_add(u64 *result, u64 *left, u64 *right, u64 *mod, u8 ndigits);
|
||||
|
||||
/* Computes result = (left - right) % mod.
|
||||
Assumes that left < mod and right < mod, result != mod. */
|
||||
void vli_mod_sub(u64 *result, u64 *left, u64 *right, u64 *mod, u8 ndigits);
|
||||
|
||||
/* Computes result = (left * right) % mod. */
|
||||
void vli_mod_mult(u64 *result, u64 *left, u64 *right, u64 *mod, u8 ndigits);
|
||||
|
||||
/* Computes result = left^2 % mod. */
|
||||
void vli_mod_square(u64 *result, u64 *left, u64 *mod, u8 ndigits);
|
||||
|
||||
/* Computes result = left^p % mod. */
|
||||
void vli_mod_exp(u64 *result, u64 *left, u64 *p, u64 *mod, u8 ndigits);
|
||||
|
||||
/* Computes result = (product) % mod. */
|
||||
void vli_mod(u64 *result, u64 *product, u64 *mod, u8 ndigits);
|
||||
|
||||
/* Computes result = (1 / input) % mod. All VLIs are the same size.
|
||||
* See "From Euclid's GCD to Montgomery Multiplication to the Great Divide"
|
||||
* https://labs.oracle.com/techrep/2001/smli_tr-2001-95.pdf
|
||||
*/
|
||||
void vli_mod_inv(u64 *result, u64 *input, u64 *mod, u8 ndigits);
|
||||
|
||||
/* Computes result = (left / right).
|
||||
* remainder = (left % right).
|
||||
*/
|
||||
void vli_div(u64 *result, u64 *remainder, u64 *left, u64 cdigits, u64 *right, u8 ddigits);
|
||||
|
||||
#endif
|
352
AWSMServer/src/sm2sm3_enc/ecc.c
Normal file
352
AWSMServer/src/sm2sm3_enc/ecc.c
Normal file
@ -0,0 +1,352 @@
|
||||
#include <stdio.h>
|
||||
#include "typedef.h"
|
||||
#include "ecc.h"
|
||||
#include "big.h"
|
||||
|
||||
static u64 cpu_to_be64(u64 x)
|
||||
{
|
||||
u64 r;
|
||||
int i, len;
|
||||
char *p, *q;
|
||||
|
||||
len = sizeof(x);
|
||||
q = (char *)&x + len - 1;
|
||||
p = (char *)&r;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
*p = *q;
|
||||
p++;
|
||||
q--;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static u64 be64_to_cpu(u64 x)
|
||||
{
|
||||
u64 r;
|
||||
int i, len;
|
||||
char *p, *q;
|
||||
|
||||
len = sizeof(x);
|
||||
q = (char *)&x + len - 1;
|
||||
p = (char *)&r;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
*p = *q;
|
||||
p++;
|
||||
q--;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Returns 1 if point is the point at infinity, 0 otherwise. */
|
||||
int ecc_point_is_zero(struct ecc_curve *curve, ecc_point *point)
|
||||
{
|
||||
return (vli_is_zero(point->x, curve->ndigits)
|
||||
&& vli_is_zero(point->y, curve->ndigits));
|
||||
}
|
||||
|
||||
/* Double in place */
|
||||
void ecc_point_double_jacobian(struct ecc_curve *curve, u64 *X1, u64 *Y1, u64 *Z1)
|
||||
{
|
||||
/* t1 = X, t2 = Y, t3 = Z */
|
||||
u64 t4[ECC_MAX_DIGITS];
|
||||
u64 t5[ECC_MAX_DIGITS];
|
||||
|
||||
if(vli_is_zero(Z1, curve->ndigits))
|
||||
return;
|
||||
|
||||
vli_mod_square_fast(t4, Y1, curve->p, curve->ndigits); /* t4 = y1^2 */
|
||||
vli_mod_mult_fast(t5, X1, t4, curve->p, curve->ndigits); /* t5 = x1*y1^2 = A */
|
||||
vli_mod_square_fast(t4, t4, curve->p, curve->ndigits); /* t4 = y1^4 */
|
||||
vli_mod_mult_fast(Y1, Y1, Z1, curve->p, curve->ndigits); /* t2 = y1*z1 = z3 */
|
||||
vli_mod_square_fast(Z1, Z1, curve->p, curve->ndigits); /* t3 = z1^2 */
|
||||
|
||||
vli_mod_add(X1, X1, Z1, curve->p, curve->ndigits); /* t1 = x1 + z1^2 */
|
||||
vli_mod_add(Z1, Z1, Z1, curve->p, curve->ndigits); /* t3 = 2*z1^2 */
|
||||
vli_mod_sub(Z1, X1, Z1, curve->p, curve->ndigits); /* t3 = x1 - z1^2 */
|
||||
vli_mod_mult_fast(X1, X1, Z1, curve->p, curve->ndigits); /* t1 = x1^2 - z1^4 */
|
||||
|
||||
vli_mod_add(Z1, X1, X1, curve->p, curve->ndigits); /* t3 = 2*(x1^2 - z1^4) */
|
||||
vli_mod_add(X1, X1, Z1, curve->p, curve->ndigits); /* t1 = 3*(x1^2 - z1^4) */
|
||||
if (vli_test_bit(X1, 0, curve->ndigits)) {
|
||||
u64 carry = vli_add(X1, X1, curve->p, curve->ndigits);
|
||||
vli_rshift(X1, X1, 1, curve->ndigits);
|
||||
X1[ECC_MAX_DIGITS-1] |= carry << 63;
|
||||
} else {
|
||||
vli_rshift(X1, X1, 1, curve->ndigits);
|
||||
}
|
||||
|
||||
/* t1 = 3/2*(x1^2 - z1^4) = B */
|
||||
vli_mod_square_fast(Z1, X1, curve->p, curve->ndigits); /* t3 = B^2 */
|
||||
vli_mod_sub(Z1, Z1, t5, curve->p, curve->ndigits); /* t3 = B^2 - A */
|
||||
vli_mod_sub(Z1, Z1, t5, curve->p, curve->ndigits); /* t3 = B^2 - 2A = x3 */
|
||||
vli_mod_sub(t5, t5, Z1, curve->p, curve->ndigits); /* t5 = A - x3 */
|
||||
vli_mod_mult_fast(X1, X1, t5, curve->p, curve->ndigits); /* t1 = B * (A - x3) */
|
||||
vli_mod_sub(t4, X1, t4, curve->p, curve->ndigits); /* t4 = B * (A - x3) - y1^4 = y3 */
|
||||
|
||||
vli_set(X1, Z1, curve->ndigits);
|
||||
vli_set(Z1, Y1, curve->ndigits);
|
||||
vli_set(Y1, t4, curve->ndigits);
|
||||
}
|
||||
|
||||
/* Modify (x1, y1) => (x1 * z^2, y1 * z^3) */
|
||||
void apply_z(struct ecc_curve *curve, u64 *X1, u64 *Y1, u64 *Z)
|
||||
{
|
||||
u64 t1[ECC_MAX_DIGITS];
|
||||
|
||||
vli_mod_square_fast(t1, Z, curve->p, curve->ndigits); /* z^2 */
|
||||
vli_mod_mult_fast(X1, X1, t1, curve->p, curve->ndigits); /* x1 * z^2 */
|
||||
vli_mod_mult_fast(t1, t1, Z, curve->p, curve->ndigits); /* z^3 */
|
||||
vli_mod_mult_fast(Y1, Y1, t1, curve->p, curve->ndigits); /* y1 * z^3 */
|
||||
}
|
||||
|
||||
/* P = (x1, y1) => 2P, (x2, y2) => P' */
|
||||
void XYcZ_initial_double(struct ecc_curve *curve, u64 *X1, u64 *Y1, u64 *X2, u64 *Y2, u64 *initialZ)
|
||||
{
|
||||
u64 z[ECC_MAX_DIGITS];
|
||||
|
||||
vli_set(X2, X1, curve->ndigits);
|
||||
vli_set(Y2, Y1, curve->ndigits);
|
||||
|
||||
if (initialZ) {
|
||||
vli_set(z, initialZ, curve->ndigits);
|
||||
} else {
|
||||
vli_clear(z, curve->ndigits);
|
||||
z[0] = 1;
|
||||
}
|
||||
apply_z(curve, X1, Y1, z);
|
||||
|
||||
ecc_point_double_jacobian(curve, X1, Y1, z);
|
||||
|
||||
apply_z(curve, X2, Y2, z);
|
||||
}
|
||||
|
||||
/* Input P = (x1, y1, Z), Q = (x2, y2, Z)
|
||||
Output P' = (x1', y1', Z3), P + Q = (x3, y3, Z3)
|
||||
or P => P', Q => P + Q
|
||||
*/
|
||||
void XYcZ_add(struct ecc_curve *curve, u64 *X1, u64 *Y1, u64 *X2, u64 *Y2)
|
||||
{
|
||||
/* t1 = X1, t2 = Y1, t3 = X2, t4 = Y2 */
|
||||
u64 t5[ECC_MAX_DIGITS];
|
||||
|
||||
vli_mod_sub(t5, X2, X1, curve->p, curve->ndigits); /* t5 = x2 - x1 */
|
||||
vli_mod_square_fast(t5, t5, curve->p, curve->ndigits); /* t5 = (x2 - x1)^2 = A */
|
||||
vli_mod_mult_fast(X1, X1, t5, curve->p, curve->ndigits); /* t1 = x1*A = B */
|
||||
vli_mod_mult_fast(X2, X2, t5, curve->p, curve->ndigits); /* t3 = x2*A = C */
|
||||
vli_mod_sub(Y2, Y2, Y1, curve->p, curve->ndigits); /* t4 = y2 - y1 */
|
||||
vli_mod_square_fast(t5, Y2, curve->p, curve->ndigits); /* t5 = (y2 - y1)^2 = D */
|
||||
|
||||
vli_mod_sub(t5, t5, X1, curve->p, curve->ndigits); /* t5 = D - B */
|
||||
vli_mod_sub(t5, t5, X2, curve->p, curve->ndigits); /* t5 = D - B - C = x3 */
|
||||
vli_mod_sub(X2, X2, X1, curve->p, curve->ndigits); /* t3 = C - B */
|
||||
vli_mod_mult_fast(Y1, Y1, X2, curve->p, curve->ndigits); /* t2 = y1*(C - B) */
|
||||
vli_mod_sub(X2, X1, t5, curve->p, curve->ndigits); /* t3 = B - x3 */
|
||||
vli_mod_mult_fast(Y2, Y2, X2, curve->p, curve->ndigits); /* t4 = (y2 - y1)*(B - x3) */
|
||||
vli_mod_sub(Y2, Y2, Y1, curve->p, curve->ndigits); /* t4 = y3 */
|
||||
|
||||
vli_set(X2, t5, curve->ndigits);
|
||||
}
|
||||
|
||||
/* Input P = (x1, y1, Z), Q = (x2, y2, Z)
|
||||
* Output P + Q = (x3, y3, Z3), P - Q = (x3', y3', Z3)
|
||||
* or P => P - Q, Q => P + Q
|
||||
*/
|
||||
void XYcZ_addC(struct ecc_curve *curve, u64 *X1, u64 *Y1, u64 *X2, u64 *Y2)
|
||||
{
|
||||
/* t1 = X1, t2 = Y1, t3 = X2, t4 = Y2 */
|
||||
u64 t5[ECC_MAX_DIGITS];
|
||||
u64 t6[ECC_MAX_DIGITS];
|
||||
u64 t7[ECC_MAX_DIGITS];
|
||||
|
||||
vli_mod_sub(t5, X2, X1, curve->p, curve->ndigits); /* t5 = x2 - x1 */
|
||||
vli_mod_square_fast(t5, t5, curve->p, curve->ndigits); /* t5 = (x2 - x1)^2 = A */
|
||||
vli_mod_mult_fast(X1, X1, t5, curve->p, curve->ndigits); /* t1 = x1*A = B */
|
||||
vli_mod_mult_fast(X2, X2, t5, curve->p, curve->ndigits); /* t3 = x2*A = C */
|
||||
vli_mod_add(t5, Y2, Y1, curve->p, curve->ndigits); /* t4 = y2 + y1 */
|
||||
vli_mod_sub(Y2, Y2, Y1, curve->p, curve->ndigits); /* t4 = y2 - y1 */
|
||||
|
||||
vli_mod_sub(t6, X2, X1, curve->p, curve->ndigits); /* t6 = C - B */
|
||||
vli_mod_mult_fast(Y1, Y1, t6, curve->p, curve->ndigits); /* t2 = y1 * (C - B) */
|
||||
vli_mod_add(t6, X1, X2, curve->p, curve->ndigits); /* t6 = B + C */
|
||||
vli_mod_square_fast(X2, Y2, curve->p, curve->ndigits); /* t3 = (y2 - y1)^2 */
|
||||
vli_mod_sub(X2, X2, t6, curve->p, curve->ndigits); /* t3 = x3 */
|
||||
|
||||
vli_mod_sub(t7, X1, X2, curve->p, curve->ndigits); /* t7 = B - x3 */
|
||||
vli_mod_mult_fast(Y2, Y2, t7, curve->p, curve->ndigits); /* t4 = (y2 - y1)*(B - x3) */
|
||||
vli_mod_sub(Y2, Y2, Y1, curve->p, curve->ndigits); /* t4 = y3 */
|
||||
|
||||
vli_mod_square_fast(t7, t5, curve->p, curve->ndigits); /* t7 = (y2 + y1)^2 = F */
|
||||
vli_mod_sub(t7, t7, t6, curve->p, curve->ndigits); /* t7 = x3' */
|
||||
vli_mod_sub(t6, t7, X1, curve->p, curve->ndigits); /* t6 = x3' - B */
|
||||
vli_mod_mult_fast(t6, t6, t5, curve->p, curve->ndigits); /* t6 = (y2 + y1)*(x3' - B) */
|
||||
vli_mod_sub(Y1, t6, Y1, curve->p, curve->ndigits); /* t2 = y3' */
|
||||
|
||||
vli_set(X1, t7, curve->ndigits);
|
||||
}
|
||||
|
||||
void ecc_point_mult(struct ecc_curve *curve, ecc_point *result, ecc_point *point, u64 *scalar, u64 *initialZ)
|
||||
{
|
||||
/* R0 and R1 */
|
||||
u64 Rx[2][ECC_MAX_DIGITS];
|
||||
u64 Ry[2][ECC_MAX_DIGITS];
|
||||
u64 z[ECC_MAX_DIGITS];
|
||||
int i, nb;
|
||||
|
||||
vli_set(Rx[1], point->x, curve->ndigits);
|
||||
vli_set(Ry[1], point->y, curve->ndigits);
|
||||
|
||||
XYcZ_initial_double(curve, Rx[1], Ry[1], Rx[0], Ry[0], initialZ);
|
||||
|
||||
for (i = vli_num_bits(scalar, curve->ndigits) - 2; i > 0; --i) {
|
||||
nb = !vli_test_bit(scalar, i, curve->ndigits);
|
||||
XYcZ_addC(curve, Rx[1-nb], Ry[1-nb], Rx[nb], Ry[nb]);
|
||||
XYcZ_add(curve, Rx[nb], Ry[nb], Rx[1-nb], Ry[1-nb]);
|
||||
}
|
||||
|
||||
nb = !vli_test_bit(scalar, 0, curve->ndigits);
|
||||
XYcZ_addC(curve, Rx[1-nb], Ry[1-nb], Rx[nb], Ry[nb]);
|
||||
|
||||
/* Find final 1/Z value. */
|
||||
vli_mod_sub(z, Rx[1], Rx[0], curve->p, curve->ndigits); /* X1 - X0 */
|
||||
vli_mod_mult_fast(z, z, Ry[1-nb], curve->p, curve->ndigits); /* Yb * (X1 - X0) */
|
||||
vli_mod_mult_fast(z, z, point->x, curve->p, curve->ndigits); /* xP * Yb * (X1 - X0) */
|
||||
vli_mod_inv(z, z, curve->p, curve->ndigits); /* 1 / (xP * Yb * (X1 - X0)) */
|
||||
vli_mod_mult_fast(z, z, point->y, curve->p, curve->ndigits); /* yP / (xP * Yb * (X1 - X0)) */
|
||||
vli_mod_mult_fast(z, z, Rx[1-nb], curve->p, curve->ndigits); /* Xb * yP / (xP * Yb * (X1 - X0)) */
|
||||
/* End 1/Z calculation */
|
||||
|
||||
XYcZ_add(curve, Rx[nb], Ry[nb], Rx[1-nb], Ry[1-nb]);
|
||||
|
||||
apply_z(curve, Rx[0], Ry[0], z);
|
||||
|
||||
vli_set(result->x, Rx[0], curve->ndigits);
|
||||
vli_set(result->y, Ry[0], curve->ndigits);
|
||||
}
|
||||
|
||||
static u32 max(u32 a, u32 b)
|
||||
{
|
||||
return (a > b ? a : b);
|
||||
}
|
||||
|
||||
void ecc_point_mult2(struct ecc_curve *curve, ecc_point *result, ecc_point *g, ecc_point *p, u64 *s, u64 *t)
|
||||
{
|
||||
u64 tx[ECC_MAX_DIGITS];
|
||||
u64 ty[ECC_MAX_DIGITS];
|
||||
u64 tz[ECC_MAX_DIGITS];
|
||||
u64 z[ECC_MAX_DIGITS];
|
||||
ecc_point sum;
|
||||
u64 *rx;
|
||||
u64 *ry;
|
||||
int i;
|
||||
ecc_point *points[4] = {NULL, g, p, &sum};
|
||||
u32 numBits;
|
||||
ecc_point *point;
|
||||
|
||||
rx = result->x;
|
||||
ry = result->y;
|
||||
|
||||
/* Calculate sum = G + Q. */
|
||||
vli_set(sum.x, p->x, curve->ndigits);
|
||||
vli_set(sum.y, p->y, curve->ndigits);
|
||||
vli_set(tx, g->x, curve->ndigits);
|
||||
vli_set(ty, g->y, curve->ndigits);
|
||||
|
||||
vli_mod_sub(z, sum.x, tx, curve->p, curve->ndigits); /* Z = x2 - x1 */
|
||||
XYcZ_add(curve, tx, ty, sum.x, sum.y);
|
||||
vli_mod_inv(z, z, curve->p, curve->ndigits); /* Z = 1/Z */
|
||||
apply_z(curve, sum.x, sum.y, z);
|
||||
|
||||
numBits = max(vli_num_bits(s, curve->ndigits), vli_num_bits(t, curve->ndigits));
|
||||
|
||||
point = points[(!!vli_test_bit(s, numBits-1, curve->ndigits))
|
||||
| ((!!vli_test_bit(t, numBits-1, curve->ndigits)) << 1)];
|
||||
vli_set(rx, point->x, curve->ndigits);
|
||||
vli_set(ry, point->y, curve->ndigits);
|
||||
vli_clear(z, curve->ndigits);
|
||||
z[0] = 1;
|
||||
|
||||
for (i = numBits - 2; i >= 0; --i) {
|
||||
int index;
|
||||
ecc_point *point;
|
||||
ecc_point_double_jacobian(curve, rx, ry, z);
|
||||
|
||||
index = (!!vli_test_bit(s, i, curve->ndigits)) | ((!!vli_test_bit(t, i, curve->ndigits)) << 1);
|
||||
point = points[index];
|
||||
if(point) {
|
||||
vli_set(tx, point->x, curve->ndigits);
|
||||
vli_set(ty, point->y, curve->ndigits);
|
||||
apply_z(curve, tx, ty, z);
|
||||
vli_mod_sub(tz, rx, tx, curve->p, curve->ndigits); /* Z = x2 - x1 */
|
||||
XYcZ_add(curve, tx, ty, rx, ry);
|
||||
vli_mod_mult_fast(z, z, tz, curve->p, curve->ndigits);
|
||||
}
|
||||
}
|
||||
|
||||
vli_mod_inv(z, z, curve->p, curve->ndigits); /* Z = 1/Z */
|
||||
apply_z(curve, rx, ry, z);
|
||||
}
|
||||
|
||||
void ecc_point_add(struct ecc_curve *curve, ecc_point *result, ecc_point *left, ecc_point *right)
|
||||
{
|
||||
u64 x1[ECC_MAX_DIGITS];
|
||||
u64 y1[ECC_MAX_DIGITS];
|
||||
u64 x2[ECC_MAX_DIGITS];
|
||||
u64 y2[ECC_MAX_DIGITS];
|
||||
u64 z[ECC_MAX_DIGITS];
|
||||
|
||||
vli_set(x1, left->x, curve->ndigits);
|
||||
vli_set(y1, left->y, curve->ndigits);
|
||||
vli_set(x2, right->x, curve->ndigits);
|
||||
vli_set(y2, right->y, curve->ndigits);
|
||||
|
||||
vli_mod_sub(z, x2, x1, curve->p, curve->ndigits); /* Z = x2 - x1 */
|
||||
|
||||
XYcZ_add(curve, x1, y1, x2, y2);
|
||||
vli_mod_inv(z, z, curve->p, curve->ndigits); /* Z = 1/Z */
|
||||
apply_z(curve, x2,y2, z);
|
||||
|
||||
vli_set(result->x, x2, curve->ndigits);
|
||||
vli_set(result->y, y2, curve->ndigits);
|
||||
}
|
||||
|
||||
void ecc_bytes2native(u64 *native, void *bytes, u8 ndigits)
|
||||
{
|
||||
u64 *_bytes = (u64*)bytes;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ndigits/2; ++i) {
|
||||
if (native == _bytes) {
|
||||
u64 temp;
|
||||
temp = be64_to_cpu(native[i]);
|
||||
native[i] = be64_to_cpu(_bytes[ndigits - i - 1]);
|
||||
_bytes[ndigits - i - 1] = temp;
|
||||
}else {
|
||||
native[i] = be64_to_cpu(_bytes[ndigits - i - 1]);
|
||||
native[ndigits - i - 1] = be64_to_cpu(_bytes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ecc_native2bytes(void *bytes, u64 *native, u8 ndigits)
|
||||
{
|
||||
u64 *_bytes = (u64*)bytes;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ndigits/2; ++i) {
|
||||
if (_bytes == native) {
|
||||
u64 temp;
|
||||
temp = cpu_to_be64(_bytes[ndigits - i - 1]);
|
||||
_bytes[ndigits - i - 1] = cpu_to_be64(native[i]);
|
||||
native[i] = temp;
|
||||
} else {
|
||||
_bytes[i] = cpu_to_be64(native[ndigits - i - 1]);
|
||||
_bytes[ndigits - i - 1] = cpu_to_be64(native[i]);
|
||||
}
|
||||
}
|
||||
}
|
64
AWSMServer/src/sm2sm3_enc/ecc.h
Normal file
64
AWSMServer/src/sm2sm3_enc/ecc.h
Normal file
@ -0,0 +1,64 @@
|
||||
#ifndef _ECC_H_
|
||||
#define _ECC_H_
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
#define ECC_WORDSIZE 8
|
||||
#define ECC_NUMBITS 256
|
||||
#define ECC_NUMWORD (ECC_NUMBITS/ECC_WORDSIZE) //32
|
||||
|
||||
#define ECC_MAX_DIGITS 4
|
||||
|
||||
#define SWAP(a,b) { u32 t = a; a = b; b = t;}
|
||||
|
||||
/*
|
||||
#define digit2str16(x, y) { \
|
||||
(y)[0] = (u64)((x >> 8 ) & 0x000000FF); \
|
||||
(y)[1] = (u64)((x >> 0 ) & 0x000000FF); \
|
||||
}
|
||||
|
||||
#define str2digit16(y, x) { \
|
||||
x = ((((u16)(y)[0]) & 0x000000FF) << 8) | \
|
||||
((((u16)(y)[1]) & 0x000000FF) << 0 ); \
|
||||
}
|
||||
|
||||
#define digit2str32(x, y) { \
|
||||
(y)[0] = (u64)((x >> 24) & 0x000000FF); \
|
||||
(y)[1] = (u64)((x >> 16) & 0x000000FF); \
|
||||
(y)[2] = (u64)((x >> 8 ) & 0x000000FF); \
|
||||
(y)[3] = (u64)((x >> 0 ) & 0x000000FF); \
|
||||
}
|
||||
|
||||
#define str2digit32(y, x) { \
|
||||
x = ((((u32)(y)[0]) & 0x000000FF) << 24) | \
|
||||
((((u32)(y)[1]) & 0x000000FF) << 16) | \
|
||||
((((u32)(y)[2]) & 0x000000FF) << 8 ) | \
|
||||
((((u32)(y)[3]) & 0x000000FF) << 0 ); \
|
||||
}
|
||||
*/
|
||||
|
||||
typedef struct ecc_point
|
||||
{
|
||||
u64 x[ECC_MAX_DIGITS];
|
||||
u64 y[ECC_MAX_DIGITS];
|
||||
} ecc_point;
|
||||
|
||||
struct ecc_curve {
|
||||
u8 ndigits;
|
||||
struct ecc_point g;
|
||||
u64 p[ECC_MAX_DIGITS];
|
||||
u64 n[ECC_MAX_DIGITS];
|
||||
u64 h[ECC_MAX_DIGITS];
|
||||
u64 a[ECC_MAX_DIGITS];
|
||||
u64 b[ECC_MAX_DIGITS];
|
||||
};
|
||||
|
||||
void ecc_bytes2native(u64 *native, void *bytes, u8 ndigits);
|
||||
void ecc_native2bytes(void *bytes, u64 *native, u8 ndigits);
|
||||
|
||||
void ecc_point_add(struct ecc_curve *curve, ecc_point *result, ecc_point *x, ecc_point *y);
|
||||
void ecc_point_mult(struct ecc_curve *curve, ecc_point *result, ecc_point *point, u64 *scalar, u64 *initialZ);
|
||||
void ecc_point_mult2(struct ecc_curve *curve, ecc_point *result, ecc_point *g, ecc_point *p, u64 *s, u64 *t);
|
||||
int ecc_point_is_zero(struct ecc_curve *curve, ecc_point *point);
|
||||
|
||||
#endif
|
28
AWSMServer/src/sm2sm3_enc/random.c
Normal file
28
AWSMServer/src/sm2sm3_enc/random.c
Normal file
@ -0,0 +1,28 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "typedef.h"
|
||||
|
||||
int vli_get_random(u8 *data, u32 len)
|
||||
{
|
||||
int i;
|
||||
int r;
|
||||
|
||||
if (len >= 4)
|
||||
{
|
||||
for (i = 0; i < len / 4; i++)
|
||||
{
|
||||
r = rand();
|
||||
memcpy(data + i * 4, &r, 4);
|
||||
}
|
||||
}
|
||||
|
||||
if (len % 4)
|
||||
{
|
||||
r = rand();
|
||||
memcpy(data + i * 4, &r, len % 4);
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
10
AWSMServer/src/sm2sm3_enc/random.h
Normal file
10
AWSMServer/src/sm2sm3_enc/random.h
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
#ifndef _RANDOM_H_
|
||||
#define _RANDOM_H_
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
|
||||
int vli_get_random(u8 *p_data, u32 len);
|
||||
|
||||
#endif
|
537
AWSMServer/src/sm2sm3_enc/sm2.c
Normal file
537
AWSMServer/src/sm2sm3_enc/sm2.c
Normal file
@ -0,0 +1,537 @@
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "big.h"
|
||||
#include "ecc.h"
|
||||
#include "sm2.h"
|
||||
#include "sm3.h"
|
||||
|
||||
struct ecc_curve sm2_curve = {
|
||||
ECC_MAX_DIGITS,
|
||||
{
|
||||
{0x715A4589334C74C7ull, 0x8FE30BBFF2660BE1ull, 0x5F9904466A39C994ull, 0x32C4AE2C1F198119ull},
|
||||
{0x02DF32E52139F0A0ull, 0xD0A9877CC62A4740ull, 0x59BDCEE36B692153ull, 0xBC3736A2F4F6779Cull},
|
||||
},
|
||||
{0xFFFFFFFFFFFFFFFFull, 0xFFFFFFFF00000000ull, 0xFFFFFFFFFFFFFFFFull, 0xFFFFFFFEFFFFFFFFull},
|
||||
{0x53BBF40939D54123ull, 0x7203DF6B21C6052Bull, 0xFFFFFFFFFFFFFFFFull, 0xFFFFFFFEFFFFFFFFull},
|
||||
{
|
||||
0x0000000000000001ull,
|
||||
0x0000000000000000ull,
|
||||
0x0000000000000000ull,
|
||||
0x0000000000000000ull,
|
||||
},
|
||||
{0xFFFFFFFFFFFFFFFCull, 0xFFFFFFFF00000000ull, 0xFFFFFFFFFFFFFFFFull, 0xFFFFFFFEFFFFFFFFull},
|
||||
{0xDDBCBD414D940E93ull, 0xF39789F515AB8F92ull, 0x4D5A9E4BCF6509A7ull, 0x28E9FA9E9D9F5E34ull},
|
||||
};
|
||||
|
||||
static void
|
||||
sm2_w(u64 *result, u64 *x)
|
||||
{
|
||||
result[0] = x[0];
|
||||
result[1] = x[1];
|
||||
result[1] |= 0x80;
|
||||
result[2] = 0;
|
||||
result[3] = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
sm3_kdf(u8 *Z, u32 zlen, u8 *K, u32 klen)
|
||||
{
|
||||
u32 ct = 0x00000001;
|
||||
u8 ct_char[32];
|
||||
u8 *hash = K;
|
||||
u32 i, t;
|
||||
struct sm3_ctx md[1];
|
||||
|
||||
t = klen / ECC_NUMWORD;
|
||||
//s4: K=Ha1||Ha2||...
|
||||
for (i = 0; i < t; i++) {
|
||||
//s2: Hai=Hv(Z||ct)
|
||||
sm3_init(md);
|
||||
sm3_update(md, Z, zlen);
|
||||
put_unaligned_be32(ct, ct_char);
|
||||
sm3_update(md, ct_char, 4);
|
||||
sm3_final(md, hash);
|
||||
hash += 32;
|
||||
ct++;
|
||||
}
|
||||
|
||||
t = klen % ECC_NUMBITS;
|
||||
if (t) {
|
||||
sm3_init(md);
|
||||
sm3_update(md, Z, zlen);
|
||||
put_unaligned_be32(ct, ct_char);
|
||||
sm3_update(md, ct_char, 4);
|
||||
sm3_final(md, ct_char);
|
||||
memcpy(hash, ct_char, t);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sm3_z(u8 *id, u32 idlen, ecc_point *pub, u8 *hash)
|
||||
{
|
||||
u8 a[ECC_NUMWORD];
|
||||
u8 b[ECC_NUMWORD];
|
||||
u8 x[ECC_NUMWORD];
|
||||
u8 y[ECC_NUMWORD];
|
||||
u8 idlen_char[2];
|
||||
struct sm3_ctx md[1];
|
||||
|
||||
put_unaligned_be16(idlen << 3, idlen_char);
|
||||
|
||||
ecc_bytes2native((u64 *) a, sm2_curve.a, sm2_curve.ndigits);
|
||||
ecc_bytes2native((u64 *) b, sm2_curve.b, sm2_curve.ndigits);
|
||||
ecc_bytes2native((u64 *) x, sm2_curve.g.x, sm2_curve.ndigits);
|
||||
ecc_bytes2native((u64 *) y, sm2_curve.g.y, sm2_curve.ndigits);
|
||||
|
||||
sm3_init(md);
|
||||
sm3_update(md, idlen_char, 2);
|
||||
sm3_update(md, id, idlen);
|
||||
sm3_update(md, a, ECC_NUMWORD);
|
||||
sm3_update(md, b, ECC_NUMWORD);
|
||||
sm3_update(md, x, ECC_NUMWORD);
|
||||
sm3_update(md, y, ECC_NUMWORD);
|
||||
sm3_update(md, (u8 *) pub->x, ECC_NUMWORD);
|
||||
sm3_update(md, (u8 *) pub->y, ECC_NUMWORD);
|
||||
sm3_final(md, hash);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
sm2_valid_public_key(ecc_point *publicKey)
|
||||
{
|
||||
u64 na[ECC_MAX_DIGITS] = {3}; /* a mod p = (-3) mod p */
|
||||
u64 tmp1[ECC_MAX_DIGITS];
|
||||
u64 tmp2[ECC_MAX_DIGITS];
|
||||
|
||||
if (ecc_point_is_zero(&sm2_curve, publicKey)) return 1;
|
||||
|
||||
if (vli_cmp(sm2_curve.p, publicKey->x, sm2_curve.ndigits) != 1
|
||||
|| vli_cmp(sm2_curve.p, publicKey->y, sm2_curve.ndigits) != 1)
|
||||
return 1;
|
||||
|
||||
/* tmp1 = y^2 */
|
||||
vli_mod_square_fast(tmp1, publicKey->y, sm2_curve.p, sm2_curve.ndigits);
|
||||
/* tmp2 = x^2 */
|
||||
vli_mod_square_fast(tmp2, publicKey->x, sm2_curve.p, sm2_curve.ndigits);
|
||||
/* tmp2 = x^2 + a = x^2 - 3 */
|
||||
vli_mod_sub(tmp2, tmp2, na, sm2_curve.p, sm2_curve.ndigits);
|
||||
/* tmp2 = x^3 + ax */
|
||||
vli_mod_mult_fast(tmp2, tmp2, publicKey->x, sm2_curve.p, sm2_curve.ndigits);
|
||||
/* tmp2 = x^3 + ax + b */
|
||||
vli_mod_add(tmp2, tmp2, sm2_curve.b, sm2_curve.p, sm2_curve.ndigits);
|
||||
|
||||
/* Make sure that y^2 == x^3 + ax + b */
|
||||
if (vli_cmp(tmp1, tmp2, sm2_curve.ndigits) != 0) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sm2_make_prikey(u8 *prikey)
|
||||
{
|
||||
ecc_point pub[1];
|
||||
u64 pri[ECC_MAX_DIGITS];
|
||||
int i = 10;
|
||||
|
||||
do {
|
||||
vli_get_random((u8 *) pri, ECC_NUMWORD);
|
||||
if (vli_cmp(sm2_curve.n, pri, sm2_curve.ndigits) != 1) { vli_sub(pri, pri, sm2_curve.n, sm2_curve.ndigits); }
|
||||
|
||||
/* The private key cannot be 0 (mod p). */
|
||||
if (!vli_is_zero(pri, sm2_curve.ndigits)) {
|
||||
ecc_native2bytes(prikey, pri, sm2_curve.ndigits);
|
||||
return 0;
|
||||
}
|
||||
} while (i--);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
sm2_make_pubkey(u8 *prikey, ecc_point *pubkey)
|
||||
{
|
||||
ecc_point pub[1];
|
||||
u64 pri[ECC_MAX_DIGITS];
|
||||
|
||||
ecc_bytes2native(pri, prikey, sm2_curve.ndigits);
|
||||
ecc_point_mult(&sm2_curve, pub, &sm2_curve.g, pri, NULL);
|
||||
ecc_native2bytes(pubkey->x, pub->x, sm2_curve.ndigits);
|
||||
ecc_native2bytes(pubkey->y, pub->y, sm2_curve.ndigits);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sm2_make_keypair(u8 *prikey, ecc_point *pubkey)
|
||||
{
|
||||
sm2_make_prikey(prikey);
|
||||
sm2_make_pubkey(prikey, pubkey);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sm2_point_mult(ecc_point *G, u8 *k, ecc_point *P)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
ecc_point G_[1];
|
||||
ecc_point P_[1];
|
||||
u64 k_[ECC_MAX_DIGITS];
|
||||
|
||||
ecc_bytes2native(k_, k, sm2_curve.ndigits);
|
||||
ecc_bytes2native(G_->x, G->x, sm2_curve.ndigits);
|
||||
ecc_bytes2native(G_->y, G->y, sm2_curve.ndigits);
|
||||
|
||||
ecc_point_mult(&sm2_curve, P_, G_, k_, NULL);
|
||||
|
||||
ecc_native2bytes(P->x, P_->x, sm2_curve.ndigits);
|
||||
ecc_native2bytes(P->y, P_->y, sm2_curve.ndigits);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
sm2_sign(u8 *r_, u8 *s_, u8 *prikey, u8 *hash_)
|
||||
{
|
||||
u64 k[ECC_MAX_DIGITS];
|
||||
u64 one[ECC_MAX_DIGITS] = {1};
|
||||
u64 random[ECC_MAX_DIGITS];
|
||||
u64 pri[ECC_MAX_DIGITS];
|
||||
u64 hash[ECC_MAX_DIGITS];
|
||||
u64 r[ECC_MAX_DIGITS];
|
||||
u64 s[ECC_MAX_DIGITS];
|
||||
|
||||
ecc_point p;
|
||||
|
||||
ecc_bytes2native(pri, prikey, sm2_curve.ndigits);
|
||||
ecc_bytes2native(hash, hash_, sm2_curve.ndigits);
|
||||
|
||||
vli_get_random((u8 *) random, ECC_NUMWORD);
|
||||
if (vli_is_zero(random, sm2_curve.ndigits)) {
|
||||
/* The random number must not be 0. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
vli_set(k, random, sm2_curve.ndigits);
|
||||
if (vli_cmp(sm2_curve.n, k, sm2_curve.ndigits) != 1) { vli_sub(k, k, sm2_curve.n, sm2_curve.ndigits); }
|
||||
|
||||
/* tmp = k * G */
|
||||
ecc_point_mult(&sm2_curve, &p, &sm2_curve.g, k, NULL);
|
||||
|
||||
/* r = x1 + e (mod n) */
|
||||
vli_mod_add(r, p.x, hash, sm2_curve.n, sm2_curve.ndigits);
|
||||
if (vli_cmp(sm2_curve.n, r, sm2_curve.ndigits) != 1) { vli_sub(r, r, sm2_curve.n, sm2_curve.ndigits); }
|
||||
|
||||
if (vli_is_zero(r, sm2_curve.ndigits)) {
|
||||
/* If r == 0, fail (need a different random number). */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* s = r*d */
|
||||
vli_mod_mult(s, r, pri, sm2_curve.n, sm2_curve.ndigits);
|
||||
/* k-r*d */
|
||||
vli_mod_sub(s, k, s, sm2_curve.n, sm2_curve.ndigits);
|
||||
/* 1+d */
|
||||
vli_mod_add(pri, pri, one, sm2_curve.n, sm2_curve.ndigits);
|
||||
/* (1+d)' */
|
||||
vli_mod_inv(pri, pri, sm2_curve.n, sm2_curve.ndigits);
|
||||
/* (1+d)'*(k-r*d) */
|
||||
vli_mod_mult(s, pri, s, sm2_curve.n, sm2_curve.ndigits);
|
||||
|
||||
ecc_native2bytes(r_, r, sm2_curve.ndigits);
|
||||
ecc_native2bytes(s_, s, sm2_curve.ndigits);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
sm2_verify(ecc_point *pubkey, u8 *hash_, u8 *r_, u8 *s_)
|
||||
{
|
||||
ecc_point result;
|
||||
ecc_point pub[1];
|
||||
u64 t[ECC_MAX_DIGITS];
|
||||
u64 r[ECC_MAX_DIGITS];
|
||||
u64 s[ECC_MAX_DIGITS];
|
||||
u64 hash[ECC_MAX_DIGITS];
|
||||
|
||||
ecc_bytes2native(pub->x, pubkey->x, sm2_curve.ndigits);
|
||||
ecc_bytes2native(pub->y, pubkey->y, sm2_curve.ndigits);
|
||||
ecc_bytes2native(r, r_, sm2_curve.ndigits);
|
||||
ecc_bytes2native(s, s_, sm2_curve.ndigits);
|
||||
ecc_bytes2native(hash, hash_, sm2_curve.ndigits);
|
||||
|
||||
if (vli_is_zero(r, sm2_curve.ndigits) || vli_is_zero(s, sm2_curve.ndigits)) {
|
||||
/* r, s must not be 0. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (vli_cmp(sm2_curve.n, r, sm2_curve.ndigits) != 1 || vli_cmp(sm2_curve.n, s, sm2_curve.ndigits) != 1) {
|
||||
/* r, s must be < n. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
vli_mod_add(t, r, s, sm2_curve.n, sm2_curve.ndigits);// r + s
|
||||
if (t == 0) return -1;
|
||||
|
||||
ecc_point_mult2(&sm2_curve, &result, &sm2_curve.g, pub, s, t);
|
||||
|
||||
/* v = x1 + e (mod n) */
|
||||
vli_mod_add(result.x, result.x, hash, sm2_curve.n, sm2_curve.ndigits);
|
||||
|
||||
if (vli_cmp(sm2_curve.n, result.x, sm2_curve.ndigits) != 1) {
|
||||
vli_sub(result.x, result.x, sm2_curve.n, sm2_curve.ndigits);
|
||||
}
|
||||
|
||||
/* Accept only if v == r. */
|
||||
return vli_cmp(result.x, r, sm2_curve.ndigits);
|
||||
}
|
||||
|
||||
int
|
||||
sm2_shared_point(u8 *selfPriKey,
|
||||
u8 *selfTempPriKey,
|
||||
ecc_point *selfTempPubKey,
|
||||
ecc_point *otherPubKey,
|
||||
ecc_point *otherTempPubKey,
|
||||
ecc_point *key)
|
||||
{
|
||||
ecc_point selfTempPub;
|
||||
ecc_point otherTempPub;
|
||||
ecc_point otherPub;
|
||||
ecc_point U[1];
|
||||
|
||||
u64 selfTempPri[ECC_MAX_DIGITS];
|
||||
u64 selfPri[ECC_MAX_DIGITS];
|
||||
u64 temp1[ECC_MAX_DIGITS];
|
||||
u64 temp2[ECC_MAX_DIGITS];
|
||||
u64 tA[ECC_MAX_DIGITS];
|
||||
|
||||
ecc_bytes2native(selfTempPri, selfTempPriKey, sm2_curve.ndigits);
|
||||
ecc_bytes2native(selfPri, selfPriKey, sm2_curve.ndigits);
|
||||
ecc_bytes2native(selfTempPub.x, selfTempPubKey->x, sm2_curve.ndigits);
|
||||
ecc_bytes2native(selfTempPub.y, selfTempPubKey->y, sm2_curve.ndigits);
|
||||
ecc_bytes2native(otherTempPub.x, otherTempPubKey->x, sm2_curve.ndigits);
|
||||
ecc_bytes2native(otherTempPub.y, otherTempPubKey->y, sm2_curve.ndigits);
|
||||
ecc_bytes2native(otherPub.x, otherPubKey->x, sm2_curve.ndigits);
|
||||
ecc_bytes2native(otherPub.y, otherPubKey->y, sm2_curve.ndigits);
|
||||
|
||||
/***********x1_=2^w+x2 & (2^w-1)*************/
|
||||
sm2_w(temp1, selfTempPub.x);
|
||||
/***********tA=(dA+x1_*rA)mod n *************/
|
||||
vli_mod_mult(temp1, selfTempPri, temp1, sm2_curve.n, sm2_curve.ndigits);
|
||||
vli_mod_add(tA, selfPri, temp1, sm2_curve.n, sm2_curve.ndigits);
|
||||
/***********x2_=2^w+x2 & (2^w-1)*************/
|
||||
if (sm2_valid_public_key(&otherTempPub) != 0) return -1;
|
||||
sm2_w(temp2, otherTempPub.x);
|
||||
/**************U=[h*tA](PB+[x2_]RB)**********/
|
||||
/* U=[x2_]RB */
|
||||
ecc_point_mult(&sm2_curve, U, &otherTempPub, temp2, NULL);
|
||||
/*U=PB+U*/
|
||||
ecc_point_add(&sm2_curve, U, &otherPub, U);
|
||||
/*tA=tA*h */
|
||||
vli_mod_mult(tA, tA, sm2_curve.h, sm2_curve.n, sm2_curve.ndigits);
|
||||
ecc_point_mult(&sm2_curve, U, U, tA, NULL);
|
||||
|
||||
ecc_native2bytes(key->x, U->x, sm2_curve.ndigits);
|
||||
ecc_native2bytes(key->y, U->y, sm2_curve.ndigits);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sm2_shared_key(ecc_point *point, u8 *ZA, u8 *ZB, u32 keyLen, u8 *key)
|
||||
{
|
||||
u8 Z[ECC_NUMWORD * 4];
|
||||
memcpy(Z, point->x, ECC_NUMWORD);
|
||||
memcpy(Z + ECC_NUMWORD, point->y, ECC_NUMWORD);
|
||||
memcpy(Z + ECC_NUMWORD * 2, ZA, ECC_NUMWORD);
|
||||
memcpy(Z + ECC_NUMWORD * 3, ZB, ECC_NUMWORD);
|
||||
sm3_kdf(Z, ECC_NUMWORD * 4, key, keyLen);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****hash = Hash(Ux||ZA||ZB||x1||y1||x2||y2)****/
|
||||
int
|
||||
ECC_Key_ex_hash1(u8 *x, ecc_point *RA, ecc_point *RB, u8 ZA[], u8 ZB[], u8 *hash)
|
||||
{
|
||||
struct sm3_ctx md[1];
|
||||
|
||||
sm3_init(md);
|
||||
sm3_update(md, x, ECC_NUMWORD);
|
||||
sm3_update(md, ZA, ECC_NUMWORD);
|
||||
sm3_update(md, ZB, ECC_NUMWORD);
|
||||
sm3_update(md, (u8 *) RA->x, ECC_NUMWORD);
|
||||
sm3_update(md, (u8 *) RA->y, ECC_NUMWORD);
|
||||
sm3_update(md, (u8 *) RB->x, ECC_NUMWORD);
|
||||
sm3_update(md, (u8 *) RB->y, ECC_NUMWORD);
|
||||
sm3_final(md, (u8 *) hash);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****SA = Hash(temp||Uy||Hash)****/
|
||||
int
|
||||
ECC_Key_ex_hash2(u8 temp, u8 *y, u8 *hash, u8 *SA)
|
||||
{
|
||||
struct sm3_ctx md[1];
|
||||
|
||||
sm3_init(md);
|
||||
sm3_update(md, &temp, 1);
|
||||
sm3_update(md, y, ECC_NUMWORD);
|
||||
sm3_update(md, hash, ECC_NUMWORD);
|
||||
sm3_final(md, SA);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ECC_KeyEx_Init_I(u8 *pri, ecc_point *pub)
|
||||
{
|
||||
return sm2_make_pubkey(pri, pub);
|
||||
}
|
||||
|
||||
int
|
||||
ECC_KeyEx_Re_I(u8 *rb,
|
||||
u8 *dB,
|
||||
ecc_point *RA,
|
||||
ecc_point *PA,
|
||||
u8 *ZA,
|
||||
u8 *ZB,
|
||||
u8 *K,
|
||||
u32 klen,
|
||||
ecc_point *RB,
|
||||
ecc_point *V,
|
||||
u8 *SB)
|
||||
{
|
||||
u8 Z[ECC_NUMWORD * 2 + ECC_NUMBITS / 4] = {0};
|
||||
u8 hash[ECC_NUMWORD], S1[ECC_NUMWORD];
|
||||
u8 temp = 0x02;
|
||||
|
||||
//--------B2: RB=[rb]G=(x2,y2)--------
|
||||
sm2_make_pubkey(rb, RB);
|
||||
/********************************************/
|
||||
sm2_shared_point(dB, rb, RB, PA, RA, V);
|
||||
//------------B7:KB=KDF(VX,VY,ZA,ZB,KLEN)----------
|
||||
memcpy(Z, V->x, ECC_NUMWORD);
|
||||
memcpy(Z + ECC_NUMWORD, (u8 *) V->y, ECC_NUMWORD);
|
||||
memcpy(Z + ECC_NUMWORD * 2, ZA, ECC_NUMWORD);
|
||||
memcpy(Z + ECC_NUMWORD * 3, ZB, ECC_NUMWORD);
|
||||
sm3_kdf(Z, ECC_NUMWORD * 4, K, klen);
|
||||
//---------------B8:(optional) SB=hash(0x02||Vy||HASH(Vx||ZA||ZB||x1||y1||x2||y2)-------------
|
||||
ECC_Key_ex_hash1((u8 *) V->x, RA, RB, ZA, ZB, hash);
|
||||
ECC_Key_ex_hash2(temp, (u8 *) V->y, hash, SB);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ECC_KeyEx_Init_II(u8 *ra,
|
||||
u8 *dA,
|
||||
ecc_point *RA,
|
||||
ecc_point *RB,
|
||||
ecc_point *PB,
|
||||
u8 ZA[],
|
||||
u8 ZB[],
|
||||
u8 SB[],
|
||||
u8 K[],
|
||||
u32 klen,
|
||||
u8 SA[])
|
||||
{
|
||||
u8 Z[ECC_NUMWORD * 2 + ECC_NUMWORD * 2] = {0};
|
||||
u8 hash[ECC_NUMWORD], S1[ECC_NUMWORD];
|
||||
u8 temp[2] = {0x02, 0x03};
|
||||
ecc_point U[1];
|
||||
|
||||
/********************************************/
|
||||
sm2_shared_point(dA, ra, RA, PB, RB, U);
|
||||
/************KA=KDF(UX,UY,ZA,ZB,KLEN)**********/
|
||||
memcpy(Z, U->x, ECC_NUMWORD);
|
||||
memcpy(Z + ECC_NUMWORD, U->y, ECC_NUMWORD);
|
||||
memcpy(Z + ECC_NUMWORD * 2, ZA, ECC_NUMWORD);
|
||||
memcpy(Z + ECC_NUMWORD * 2 + ECC_NUMWORD, ZB, ECC_NUMWORD);
|
||||
sm3_kdf(Z, ECC_NUMWORD * 2 + ECC_NUMWORD * 2, K, klen);
|
||||
/****S1 = Hash(0x02||Uy||Hash(Ux||ZA||ZB||x1||y1||x2||y2))****/
|
||||
ECC_Key_ex_hash1((u8 *) U->x, RA, RB, ZA, ZB, hash);
|
||||
ECC_Key_ex_hash2(temp[0], (u8 *) U->y, hash, S1);
|
||||
/*test S1=SB?*/
|
||||
if (memcmp(S1, SB, ECC_NUMWORD) != 0) return -1;
|
||||
/*SA = Hash(0x03||yU||Hash(xU||ZA||ZB||x1||y1||x2||y2)) */
|
||||
ECC_Key_ex_hash2(temp[1], (u8 *) U->y, hash, SA);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ECC_KeyEx_Re_II(ecc_point *V, ecc_point *RA, ecc_point *RB, u8 ZA[], u8 ZB[], u8 SA[])
|
||||
{
|
||||
u8 hash[ECC_NUMWORD];
|
||||
u8 S2[ECC_NUMWORD];
|
||||
u8 temp = 0x03;
|
||||
|
||||
/*S2 = Hash(0x03||Vy||Hash(Vx||ZA||ZB||x1||y1||x2||y2))*/
|
||||
ECC_Key_ex_hash1((u8 *) V->x, RA, RB, ZA, ZB, hash);
|
||||
ECC_Key_ex_hash2(temp, (u8 *) V->y, hash, S2);
|
||||
|
||||
if (memcmp(S2, SA, ECC_NUMWORD) != 0) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
do_sm2_verify(char *pubkey, char *data_addr, int data_len, char *sign_addr)
|
||||
{
|
||||
int ret = -1;
|
||||
struct sm3_ctx sm3_ctx;
|
||||
unsigned char ios_hash[32];
|
||||
u8 ios_Z[ECC_NUMWORD];
|
||||
ecc_point ios_pub;
|
||||
unsigned char sign_data[64];
|
||||
|
||||
memcpy(&ios_pub, pubkey, 64);
|
||||
|
||||
ret = sm3_init(&sm3_ctx);
|
||||
sm3_z((u8 *) "1234567812345678", 16, &ios_pub, ios_Z);
|
||||
sm3_update(&sm3_ctx, ios_Z, ECC_NUMWORD);
|
||||
sm3_update(&sm3_ctx, (const u8 *) data_addr, data_len);
|
||||
sm3_final(&sm3_ctx, ios_hash);
|
||||
memcpy(sign_data, sign_addr, 64);
|
||||
|
||||
ret = sm2_verify((ecc_point *) pubkey, ios_hash, sign_data, sign_data + 32);
|
||||
if (ret) {
|
||||
printf("verify err ret = %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
do_sm2_sign(char *prikey, char *pubkey, char *data_addr, int data_len, char *sign_addr)
|
||||
{
|
||||
int ret = -1;
|
||||
struct sm3_ctx sm3_ctx;
|
||||
unsigned char ios_hash[32];
|
||||
u8 ios_Z[ECC_NUMWORD];
|
||||
ecc_point ios_pub;
|
||||
unsigned char sign_data[64];
|
||||
|
||||
memcpy(&ios_pub, pubkey, 64);
|
||||
|
||||
ret = sm3_init(&sm3_ctx);
|
||||
sm3_z((u8 *) "1234567812345678", 16, &ios_pub, ios_Z);
|
||||
sm3_update(&sm3_ctx, ios_Z, ECC_NUMWORD);
|
||||
sm3_update(&sm3_ctx, data_addr, data_len);
|
||||
sm3_final(&sm3_ctx, ios_hash);
|
||||
//hexdump("hash", ios_hash, 32);
|
||||
|
||||
ret = sm2_sign(sign_data, sign_data + 32, prikey, ios_hash);
|
||||
if (ret) {
|
||||
printf("sign err ret = %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
memcpy(sign_addr, sign_data, 64);
|
||||
|
||||
return 0;
|
||||
}
|
39
AWSMServer/src/sm2sm3_enc/sm2.h
Normal file
39
AWSMServer/src/sm2sm3_enc/sm2.h
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef _SM2_H_
|
||||
#define _SM2_H_
|
||||
|
||||
#include "ecc.h"
|
||||
#include "typedef.h"
|
||||
|
||||
int vli_get_random(u8 *data, u32 len);
|
||||
|
||||
int sm2_make_prikey(u8 *prikey);
|
||||
int sm2_make_pubkey(u8 *prikey, ecc_point *pubkey);
|
||||
int sm2_make_keypair(u8 *prikey, ecc_point *pubkey);
|
||||
int sm2_sign(u8 *r, u8 *s, u8 *pri, u8 *hash);
|
||||
static int sm2_verify(ecc_point *pubkey, u8 *hash, u8 *r, u8 *s);
|
||||
|
||||
int sm2_encrypt(ecc_point *pubKey, u8 *M, u32 Mlen, u8 *C, u32 *Clen);
|
||||
int sm2_decrypt(u8 *prikey, u8 *C, u32 Clen, u8 *M, u32 *Mlen);
|
||||
|
||||
static void sm3_z(u8 *id, u32 idlen, ecc_point *pub, u8 *hash);
|
||||
int sm2_shared_point(u8 *selfPriKey, u8 *selfTempPriKey,
|
||||
ecc_point *selfTempPubKey, ecc_point *otherPubKey,
|
||||
ecc_point *otherTempPubKey, ecc_point *key);
|
||||
int sm2_shared_key(ecc_point *point, u8 *ZA, u8 *ZB, u32 keyLen, u8 *key);
|
||||
int sm2_point_mult(ecc_point *G, u8 *k, ecc_point *P);
|
||||
|
||||
int ECC_KeyEx_Init_I(u8 *pri, ecc_point *pub);
|
||||
|
||||
int ECC_KeyEx_Re_I(u8 *rb, u8 *dB, ecc_point *RA, ecc_point *PA, u8 *ZA, u8 *ZB,
|
||||
u8 *K, u32 klen, ecc_point *RB, ecc_point *V, u8 *hash);
|
||||
|
||||
int ECC_KeyEx_Init_II(u8 *ra, u8 *dA, ecc_point *RA, ecc_point *RB,
|
||||
ecc_point *PB, u8 ZA[], u8 ZB[], u8 SB[], u8 K[],
|
||||
u32 klen, u8 SA[]);
|
||||
|
||||
int ECC_KeyEx_Re_II(ecc_point *V, ecc_point *RA, ecc_point *RB, u8 ZA[],
|
||||
u8 ZB[], u8 SA[]);
|
||||
int do_sm2_sign(char *prikey, char *pubkey, char *data_addr, int data_len,
|
||||
char *sign_addr);
|
||||
|
||||
#endif /* _SM2_H_ */
|
248
AWSMServer/src/sm2sm3_enc/sm3.c
Normal file
248
AWSMServer/src/sm2sm3_enc/sm3.c
Normal file
@ -0,0 +1,248 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "typedef.h"
|
||||
#include "sm3.h"
|
||||
|
||||
/*
|
||||
* 32-bit integer manipulation macros (big endian)
|
||||
*/
|
||||
#ifndef GET_ULONG_BE
|
||||
#define GET_ULONG_BE(n,b,i) \
|
||||
{ \
|
||||
(n) = ( (u32) (b)[(i) ] << 24 ) \
|
||||
| ( (u32) (b)[(i) + 1] << 16 ) \
|
||||
| ( (u32) (b)[(i) + 2] << 8 ) \
|
||||
| ( (u32) (b)[(i) + 3] ); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PUT_ULONG_BE
|
||||
#define PUT_ULONG_BE(n,b,i) \
|
||||
{ \
|
||||
(b)[(i) ] = (u8) ( (n) >> 24 ); \
|
||||
(b)[(i) + 1] = (u8) ( (n) >> 16 ); \
|
||||
(b)[(i) + 2] = (u8) ( (n) >> 8 ); \
|
||||
(b)[(i) + 3] = (u8) ( (n) ); \
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SM3 context setup
|
||||
*/
|
||||
int sm3_init(struct sm3_ctx *ctx)
|
||||
{
|
||||
ctx->total[0] = 0;
|
||||
ctx->total[1] = 0;
|
||||
|
||||
ctx->state[0] = 0x7380166F;
|
||||
ctx->state[1] = 0x4914B2B9;
|
||||
ctx->state[2] = 0x172442D7;
|
||||
ctx->state[3] = 0xDA8A0600;
|
||||
ctx->state[4] = 0xA96F30BC;
|
||||
ctx->state[5] = 0x163138AA;
|
||||
ctx->state[6] = 0xE38DEE4D;
|
||||
ctx->state[7] = 0xB0FB0E4E;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sm3_process(struct sm3_ctx *ctx, u8 data[64])
|
||||
{
|
||||
u32 SS1, SS2, TT1, TT2, W[68],W1[64];
|
||||
u32 A, B, C, D, E, F, G, H;
|
||||
u32 T[64];
|
||||
u32 Temp1,Temp2,Temp3,Temp4,Temp5;
|
||||
int j;
|
||||
|
||||
for(j = 0; j < 16; j++)
|
||||
T[j] = 0x79CC4519;
|
||||
for(j =16; j < 64; j++)
|
||||
T[j] = 0x7A879D8A;
|
||||
|
||||
GET_ULONG_BE( W[ 0], data, 0 );
|
||||
GET_ULONG_BE( W[ 1], data, 4 );
|
||||
GET_ULONG_BE( W[ 2], data, 8 );
|
||||
GET_ULONG_BE( W[ 3], data, 12 );
|
||||
GET_ULONG_BE( W[ 4], data, 16 );
|
||||
GET_ULONG_BE( W[ 5], data, 20 );
|
||||
GET_ULONG_BE( W[ 6], data, 24 );
|
||||
GET_ULONG_BE( W[ 7], data, 28 );
|
||||
GET_ULONG_BE( W[ 8], data, 32 );
|
||||
GET_ULONG_BE( W[ 9], data, 36 );
|
||||
GET_ULONG_BE( W[10], data, 40 );
|
||||
GET_ULONG_BE( W[11], data, 44 );
|
||||
GET_ULONG_BE( W[12], data, 48 );
|
||||
GET_ULONG_BE( W[13], data, 52 );
|
||||
GET_ULONG_BE( W[14], data, 56 );
|
||||
GET_ULONG_BE( W[15], data, 60 );
|
||||
|
||||
#define FF0(x,y,z) ( (x) ^ (y) ^ (z))
|
||||
#define FF1(x,y,z) (((x) & (y)) | ( (x) & (z)) | ( (y) & (z)))
|
||||
|
||||
#define GG0(x,y,z) ( (x) ^ (y) ^ (z))
|
||||
#define GG1(x,y,z) (((x) & (y)) | ( (~(x)) & (z)) )
|
||||
|
||||
|
||||
#define SHL(x,n) (((x) & 0xFFFFFFFF) << n)
|
||||
#define ROTL(x,n) (SHL((x),n) | ((x) >> (32 - n)))
|
||||
//#define ROTL(x,n) (SHL((x),n) | ((x) >> (32 - n%32)))
|
||||
|
||||
#define P0(x) ((x) ^ ROTL((x),9) ^ ROTL((x),17))
|
||||
#define P1(x) ((x) ^ ROTL((x),15) ^ ROTL((x),23))
|
||||
|
||||
for(j = 16; j < 68; j++ )
|
||||
{
|
||||
//W[j] = P1( W[j-16] ^ W[j-9] ^ ROTL(W[j-3],15)) ^ ROTL(W[j - 13],7 ) ^ W[j-6];
|
||||
//Why thd release's result is different with the debug's ?
|
||||
//Below is okay. Interesting, Perhaps VC6 has a bug of Optimizaiton.
|
||||
|
||||
Temp1 = W[j-16] ^ W[j-9];
|
||||
Temp2 = ROTL(W[j-3],15);
|
||||
Temp3 = Temp1 ^ Temp2;
|
||||
Temp4 = P1(Temp3);
|
||||
Temp5 = ROTL(W[j - 13],7 ) ^ W[j-6];
|
||||
W[j] = Temp4 ^ Temp5;
|
||||
}
|
||||
|
||||
for(j = 0; j < 64; j++)
|
||||
{
|
||||
W1[j] = W[j] ^ W[j+4];
|
||||
}
|
||||
|
||||
A = ctx->state[0];
|
||||
B = ctx->state[1];
|
||||
C = ctx->state[2];
|
||||
D = ctx->state[3];
|
||||
E = ctx->state[4];
|
||||
F = ctx->state[5];
|
||||
G = ctx->state[6];
|
||||
H = ctx->state[7];
|
||||
|
||||
for(j =0; j < 16; j++)
|
||||
{
|
||||
SS1 = ROTL((ROTL(A,12) + E + ROTL(T[j],j)), 7);
|
||||
SS2 = SS1 ^ ROTL(A,12);
|
||||
TT1 = FF0(A,B,C) + D + SS2 + W1[j];
|
||||
TT2 = GG0(E,F,G) + H + SS1 + W[j];
|
||||
D = C;
|
||||
C = ROTL(B,9);
|
||||
B = A;
|
||||
A = TT1;
|
||||
H = G;
|
||||
G = ROTL(F,19);
|
||||
F = E;
|
||||
E = P0(TT2);
|
||||
}
|
||||
|
||||
for(j =16; j < 64; j++)
|
||||
{
|
||||
SS1 = ROTL((ROTL(A,12) + E + ROTL(T[j],j)), 7);
|
||||
SS2 = SS1 ^ ROTL(A,12);
|
||||
TT1 = FF1(A,B,C) + D + SS2 + W1[j];
|
||||
TT2 = GG1(E,F,G) + H + SS1 + W[j];
|
||||
D = C;
|
||||
C = ROTL(B,9);
|
||||
B = A;
|
||||
A = TT1;
|
||||
H = G;
|
||||
G = ROTL(F,19);
|
||||
F = E;
|
||||
E = P0(TT2);
|
||||
}
|
||||
|
||||
ctx->state[0] ^= A;
|
||||
ctx->state[1] ^= B;
|
||||
ctx->state[2] ^= C;
|
||||
ctx->state[3] ^= D;
|
||||
ctx->state[4] ^= E;
|
||||
ctx->state[5] ^= F;
|
||||
ctx->state[6] ^= G;
|
||||
ctx->state[7] ^= H;
|
||||
}
|
||||
|
||||
/*
|
||||
* SM3 process buffer
|
||||
*/
|
||||
int sm3_update(struct sm3_ctx *ctx, const u8 *input, u32 ilen)
|
||||
{
|
||||
u32 left;
|
||||
int fill;
|
||||
|
||||
if( ilen <= 0 )
|
||||
return -1;
|
||||
|
||||
left = ctx->total[0] & 0x3F;
|
||||
fill = 64 - left;
|
||||
|
||||
ctx->total[0] += ilen;
|
||||
ctx->total[0] &= 0xFFFFFFFF;
|
||||
|
||||
if( ctx->total[0] < (u32) ilen )
|
||||
ctx->total[1]++;
|
||||
|
||||
if( left && ilen >= fill )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left),
|
||||
(void *) input, fill );
|
||||
sm3_process( ctx, ctx->buffer );
|
||||
input += fill;
|
||||
ilen -= fill;
|
||||
left = 0;
|
||||
}
|
||||
|
||||
while( ilen >= 64 )
|
||||
{
|
||||
sm3_process( ctx, (u8*)input );
|
||||
input += 64;
|
||||
ilen -= 64;
|
||||
}
|
||||
|
||||
if( ilen > 0 )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left),
|
||||
(void *) input, ilen );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u8 sm3_padding[64] =
|
||||
{
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/*
|
||||
* SM3 final digest
|
||||
*/
|
||||
int sm3_final(struct sm3_ctx *ctx, u8 *output)
|
||||
{
|
||||
u32 last, padn;
|
||||
u32 high, low;
|
||||
u8 msglen[8];
|
||||
|
||||
high = ( ctx->total[0] >> 29 )
|
||||
| ( ctx->total[1] << 3 );
|
||||
low = ( ctx->total[0] << 3 );
|
||||
|
||||
PUT_ULONG_BE( high, msglen, 0 );
|
||||
PUT_ULONG_BE( low, msglen, 4 );
|
||||
|
||||
last = ctx->total[0] & 0x3F;
|
||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||
|
||||
sm3_update(ctx, (const u8 *)sm3_padding, padn );
|
||||
sm3_update(ctx, msglen, 8 );
|
||||
|
||||
PUT_ULONG_BE( ctx->state[0], output, 0 );
|
||||
PUT_ULONG_BE( ctx->state[1], output, 4 );
|
||||
PUT_ULONG_BE( ctx->state[2], output, 8 );
|
||||
PUT_ULONG_BE( ctx->state[3], output, 12 );
|
||||
PUT_ULONG_BE( ctx->state[4], output, 16 );
|
||||
PUT_ULONG_BE( ctx->state[5], output, 20 );
|
||||
PUT_ULONG_BE( ctx->state[6], output, 24 );
|
||||
PUT_ULONG_BE( ctx->state[7], output, 28 );
|
||||
|
||||
return 0;
|
||||
}
|
20
AWSMServer/src/sm2sm3_enc/sm3.h
Normal file
20
AWSMServer/src/sm2sm3_enc/sm3.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef _SM3_H_
|
||||
#define _SM3_H_
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
#define SM3_DATA_LEN 32
|
||||
|
||||
struct sm3_ctx {
|
||||
u32 total[2]; /*!< number of bytes processed */
|
||||
u32 state[8]; /*!< intermediate digest state */
|
||||
u8 buffer[64]; /*!< data block being processed */
|
||||
u8 ipad[64]; /*!< HMAC: inner padding */
|
||||
u8 opad[64]; /*!< HMAC: outer padding */
|
||||
};
|
||||
|
||||
int sm3_init(struct sm3_ctx *ctx);
|
||||
int sm3_update(struct sm3_ctx *ctx, const u8 *input, u32 ilen);
|
||||
int sm3_final(struct sm3_ctx *ctx, u8 *output);
|
||||
|
||||
#endif /* _SM3_H_ */
|
356
AWSMServer/src/sm2sm3_enc/sm4_enc.c
Normal file
356
AWSMServer/src/sm2sm3_enc/sm4_enc.c
Normal file
@ -0,0 +1,356 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define SM4_KEY_SCHEDULE 32
|
||||
|
||||
typedef struct SM4_KEY_st {
|
||||
unsigned int rk[SM4_KEY_SCHEDULE];
|
||||
} SM4_KEY;
|
||||
|
||||
typedef void (*block128_f) (const unsigned char in[16],
|
||||
unsigned char out[16], const void *key);
|
||||
|
||||
static const unsigned char SM4_S[256] = {
|
||||
0xD6, 0x90, 0xE9, 0xFE, 0xCC, 0xE1, 0x3D, 0xB7, 0x16, 0xB6, 0x14, 0xC2,
|
||||
0x28, 0xFB, 0x2C, 0x05, 0x2B, 0x67, 0x9A, 0x76, 0x2A, 0xBE, 0x04, 0xC3,
|
||||
0xAA, 0x44, 0x13, 0x26, 0x49, 0x86, 0x06, 0x99, 0x9C, 0x42, 0x50, 0xF4,
|
||||
0x91, 0xEF, 0x98, 0x7A, 0x33, 0x54, 0x0B, 0x43, 0xED, 0xCF, 0xAC, 0x62,
|
||||
0xE4, 0xB3, 0x1C, 0xA9, 0xC9, 0x08, 0xE8, 0x95, 0x80, 0xDF, 0x94, 0xFA,
|
||||
0x75, 0x8F, 0x3F, 0xA6, 0x47, 0x07, 0xA7, 0xFC, 0xF3, 0x73, 0x17, 0xBA,
|
||||
0x83, 0x59, 0x3C, 0x19, 0xE6, 0x85, 0x4F, 0xA8, 0x68, 0x6B, 0x81, 0xB2,
|
||||
0x71, 0x64, 0xDA, 0x8B, 0xF8, 0xEB, 0x0F, 0x4B, 0x70, 0x56, 0x9D, 0x35,
|
||||
0x1E, 0x24, 0x0E, 0x5E, 0x63, 0x58, 0xD1, 0xA2, 0x25, 0x22, 0x7C, 0x3B,
|
||||
0x01, 0x21, 0x78, 0x87, 0xD4, 0x00, 0x46, 0x57, 0x9F, 0xD3, 0x27, 0x52,
|
||||
0x4C, 0x36, 0x02, 0xE7, 0xA0, 0xC4, 0xC8, 0x9E, 0xEA, 0xBF, 0x8A, 0xD2,
|
||||
0x40, 0xC7, 0x38, 0xB5, 0xA3, 0xF7, 0xF2, 0xCE, 0xF9, 0x61, 0x15, 0xA1,
|
||||
0xE0, 0xAE, 0x5D, 0xA4, 0x9B, 0x34, 0x1A, 0x55, 0xAD, 0x93, 0x32, 0x30,
|
||||
0xF5, 0x8C, 0xB1, 0xE3, 0x1D, 0xF6, 0xE2, 0x2E, 0x82, 0x66, 0xCA, 0x60,
|
||||
0xC0, 0x29, 0x23, 0xAB, 0x0D, 0x53, 0x4E, 0x6F, 0xD5, 0xDB, 0x37, 0x45,
|
||||
0xDE, 0xFD, 0x8E, 0x2F, 0x03, 0xFF, 0x6A, 0x72, 0x6D, 0x6C, 0x5B, 0x51,
|
||||
0x8D, 0x1B, 0xAF, 0x92, 0xBB, 0xDD, 0xBC, 0x7F, 0x11, 0xD9, 0x5C, 0x41,
|
||||
0x1F, 0x10, 0x5A, 0xD8, 0x0A, 0xC1, 0x31, 0x88, 0xA5, 0xCD, 0x7B, 0xBD,
|
||||
0x2D, 0x74, 0xD0, 0x12, 0xB8, 0xE5, 0xB4, 0xB0, 0x89, 0x69, 0x97, 0x4A,
|
||||
0x0C, 0x96, 0x77, 0x7E, 0x65, 0xB9, 0xF1, 0x09, 0xC5, 0x6E, 0xC6, 0x84,
|
||||
0x18, 0xF0, 0x7D, 0xEC, 0x3A, 0xDC, 0x4D, 0x20, 0x79, 0xEE, 0x5F, 0x3E,
|
||||
0xD7, 0xCB, 0x39, 0x48
|
||||
};
|
||||
|
||||
/*
|
||||
* SM4_SBOX_T[j] == L(SM4_SBOX[j]).
|
||||
*/
|
||||
static const unsigned int SM4_SBOX_T[256] = {
|
||||
0x8ED55B5B, 0xD0924242, 0x4DEAA7A7, 0x06FDFBFB, 0xFCCF3333, 0x65E28787,
|
||||
0xC93DF4F4, 0x6BB5DEDE, 0x4E165858, 0x6EB4DADA, 0x44145050, 0xCAC10B0B,
|
||||
0x8828A0A0, 0x17F8EFEF, 0x9C2CB0B0, 0x11051414, 0x872BACAC, 0xFB669D9D,
|
||||
0xF2986A6A, 0xAE77D9D9, 0x822AA8A8, 0x46BCFAFA, 0x14041010, 0xCFC00F0F,
|
||||
0x02A8AAAA, 0x54451111, 0x5F134C4C, 0xBE269898, 0x6D482525, 0x9E841A1A,
|
||||
0x1E061818, 0xFD9B6666, 0xEC9E7272, 0x4A430909, 0x10514141, 0x24F7D3D3,
|
||||
0xD5934646, 0x53ECBFBF, 0xF89A6262, 0x927BE9E9, 0xFF33CCCC, 0x04555151,
|
||||
0x270B2C2C, 0x4F420D0D, 0x59EEB7B7, 0xF3CC3F3F, 0x1CAEB2B2, 0xEA638989,
|
||||
0x74E79393, 0x7FB1CECE, 0x6C1C7070, 0x0DABA6A6, 0xEDCA2727, 0x28082020,
|
||||
0x48EBA3A3, 0xC1975656, 0x80820202, 0xA3DC7F7F, 0xC4965252, 0x12F9EBEB,
|
||||
0xA174D5D5, 0xB38D3E3E, 0xC33FFCFC, 0x3EA49A9A, 0x5B461D1D, 0x1B071C1C,
|
||||
0x3BA59E9E, 0x0CFFF3F3, 0x3FF0CFCF, 0xBF72CDCD, 0x4B175C5C, 0x52B8EAEA,
|
||||
0x8F810E0E, 0x3D586565, 0xCC3CF0F0, 0x7D196464, 0x7EE59B9B, 0x91871616,
|
||||
0x734E3D3D, 0x08AAA2A2, 0xC869A1A1, 0xC76AADAD, 0x85830606, 0x7AB0CACA,
|
||||
0xB570C5C5, 0xF4659191, 0xB2D96B6B, 0xA7892E2E, 0x18FBE3E3, 0x47E8AFAF,
|
||||
0x330F3C3C, 0x674A2D2D, 0xB071C1C1, 0x0E575959, 0xE99F7676, 0xE135D4D4,
|
||||
0x661E7878, 0xB4249090, 0x360E3838, 0x265F7979, 0xEF628D8D, 0x38596161,
|
||||
0x95D24747, 0x2AA08A8A, 0xB1259494, 0xAA228888, 0x8C7DF1F1, 0xD73BECEC,
|
||||
0x05010404, 0xA5218484, 0x9879E1E1, 0x9B851E1E, 0x84D75353, 0x00000000,
|
||||
0x5E471919, 0x0B565D5D, 0xE39D7E7E, 0x9FD04F4F, 0xBB279C9C, 0x1A534949,
|
||||
0x7C4D3131, 0xEE36D8D8, 0x0A020808, 0x7BE49F9F, 0x20A28282, 0xD4C71313,
|
||||
0xE8CB2323, 0xE69C7A7A, 0x42E9ABAB, 0x43BDFEFE, 0xA2882A2A, 0x9AD14B4B,
|
||||
0x40410101, 0xDBC41F1F, 0xD838E0E0, 0x61B7D6D6, 0x2FA18E8E, 0x2BF4DFDF,
|
||||
0x3AF1CBCB, 0xF6CD3B3B, 0x1DFAE7E7, 0xE5608585, 0x41155454, 0x25A38686,
|
||||
0x60E38383, 0x16ACBABA, 0x295C7575, 0x34A69292, 0xF7996E6E, 0xE434D0D0,
|
||||
0x721A6868, 0x01545555, 0x19AFB6B6, 0xDF914E4E, 0xFA32C8C8, 0xF030C0C0,
|
||||
0x21F6D7D7, 0xBC8E3232, 0x75B3C6C6, 0x6FE08F8F, 0x691D7474, 0x2EF5DBDB,
|
||||
0x6AE18B8B, 0x962EB8B8, 0x8A800A0A, 0xFE679999, 0xE2C92B2B, 0xE0618181,
|
||||
0xC0C30303, 0x8D29A4A4, 0xAF238C8C, 0x07A9AEAE, 0x390D3434, 0x1F524D4D,
|
||||
0x764F3939, 0xD36EBDBD, 0x81D65757, 0xB7D86F6F, 0xEB37DCDC, 0x51441515,
|
||||
0xA6DD7B7B, 0x09FEF7F7, 0xB68C3A3A, 0x932FBCBC, 0x0F030C0C, 0x03FCFFFF,
|
||||
0xC26BA9A9, 0xBA73C9C9, 0xD96CB5B5, 0xDC6DB1B1, 0x375A6D6D, 0x15504545,
|
||||
0xB98F3636, 0x771B6C6C, 0x13ADBEBE, 0xDA904A4A, 0x57B9EEEE, 0xA9DE7777,
|
||||
0x4CBEF2F2, 0x837EFDFD, 0x55114444, 0xBDDA6767, 0x2C5D7171, 0x45400505,
|
||||
0x631F7C7C, 0x50104040, 0x325B6969, 0xB8DB6363, 0x220A2828, 0xC5C20707,
|
||||
0xF531C4C4, 0xA88A2222, 0x31A79696, 0xF9CE3737, 0x977AEDED, 0x49BFF6F6,
|
||||
0x992DB4B4, 0xA475D1D1, 0x90D34343, 0x5A124848, 0x58BAE2E2, 0x71E69797,
|
||||
0x64B6D2D2, 0x70B2C2C2, 0xAD8B2626, 0xCD68A5A5, 0xCB955E5E, 0x624B2929,
|
||||
0x3C0C3030, 0xCE945A5A, 0xAB76DDDD, 0x867FF9F9, 0xF1649595, 0x5DBBE6E6,
|
||||
0x35F2C7C7, 0x2D092424, 0xD1C61717, 0xD66FB9B9, 0xDEC51B1B, 0x94861212,
|
||||
0x78186060, 0x30F3C3C3, 0x897CF5F5, 0x5CEFB3B3, 0xD23AE8E8, 0xACDF7373,
|
||||
0x794C3535, 0xA0208080, 0x9D78E5E5, 0x56EDBBBB, 0x235E7D7D, 0xC63EF8F8,
|
||||
0x8BD45F5F, 0xE7C82F2F, 0xDD39E4E4, 0x68492121 };
|
||||
|
||||
static unsigned int rotl(unsigned int a, unsigned char n)
|
||||
{
|
||||
return (a << n) | (a >> (32 - n));
|
||||
}
|
||||
|
||||
static unsigned int load_u32_be(const unsigned char *b, unsigned int n)
|
||||
{
|
||||
return ((unsigned int)b[4 * n] << 24) |
|
||||
((unsigned int)b[4 * n + 1] << 16) |
|
||||
((unsigned int)b[4 * n + 2] << 8) |
|
||||
((unsigned int)b[4 * n + 3]);
|
||||
}
|
||||
|
||||
static void store_u32_be(unsigned int v, unsigned char *b)
|
||||
{
|
||||
b[0] = (unsigned char)(v >> 24);
|
||||
b[1] = (unsigned char)(v >> 16);
|
||||
b[2] = (unsigned char)(v >> 8);
|
||||
b[3] = (unsigned char)(v);
|
||||
}
|
||||
|
||||
static unsigned int SM4_T_slow(unsigned int X)
|
||||
{
|
||||
unsigned int t = 0;
|
||||
|
||||
t |= ((unsigned int)SM4_S[(unsigned char)(X >> 24)]) << 24;
|
||||
t |= ((unsigned int)SM4_S[(unsigned char)(X >> 16)]) << 16;
|
||||
t |= ((unsigned int)SM4_S[(unsigned char)(X >> 8)]) << 8;
|
||||
t |= SM4_S[(unsigned char)X];
|
||||
|
||||
/*
|
||||
* L linear transform
|
||||
*/
|
||||
return t ^ rotl(t, 2) ^ rotl(t, 10) ^ rotl(t, 18) ^ rotl(t, 24);
|
||||
}
|
||||
|
||||
static unsigned int SM4_T(unsigned int X)
|
||||
{
|
||||
return SM4_SBOX_T[(unsigned char)(X >> 24)] ^
|
||||
rotl(SM4_SBOX_T[(unsigned char)(X >> 16)], 24) ^
|
||||
rotl(SM4_SBOX_T[(unsigned char)(X >> 8)], 16) ^
|
||||
rotl(SM4_SBOX_T[(unsigned char)X], 8);
|
||||
}
|
||||
|
||||
static int SM4_set_key(const unsigned char *key, SM4_KEY *ks)
|
||||
{
|
||||
/*
|
||||
* Family Key
|
||||
*/
|
||||
static const unsigned int FK[4] =
|
||||
{ 0xa3b1bac6, 0x56aa3350, 0x677d9197, 0xb27022dc };
|
||||
|
||||
/*
|
||||
* Constant Key
|
||||
*/
|
||||
static const unsigned int CK[32] = {
|
||||
0x00070E15, 0x1C232A31, 0x383F464D, 0x545B6269,
|
||||
0x70777E85, 0x8C939AA1, 0xA8AFB6BD, 0xC4CBD2D9,
|
||||
0xE0E7EEF5, 0xFC030A11, 0x181F262D, 0x343B4249,
|
||||
0x50575E65, 0x6C737A81, 0x888F969D, 0xA4ABB2B9,
|
||||
0xC0C7CED5, 0xDCE3EAF1, 0xF8FF060D, 0x141B2229,
|
||||
0x30373E45, 0x4C535A61, 0x686F767D, 0x848B9299,
|
||||
0xA0A7AEB5, 0xBCC3CAD1, 0xD8DFE6ED, 0xF4FB0209,
|
||||
0x10171E25, 0x2C333A41, 0x484F565D, 0x646B7279
|
||||
};
|
||||
|
||||
unsigned int K[4];
|
||||
int i;
|
||||
|
||||
K[0] = load_u32_be(key, 0) ^ FK[0];
|
||||
K[1] = load_u32_be(key, 1) ^ FK[1];
|
||||
K[2] = load_u32_be(key, 2) ^ FK[2];
|
||||
K[3] = load_u32_be(key, 3) ^ FK[3];
|
||||
|
||||
for (i = 0; i != SM4_KEY_SCHEDULE; ++i) {
|
||||
unsigned int X = K[(i + 1) % 4] ^ K[(i + 2) % 4] ^ K[(i + 3) % 4] ^ CK[i];
|
||||
unsigned int t = 0;
|
||||
|
||||
t |= ((unsigned int)SM4_S[(unsigned char)(X >> 24)]) << 24;
|
||||
t |= ((unsigned int)SM4_S[(unsigned char)(X >> 16)]) << 16;
|
||||
t |= ((unsigned int)SM4_S[(unsigned char)(X >> 8)]) << 8;
|
||||
t |= SM4_S[(unsigned char)X];
|
||||
|
||||
t = t ^ rotl(t, 13) ^ rotl(t, 23);
|
||||
K[i % 4] ^= t;
|
||||
ks->rk[i] = K[i % 4];
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define SM4_RNDS(k0, k1, k2, k3, F) \
|
||||
do { \
|
||||
B0 ^= F(B1 ^ B2 ^ B3 ^ ks->rk[k0]); \
|
||||
B1 ^= F(B0 ^ B2 ^ B3 ^ ks->rk[k1]); \
|
||||
B2 ^= F(B0 ^ B1 ^ B3 ^ ks->rk[k2]); \
|
||||
B3 ^= F(B0 ^ B1 ^ B2 ^ ks->rk[k3]); \
|
||||
} while(0)
|
||||
|
||||
static void SM4_encrypt(const unsigned char *in, unsigned char *out, const SM4_KEY *ks)
|
||||
{
|
||||
unsigned int B0 = load_u32_be(in, 0);
|
||||
unsigned int B1 = load_u32_be(in, 1);
|
||||
unsigned int B2 = load_u32_be(in, 2);
|
||||
unsigned int B3 = load_u32_be(in, 3);
|
||||
|
||||
/*
|
||||
* Uses byte-wise sbox in the first and last rounds to provide some
|
||||
* protection from cache based side channels.
|
||||
*/
|
||||
SM4_RNDS( 0, 1, 2, 3, SM4_T_slow);
|
||||
SM4_RNDS( 4, 5, 6, 7, SM4_T);
|
||||
SM4_RNDS( 8, 9, 10, 11, SM4_T);
|
||||
SM4_RNDS(12, 13, 14, 15, SM4_T);
|
||||
SM4_RNDS(16, 17, 18, 19, SM4_T);
|
||||
SM4_RNDS(20, 21, 22, 23, SM4_T);
|
||||
SM4_RNDS(24, 25, 26, 27, SM4_T);
|
||||
SM4_RNDS(28, 29, 30, 31, SM4_T_slow);
|
||||
|
||||
store_u32_be(B3, out);
|
||||
store_u32_be(B2, out + 4);
|
||||
store_u32_be(B1, out + 8);
|
||||
store_u32_be(B0, out + 12);
|
||||
}
|
||||
|
||||
static void SM4_decrypt(const unsigned char *in, unsigned char *out, const SM4_KEY *ks)
|
||||
{
|
||||
unsigned int B0 = load_u32_be(in, 0);
|
||||
unsigned int B1 = load_u32_be(in, 1);
|
||||
unsigned int B2 = load_u32_be(in, 2);
|
||||
unsigned int B3 = load_u32_be(in, 3);
|
||||
|
||||
SM4_RNDS(31, 30, 29, 28, SM4_T_slow);
|
||||
SM4_RNDS(27, 26, 25, 24, SM4_T);
|
||||
SM4_RNDS(23, 22, 21, 20, SM4_T);
|
||||
SM4_RNDS(19, 18, 17, 16, SM4_T);
|
||||
SM4_RNDS(15, 14, 13, 12, SM4_T);
|
||||
SM4_RNDS(11, 10, 9, 8, SM4_T);
|
||||
SM4_RNDS( 7, 6, 5, 4, SM4_T);
|
||||
SM4_RNDS( 3, 2, 1, 0, SM4_T_slow);
|
||||
|
||||
store_u32_be(B3, out);
|
||||
store_u32_be(B2, out + 4);
|
||||
store_u32_be(B1, out + 8);
|
||||
store_u32_be(B0, out + 12);
|
||||
}
|
||||
|
||||
static void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16], int *num, block128_f block)
|
||||
{
|
||||
unsigned int n;
|
||||
size_t l = 0;
|
||||
|
||||
n = *num;
|
||||
|
||||
while (l < len) {
|
||||
if (n == 0) {
|
||||
(*block) (ivec, ivec, key);
|
||||
}
|
||||
out[l] = in[l] ^ ivec[n];
|
||||
++l;
|
||||
n = (n + 1) % 16;
|
||||
}
|
||||
|
||||
*num = n;
|
||||
}
|
||||
|
||||
static int sm4_init_key(const unsigned char *key, SM4_KEY *ks)
|
||||
{
|
||||
SM4_set_key(key, ks);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void sm4_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const SM4_KEY *key,
|
||||
unsigned char *ivec)
|
||||
{
|
||||
int num = 0;
|
||||
|
||||
CRYPTO_ofb128_encrypt(in, out, length, key, ivec, &num, (block128_f)SM4_encrypt);
|
||||
}
|
||||
|
||||
static void do_sm4_ofb_encrypt(const char *in_buff, int in_len, char *out_buff, int *out_len, const char *key, const char *iv)
|
||||
{
|
||||
SM4_KEY ks;
|
||||
char ivec[16];
|
||||
|
||||
memset(&ks, 0, sizeof(SM4_KEY));
|
||||
memcpy(ivec, iv, 16);
|
||||
sm4_init_key(key, &ks);
|
||||
sm4_ofb128_encrypt(in_buff, out_buff, in_len, &ks, ivec);
|
||||
*out_len = in_len;
|
||||
}
|
||||
|
||||
static void do_sm4_ecb_decrypt(const char *in_buff, char *out_buff, const char *key)
|
||||
{
|
||||
SM4_KEY ks;
|
||||
|
||||
memset(&ks, 0, sizeof(SM4_KEY));
|
||||
sm4_init_key(key, &ks);
|
||||
SM4_decrypt(in_buff, out_buff, &ks);
|
||||
//hexdump("in_buff", in_buff, 16);
|
||||
//hexdump("out_buff", out_buff, 16);
|
||||
//hexdump("key", key, 16);
|
||||
}
|
||||
|
||||
void do_sm4_ecb_encrypt(const char *in_buff, char *out_buff, const char *key)
|
||||
{
|
||||
SM4_KEY ks;
|
||||
|
||||
memset(&ks, 0, sizeof(SM4_KEY));
|
||||
sm4_init_key(key, &ks);
|
||||
SM4_encrypt(in_buff, out_buff, &ks);
|
||||
//hexdump("in_buff", in_buff, 16);
|
||||
//hexdump("out_buff", out_buff, 16);
|
||||
//hexdump("key", key, 16);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void hexdump(char *title, const unsigned char *s, int l)
|
||||
{
|
||||
int n = 0, j = 0;
|
||||
char buff[1024];
|
||||
memset(buff, 0, sizeof(buff));
|
||||
|
||||
printf("%s len = %d\n", title ? title : "NULL", l);
|
||||
|
||||
for (; n < l; ++n)
|
||||
{
|
||||
if ((n % 16) == 0)
|
||||
{
|
||||
if (j)
|
||||
{
|
||||
printf("%s\n", buff);
|
||||
j = 0;
|
||||
memset(buff, 0, sizeof(buff));
|
||||
}
|
||||
j += sprintf(buff + j, "%04x ", n);
|
||||
}
|
||||
j += sprintf(buff + j, "0x%02x,", s[n]);
|
||||
}
|
||||
if (j)
|
||||
printf("%s\n", buff);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv)
|
||||
{
|
||||
unsigned char in[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, \
|
||||
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, \
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, \
|
||||
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10};
|
||||
unsigned char key[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, \
|
||||
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10};
|
||||
unsigned char iv[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, \
|
||||
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10};
|
||||
unsigned char check[] = {0x69, 0x3d, 0x9a, 0x53, 0x5b, 0xad, 0x5b, 0xb1, \
|
||||
0x78, 0x6f, 0x53, 0xd7, 0x25, 0x3a, 0x70, 0x56, \
|
||||
0xf2, 0x07, 0x5d, 0x28, 0xb5, 0x23, 0x5f, 0x58, \
|
||||
0xd5, 0x00, 0x27, 0xe4, 0x17, 0x7d, 0x2b, 0xce};
|
||||
char buff[128] = {0};
|
||||
int len = sizeof(buff);
|
||||
|
||||
do_sm4_ofb_encrypt(in, 32, buff, &len, key, iv);
|
||||
|
||||
hexdump("enc", buff, 32);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
151
AWSMServer/src/sm2sm3_enc/typedef.h
Normal file
151
AWSMServer/src/sm2sm3_enc/typedef.h
Normal file
@ -0,0 +1,151 @@
|
||||
#ifndef __TYPEDEF_H__
|
||||
#define __TYPEDEF_H__
|
||||
|
||||
typedef int s32;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef short s16;
|
||||
typedef char s8;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef __int64 s64;
|
||||
#else
|
||||
typedef long long s64;
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned __int64 u64;
|
||||
#else
|
||||
typedef unsigned long long u64;
|
||||
#endif
|
||||
|
||||
static u16 __get_unaligned_le16(const u8 *p)
|
||||
{
|
||||
return p[0] | p[1] << 8;
|
||||
}
|
||||
|
||||
static u32 __get_unaligned_le32(const u8 *p)
|
||||
{
|
||||
return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
|
||||
}
|
||||
|
||||
static u64 __get_unaligned_le64(const u8 *p)
|
||||
{
|
||||
return (u64)__get_unaligned_le32(p + 4) << 32 |
|
||||
__get_unaligned_le32(p);
|
||||
}
|
||||
|
||||
static void __put_unaligned_le16(u16 val, u8 *p)
|
||||
{
|
||||
*p++ = val;
|
||||
*p++ = val >> 8;
|
||||
}
|
||||
|
||||
static void __put_unaligned_le32(u32 val, u8 *p)
|
||||
{
|
||||
__put_unaligned_le16(val >> 16, p + 2);
|
||||
__put_unaligned_le16(val, p);
|
||||
}
|
||||
|
||||
static void __put_unaligned_le64(u64 val, u8 *p)
|
||||
{
|
||||
__put_unaligned_le32(val >> 32, p + 4);
|
||||
__put_unaligned_le32(val, p);
|
||||
}
|
||||
|
||||
static u16 get_unaligned_le16(const void *p)
|
||||
{
|
||||
return __get_unaligned_le16((const u8 *)p);
|
||||
}
|
||||
|
||||
static u32 get_unaligned_le32(const void *p)
|
||||
{
|
||||
return __get_unaligned_le32((const u8 *)p);
|
||||
}
|
||||
|
||||
static u64 get_unaligned_le64(const void *p)
|
||||
{
|
||||
return __get_unaligned_le64((const u8 *)p);
|
||||
}
|
||||
|
||||
static void put_unaligned_le16(u16 val, void *p)
|
||||
{
|
||||
__put_unaligned_le16(val, p);
|
||||
}
|
||||
|
||||
static void put_unaligned_le32(u32 val, void *p)
|
||||
{
|
||||
__put_unaligned_le32(val, p);
|
||||
}
|
||||
|
||||
static void put_unaligned_le64(u64 val, void *p)
|
||||
{
|
||||
__put_unaligned_le64(val, p);
|
||||
}
|
||||
|
||||
static u16 __get_unaligned_be16(const u8 *p)
|
||||
{
|
||||
return p[0] << 8 | p[1];
|
||||
}
|
||||
|
||||
static u32 __get_unaligned_be32(const u8 *p)
|
||||
{
|
||||
return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
|
||||
}
|
||||
|
||||
static u64 __get_unaligned_be64(const u8 *p)
|
||||
{
|
||||
return (u64)__get_unaligned_be32(p) << 32 |
|
||||
__get_unaligned_be32(p + 4);
|
||||
}
|
||||
|
||||
static void __put_unaligned_be16(u16 val, u8 *p)
|
||||
{
|
||||
*p++ = val >> 8;
|
||||
*p++ = val;
|
||||
}
|
||||
|
||||
static void __put_unaligned_be32(u32 val, u8 *p)
|
||||
{
|
||||
__put_unaligned_be16(val >> 16, p);
|
||||
__put_unaligned_be16(val, p + 2);
|
||||
}
|
||||
|
||||
static void __put_unaligned_be64(u64 val, u8 *p)
|
||||
{
|
||||
__put_unaligned_be32(val >> 32, p);
|
||||
__put_unaligned_be32(val, p + 4);
|
||||
}
|
||||
|
||||
static u16 get_unaligned_be16(const void *p)
|
||||
{
|
||||
return __get_unaligned_be16((const u8 *)p);
|
||||
}
|
||||
|
||||
static u32 get_unaligned_be32(const void *p)
|
||||
{
|
||||
return __get_unaligned_be32((const u8 *)p);
|
||||
}
|
||||
|
||||
static u64 get_unaligned_be64(const void *p)
|
||||
{
|
||||
return __get_unaligned_be64((const u8 *)p);
|
||||
}
|
||||
|
||||
static void put_unaligned_be16(u16 val, void *p)
|
||||
{
|
||||
__put_unaligned_be16(val, p);
|
||||
}
|
||||
|
||||
static void put_unaligned_be32(u32 val, void *p)
|
||||
{
|
||||
__put_unaligned_be32(val, p);
|
||||
}
|
||||
|
||||
static void put_unaligned_be64(u64 val, void *p)
|
||||
{
|
||||
__put_unaligned_be64(val, p);
|
||||
}
|
||||
|
||||
#endif
|
19
CMakeLists.txt
Normal file
19
CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
project(AWSMRPC)
|
||||
|
||||
option(SUBPROJECT "Using SubProject" ON)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
|
||||
|
||||
include_directories(PUBLIC ${CMAKE_SOURCE_DIR}/utils)
|
||||
|
||||
link_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/lib)
|
||||
|
||||
add_subdirectory(utils/VSConfig)
|
||||
add_subdirectory(utils/VSClock)
|
||||
add_subdirectory(utils/ZMQLayout)
|
||||
add_subdirectory(utils/AWSMProtobuf)
|
||||
|
||||
add_subdirectory(AWSMServer)
|
||||
add_subdirectory(AWSM)
|
1
lib-gnueabihf/libprotobuf-c.so
Symbolic link
1
lib-gnueabihf/libprotobuf-c.so
Symbolic link
@ -0,0 +1 @@
|
||||
libprotobuf-c.so.1.0.0
|
BIN
lib-gnueabihf/libprotobuf-c.so.1.0.0
Executable file
BIN
lib-gnueabihf/libprotobuf-c.so.1.0.0
Executable file
Binary file not shown.
BIN
lib-gnueabihf/libserver-sm.so
Executable file
BIN
lib-gnueabihf/libserver-sm.so
Executable file
Binary file not shown.
BIN
lib-gnueabihf/libsm.so
Executable file
BIN
lib-gnueabihf/libsm.so
Executable file
Binary file not shown.
1
lib-gnueabihf/libzmq.so
Symbolic link
1
lib-gnueabihf/libzmq.so
Symbolic link
@ -0,0 +1 @@
|
||||
libzmq.so.5.2.6
|
BIN
lib-gnueabihf/libzmq.so.5.2.6
Executable file
BIN
lib-gnueabihf/libzmq.so.5.2.6
Executable file
Binary file not shown.
BIN
lib-hisiv500/libSKF_final.so
Normal file
BIN
lib-hisiv500/libSKF_final.so
Normal file
Binary file not shown.
1
lib-hisiv500/libprotobuf-c.so
Symbolic link
1
lib-hisiv500/libprotobuf-c.so
Symbolic link
@ -0,0 +1 @@
|
||||
libprotobuf-c.so.1.0.0
|
BIN
lib-hisiv500/libprotobuf-c.so.1.0.0
Executable file
BIN
lib-hisiv500/libprotobuf-c.so.1.0.0
Executable file
Binary file not shown.
BIN
lib-hisiv500/libserver-sm.so
Executable file
BIN
lib-hisiv500/libserver-sm.so
Executable file
Binary file not shown.
1
lib-hisiv500/libzmq.so
Symbolic link
1
lib-hisiv500/libzmq.so
Symbolic link
@ -0,0 +1 @@
|
||||
libzmq.so.5.2.6
|
BIN
lib-hisiv500/libzmq.so.5.2.6
Executable file
BIN
lib-hisiv500/libzmq.so.5.2.6
Executable file
Binary file not shown.
1
lib-x86_64/libprotobuf-c.so
Symbolic link
1
lib-x86_64/libprotobuf-c.so
Symbolic link
@ -0,0 +1 @@
|
||||
libprotobuf-c.so.1.0.0
|
BIN
lib-x86_64/libprotobuf-c.so.1.0.0
Executable file
BIN
lib-x86_64/libprotobuf-c.so.1.0.0
Executable file
Binary file not shown.
1
lib-x86_64/libzmq.so
Symbolic link
1
lib-x86_64/libzmq.so
Symbolic link
@ -0,0 +1 @@
|
||||
libzmq.so.5.2.6
|
BIN
lib-x86_64/libzmq.so.5.2.6
Executable file
BIN
lib-x86_64/libzmq.so.5.2.6
Executable file
Binary file not shown.
233
utils/AWSMProtobuf/AWSM.proto
Normal file
233
utils/AWSMProtobuf/AWSM.proto
Normal file
@ -0,0 +1,233 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package AWSM;
|
||||
|
||||
message HashInit
|
||||
{
|
||||
uint64 MessageID = 20;
|
||||
bytes EccPublickey = 1;
|
||||
int32 ReturnValue = 2;
|
||||
}
|
||||
|
||||
message HashUpdate
|
||||
{
|
||||
uint64 MessageID = 20;
|
||||
bytes SourceData = 1;
|
||||
int32 SourceDataLen = 2;
|
||||
int32 ReturnValue = 3;
|
||||
}
|
||||
|
||||
message HashFinal
|
||||
{
|
||||
uint64 MessageID = 20;
|
||||
bytes HashData = 1;
|
||||
int32 HashDataLen = 2;
|
||||
int32 ReturnValue = 3;
|
||||
}
|
||||
|
||||
message Hash
|
||||
{
|
||||
uint64 MessageID = 20;
|
||||
bytes SourceData = 1;
|
||||
int32 SourceDataLen = 2;
|
||||
bytes HashData = 3;
|
||||
int32 HashDataLen = 4;
|
||||
bytes EccPublickey = 5;
|
||||
int32 ReturnValue = 6;
|
||||
}
|
||||
|
||||
message Rand
|
||||
{
|
||||
bytes ucRandom = 1;
|
||||
int32 ulRandomLen = 2;
|
||||
int32 ReturnValue = 3;
|
||||
}
|
||||
|
||||
message SignatureByIntPrikey
|
||||
{
|
||||
bytes SignData = 1;
|
||||
int32 SignDataLen = 2;
|
||||
bytes EccSignBlobData = 3;
|
||||
int32 EccSignBlobDatalen = 4;
|
||||
int32 ReturnValue = 5;
|
||||
int32 KeyPairNum = 6;
|
||||
}
|
||||
|
||||
message SignatureByExtPrikey
|
||||
{
|
||||
bytes EccPrikey = 1;
|
||||
bytes SignData = 2;
|
||||
int32 SignDataLen = 3;
|
||||
bytes EccSignBlobData = 4;
|
||||
int32 EccSignBlobDataLen = 5;
|
||||
int32 ReturnValue = 6;
|
||||
}
|
||||
|
||||
message VerifySignature
|
||||
{
|
||||
bytes EccPublickey = 1;
|
||||
bytes SignatureData = 2;
|
||||
int32 SignDataLen = 3;
|
||||
bytes EccSignBlobData = 4;
|
||||
int32 EccSignBlobDataLen = 5;
|
||||
int32 ReturnValue = 6;
|
||||
}
|
||||
|
||||
message SM2EncryptByExtPubKey
|
||||
{
|
||||
bytes EPublickey = 1;
|
||||
bytes InData = 2;
|
||||
int32 InDataLen = 3;
|
||||
bytes ECCCIPPHERData = 4;
|
||||
int32 ECCCIPPHERDataLen = 5;
|
||||
int32 ReturnValue = 6;
|
||||
}
|
||||
|
||||
message SM2DecryptByExtPrikey
|
||||
{
|
||||
bytes EPrikey = 1;
|
||||
bytes ECCCIPPHERData = 2;
|
||||
int32 ECCCIPPHERDataLen = 3;
|
||||
bytes OutData = 4;
|
||||
int32 OutDataLen = 5;
|
||||
int32 ReturnValue = 6;
|
||||
}
|
||||
|
||||
message SM2DecryptByIntPrikey
|
||||
{
|
||||
bytes ECCCIPPHERData = 1;
|
||||
int32 ECCCIPPHERDataLen = 2;
|
||||
bytes OutData = 3;
|
||||
int32 OutDataLen = 4;
|
||||
int32 ReturnValue = 5;
|
||||
int32 KeyPairNum = 6;
|
||||
}
|
||||
|
||||
message SM2DecryptByIntCryptPrikey
|
||||
{
|
||||
bytes ECCCIPPHERData = 1;
|
||||
int32 ECCCIPPHERDataLen = 2;
|
||||
bytes OutData = 3;
|
||||
int32 OutDataLen = 4;
|
||||
int32 ReturnValue = 5;
|
||||
int32 KeyPairNum = 6;
|
||||
}
|
||||
|
||||
message SM1Encrypt
|
||||
{
|
||||
int32 AlgMode = 1;
|
||||
bytes pIv = 2;
|
||||
bytes Key = 3;
|
||||
int32 KeyLen = 4;
|
||||
bytes InData = 5;
|
||||
int32 InDataLen = 6;
|
||||
bytes OutData = 7;
|
||||
int32 OutDataLen = 8;
|
||||
int32 ReturnValue = 9;
|
||||
}
|
||||
|
||||
message SM1Decrypt
|
||||
{
|
||||
int32 AlgMode = 1;
|
||||
bytes pIv = 2;
|
||||
bytes Key = 3;
|
||||
int32 KeyLen = 4;
|
||||
bytes InData = 5;
|
||||
int32 InDataLen = 6;
|
||||
bytes OutData = 7;
|
||||
int32 OutDataLen = 8;
|
||||
int32 ReturnValue = 9;
|
||||
}
|
||||
|
||||
message SM4Encrypt
|
||||
{
|
||||
int32 AlgMode = 1;
|
||||
bytes pIv = 2;
|
||||
bytes Key = 3;
|
||||
int32 KeyLen = 4;
|
||||
bytes InData = 5;
|
||||
int32 InDataLen = 6;
|
||||
bytes OutData = 7;
|
||||
int32 OutDataLen = 8;
|
||||
int32 ReturnValue = 9;
|
||||
}
|
||||
|
||||
message SM4Decrypt
|
||||
{
|
||||
int32 AlgMode = 1;
|
||||
bytes pIv = 2;
|
||||
bytes Key = 3;
|
||||
int32 KeyLen = 4;
|
||||
bytes InData = 5;
|
||||
int32 InDataLen = 6;
|
||||
bytes OutData = 7;
|
||||
int32 OutDataLen = 8;
|
||||
int32 ReturnValue = 9;
|
||||
}
|
||||
|
||||
message GenerateECCKeyPair
|
||||
{
|
||||
int32 ReturnValue = 1;
|
||||
int32 KeyPairNum = 2;
|
||||
}
|
||||
|
||||
message ExportPubkey
|
||||
{
|
||||
int32 KeyPairType = 1;
|
||||
bytes PublicKey = 2;
|
||||
int32 ReturnValue = 3;
|
||||
int32 KeyPairNum = 4;
|
||||
}
|
||||
|
||||
message ImportKeyPair
|
||||
{
|
||||
int32 KeyPairType = 1;
|
||||
bytes Prikey = 2;
|
||||
bytes Pubkey = 3;
|
||||
int32 ReturnValue = 4;
|
||||
int32 KeyPairNum = 5;
|
||||
}
|
||||
|
||||
message ImportCertificate
|
||||
{
|
||||
int32 CerType = 1;
|
||||
bytes InData = 2;
|
||||
int32 InDataLen = 3;
|
||||
int32 ReturnValue = 4;
|
||||
}
|
||||
|
||||
message ExportCertificate
|
||||
{
|
||||
int32 CerType = 1;
|
||||
bytes OutData = 2;
|
||||
int32 OutDataLen = 3;
|
||||
int32 ReturnValue = 4;
|
||||
}
|
||||
|
||||
message ImportFile
|
||||
{
|
||||
bytes FileName = 1;
|
||||
bytes InData = 2;
|
||||
int32 InDataLen = 3;
|
||||
int32 ReturnValue = 4;
|
||||
}
|
||||
|
||||
message ExportFile
|
||||
{
|
||||
bytes FileName = 1;
|
||||
bytes OutData = 2;
|
||||
int32 OutDataLen = 3;
|
||||
int32 ReturnValue = 4;
|
||||
}
|
||||
|
||||
message GetHwcode
|
||||
{
|
||||
bytes HwCode = 1;
|
||||
int32 ReturnValue = 2;
|
||||
}
|
||||
|
||||
message GetDevInfo
|
||||
{
|
||||
bytes DevInfo = 1;
|
||||
int32 ReturnValue = 2;
|
||||
}
|
22
utils/AWSMProtobuf/CMakeLists.txt
Normal file
22
utils/AWSMProtobuf/CMakeLists.txt
Normal file
@ -0,0 +1,22 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
|
||||
PROJECT(AWSMProtobuf)
|
||||
|
||||
ADD_COMPILE_OPTIONS(-fPIC)
|
||||
|
||||
AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/src src_list)
|
||||
|
||||
ADD_LIBRARY(${PROJECT_NAME} STATIC ${src_list})
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
TARGET_LINK_DIRECTORIES(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/lib
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
protobuf-c
|
||||
)
|
824
utils/AWSMProtobuf/include/AWSM.pb-c.h
Normal file
824
utils/AWSMProtobuf/include/AWSM.pb-c.h
Normal file
@ -0,0 +1,824 @@
|
||||
/* Generated by the protocol buffer compiler. DO NOT EDIT! */
|
||||
/* Generated from: AWSM.proto */
|
||||
|
||||
#ifndef PROTOBUF_C_AWSM_2eproto__INCLUDED
|
||||
#define PROTOBUF_C_AWSM_2eproto__INCLUDED
|
||||
|
||||
#include <protobuf-c/protobuf-c.h>
|
||||
|
||||
PROTOBUF_C__BEGIN_DECLS
|
||||
|
||||
#if PROTOBUF_C_VERSION_NUMBER < 1003000
|
||||
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
|
||||
#elif 1005000 < PROTOBUF_C_MIN_COMPILER_VERSION
|
||||
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
|
||||
#endif
|
||||
|
||||
typedef struct AWSM__HashInit AWSM__HashInit;
|
||||
typedef struct AWSM__HashUpdate AWSM__HashUpdate;
|
||||
typedef struct AWSM__HashFinal AWSM__HashFinal;
|
||||
typedef struct AWSM__Hash AWSM__Hash;
|
||||
typedef struct AWSM__Rand AWSM__Rand;
|
||||
typedef struct AWSM__SignatureByIntPrikey AWSM__SignatureByIntPrikey;
|
||||
typedef struct AWSM__SignatureByExtPrikey AWSM__SignatureByExtPrikey;
|
||||
typedef struct AWSM__VerifySignature AWSM__VerifySignature;
|
||||
typedef struct AWSM__SM2EncryptByExtPubKey AWSM__SM2EncryptByExtPubKey;
|
||||
typedef struct AWSM__SM2DecryptByExtPrikey AWSM__SM2DecryptByExtPrikey;
|
||||
typedef struct AWSM__SM2DecryptByIntPrikey AWSM__SM2DecryptByIntPrikey;
|
||||
typedef struct AWSM__SM2DecryptByIntCryptPrikey
|
||||
AWSM__SM2DecryptByIntCryptPrikey;
|
||||
typedef struct AWSM__SM1Encrypt AWSM__SM1Encrypt;
|
||||
typedef struct AWSM__SM1Decrypt AWSM__SM1Decrypt;
|
||||
typedef struct AWSM__SM4Encrypt AWSM__SM4Encrypt;
|
||||
typedef struct AWSM__SM4Decrypt AWSM__SM4Decrypt;
|
||||
typedef struct AWSM__GenerateECCKeyPair AWSM__GenerateECCKeyPair;
|
||||
typedef struct AWSM__ExportPubkey AWSM__ExportPubkey;
|
||||
typedef struct AWSM__ImportKeyPair AWSM__ImportKeyPair;
|
||||
typedef struct AWSM__ImportCertificate AWSM__ImportCertificate;
|
||||
typedef struct AWSM__ExportCertificate AWSM__ExportCertificate;
|
||||
typedef struct AWSM__ImportFile AWSM__ImportFile;
|
||||
typedef struct AWSM__ExportFile AWSM__ExportFile;
|
||||
typedef struct AWSM__GetHwcode AWSM__GetHwcode;
|
||||
typedef struct AWSM__GetDevInfo AWSM__GetDevInfo;
|
||||
|
||||
/* --- enums --- */
|
||||
|
||||
/* --- messages --- */
|
||||
|
||||
struct AWSM__HashInit {
|
||||
ProtobufCMessage base;
|
||||
uint64_t messageid;
|
||||
ProtobufCBinaryData eccpublickey;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__HASH_INIT__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__hash_init__descriptor), 0, {0, NULL}, 0}
|
||||
|
||||
struct AWSM__HashUpdate {
|
||||
ProtobufCMessage base;
|
||||
uint64_t messageid;
|
||||
ProtobufCBinaryData sourcedata;
|
||||
int32_t sourcedatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__HASH_UPDATE__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__hash_update__descriptor), 0, {0, NULL}, 0, 0}
|
||||
|
||||
struct AWSM__HashFinal {
|
||||
ProtobufCMessage base;
|
||||
uint64_t messageid;
|
||||
ProtobufCBinaryData hashdata;
|
||||
int32_t hashdatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__HASH_FINAL__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__hash_final__descriptor), 0, {0, NULL}, 0, 0}
|
||||
|
||||
struct AWSM__Hash {
|
||||
ProtobufCMessage base;
|
||||
uint64_t messageid;
|
||||
ProtobufCBinaryData sourcedata;
|
||||
int32_t sourcedatalen;
|
||||
ProtobufCBinaryData hashdata;
|
||||
int32_t hashdatalen;
|
||||
ProtobufCBinaryData eccpublickey;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__HASH__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__hash__descriptor), \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0}
|
||||
|
||||
struct AWSM__Rand {
|
||||
ProtobufCMessage base;
|
||||
ProtobufCBinaryData ucrandom;
|
||||
int32_t ulrandomlen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__RAND__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__rand__descriptor), {0, NULL}, 0, 0}
|
||||
|
||||
struct AWSM__SignatureByIntPrikey {
|
||||
ProtobufCMessage base;
|
||||
ProtobufCBinaryData signdata;
|
||||
int32_t signdatalen;
|
||||
ProtobufCBinaryData eccsignblobdata;
|
||||
int32_t eccsignblobdatalen;
|
||||
int32_t returnvalue;
|
||||
int32_t keypairnum;
|
||||
};
|
||||
#define AWSM__SIGNATURE_BY_INT_PRIKEY__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__signature_by_int_prikey__descriptor), \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__SignatureByExtPrikey {
|
||||
ProtobufCMessage base;
|
||||
ProtobufCBinaryData eccprikey;
|
||||
ProtobufCBinaryData signdata;
|
||||
int32_t signdatalen;
|
||||
ProtobufCBinaryData eccsignblobdata;
|
||||
int32_t eccsignblobdatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__SIGNATURE_BY_EXT_PRIKEY__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__signature_by_ext_prikey__descriptor), \
|
||||
{0, NULL}, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__VerifySignature {
|
||||
ProtobufCMessage base;
|
||||
ProtobufCBinaryData eccpublickey;
|
||||
ProtobufCBinaryData signaturedata;
|
||||
int32_t signdatalen;
|
||||
ProtobufCBinaryData eccsignblobdata;
|
||||
int32_t eccsignblobdatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__VERIFY_SIGNATURE__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__verify_signature__descriptor), \
|
||||
{0, NULL}, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__SM2EncryptByExtPubKey {
|
||||
ProtobufCMessage base;
|
||||
ProtobufCBinaryData epublickey;
|
||||
ProtobufCBinaryData indata;
|
||||
int32_t indatalen;
|
||||
ProtobufCBinaryData ecccippherdata;
|
||||
int32_t ecccippherdatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__SM2_ENCRYPT_BY_EXT_PUB_KEY__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__sm2_encrypt_by_ext_pub_key__descriptor), \
|
||||
{0, NULL}, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__SM2DecryptByExtPrikey {
|
||||
ProtobufCMessage base;
|
||||
ProtobufCBinaryData eprikey;
|
||||
ProtobufCBinaryData ecccippherdata;
|
||||
int32_t ecccippherdatalen;
|
||||
ProtobufCBinaryData outdata;
|
||||
int32_t outdatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__SM2_DECRYPT_BY_EXT_PRIKEY__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__sm2_decrypt_by_ext_prikey__descriptor), \
|
||||
{0, NULL}, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__SM2DecryptByIntPrikey {
|
||||
ProtobufCMessage base;
|
||||
ProtobufCBinaryData ecccippherdata;
|
||||
int32_t ecccippherdatalen;
|
||||
ProtobufCBinaryData outdata;
|
||||
int32_t outdatalen;
|
||||
int32_t returnvalue;
|
||||
int32_t keypairnum;
|
||||
};
|
||||
#define AWSM__SM2_DECRYPT_BY_INT_PRIKEY__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__sm2_decrypt_by_int_prikey__descriptor), \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__SM2DecryptByIntCryptPrikey {
|
||||
ProtobufCMessage base;
|
||||
ProtobufCBinaryData ecccippherdata;
|
||||
int32_t ecccippherdatalen;
|
||||
ProtobufCBinaryData outdata;
|
||||
int32_t outdatalen;
|
||||
int32_t returnvalue;
|
||||
int32_t keypairnum;
|
||||
};
|
||||
#define AWSM__SM2_DECRYPT_BY_INT_CRYPT_PRIKEY__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT( \
|
||||
&awsm__sm2_decrypt_by_int_crypt_prikey__descriptor), \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__SM1Encrypt {
|
||||
ProtobufCMessage base;
|
||||
int32_t algmode;
|
||||
ProtobufCBinaryData piv;
|
||||
ProtobufCBinaryData key;
|
||||
int32_t keylen;
|
||||
ProtobufCBinaryData indata;
|
||||
int32_t indatalen;
|
||||
ProtobufCBinaryData outdata;
|
||||
int32_t outdatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__SM1_ENCRYPT__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__sm1_encrypt__descriptor), \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__SM1Decrypt {
|
||||
ProtobufCMessage base;
|
||||
int32_t algmode;
|
||||
ProtobufCBinaryData piv;
|
||||
ProtobufCBinaryData key;
|
||||
int32_t keylen;
|
||||
ProtobufCBinaryData indata;
|
||||
int32_t indatalen;
|
||||
ProtobufCBinaryData outdata;
|
||||
int32_t outdatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__SM1_DECRYPT__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__sm1_decrypt__descriptor), \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__SM4Encrypt {
|
||||
ProtobufCMessage base;
|
||||
int32_t algmode;
|
||||
ProtobufCBinaryData piv;
|
||||
ProtobufCBinaryData key;
|
||||
int32_t keylen;
|
||||
ProtobufCBinaryData indata;
|
||||
int32_t indatalen;
|
||||
ProtobufCBinaryData outdata;
|
||||
int32_t outdatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__SM4_ENCRYPT__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__sm4_encrypt__descriptor), \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__SM4Decrypt {
|
||||
ProtobufCMessage base;
|
||||
int32_t algmode;
|
||||
ProtobufCBinaryData piv;
|
||||
ProtobufCBinaryData key;
|
||||
int32_t keylen;
|
||||
ProtobufCBinaryData indata;
|
||||
int32_t indatalen;
|
||||
ProtobufCBinaryData outdata;
|
||||
int32_t outdatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__SM4_DECRYPT__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__sm4_decrypt__descriptor), \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__GenerateECCKeyPair {
|
||||
ProtobufCMessage base;
|
||||
int32_t returnvalue;
|
||||
int32_t keypairnum;
|
||||
};
|
||||
#define AWSM__GENERATE_ECCKEY_PAIR__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__generate_ecckey_pair__descriptor), 0, 0}
|
||||
|
||||
struct AWSM__ExportPubkey {
|
||||
ProtobufCMessage base;
|
||||
int32_t keypairtype;
|
||||
ProtobufCBinaryData publickey;
|
||||
int32_t returnvalue;
|
||||
int32_t keypairnum;
|
||||
};
|
||||
#define AWSM__EXPORT_PUBKEY__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__export_pubkey__descriptor), \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__ImportKeyPair {
|
||||
ProtobufCMessage base;
|
||||
int32_t keypairtype;
|
||||
ProtobufCBinaryData prikey;
|
||||
ProtobufCBinaryData pubkey;
|
||||
int32_t returnvalue;
|
||||
int32_t keypairnum;
|
||||
};
|
||||
#define AWSM__IMPORT_KEY_PAIR__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__import_key_pair__descriptor), \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__ImportCertificate {
|
||||
ProtobufCMessage base;
|
||||
int32_t certype;
|
||||
ProtobufCBinaryData indata;
|
||||
int32_t indatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__IMPORT_CERTIFICATE__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__import_certificate__descriptor), \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__ExportCertificate {
|
||||
ProtobufCMessage base;
|
||||
int32_t certype;
|
||||
ProtobufCBinaryData outdata;
|
||||
int32_t outdatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__EXPORT_CERTIFICATE__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__export_certificate__descriptor), \
|
||||
0, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__ImportFile {
|
||||
ProtobufCMessage base;
|
||||
ProtobufCBinaryData filename;
|
||||
ProtobufCBinaryData indata;
|
||||
int32_t indatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__IMPORT_FILE__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__import_file__descriptor), \
|
||||
{0, NULL}, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__ExportFile {
|
||||
ProtobufCMessage base;
|
||||
ProtobufCBinaryData filename;
|
||||
ProtobufCBinaryData outdata;
|
||||
int32_t outdatalen;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__EXPORT_FILE__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__export_file__descriptor), \
|
||||
{0, NULL}, \
|
||||
{0, NULL}, \
|
||||
0, \
|
||||
0}
|
||||
|
||||
struct AWSM__GetHwcode {
|
||||
ProtobufCMessage base;
|
||||
ProtobufCBinaryData hwcode;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__GET_HWCODE__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__get_hwcode__descriptor), {0, NULL}, 0}
|
||||
|
||||
struct AWSM__GetDevInfo {
|
||||
ProtobufCMessage base;
|
||||
ProtobufCBinaryData devinfo;
|
||||
int32_t returnvalue;
|
||||
};
|
||||
#define AWSM__GET_DEV_INFO__INIT \
|
||||
{PROTOBUF_C_MESSAGE_INIT(&awsm__get_dev_info__descriptor), {0, NULL}, 0}
|
||||
|
||||
/* AWSM__HashInit methods */
|
||||
void awsm__hash_init__init(AWSM__HashInit *message);
|
||||
size_t awsm__hash_init__get_packed_size(const AWSM__HashInit *message);
|
||||
size_t awsm__hash_init__pack(const AWSM__HashInit *message, uint8_t *out);
|
||||
size_t awsm__hash_init__pack_to_buffer(const AWSM__HashInit *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__HashInit *awsm__hash_init__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__hash_init__free_unpacked(AWSM__HashInit *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__HashUpdate methods */
|
||||
void awsm__hash_update__init(AWSM__HashUpdate *message);
|
||||
size_t awsm__hash_update__get_packed_size(const AWSM__HashUpdate *message);
|
||||
size_t awsm__hash_update__pack(const AWSM__HashUpdate *message, uint8_t *out);
|
||||
size_t awsm__hash_update__pack_to_buffer(const AWSM__HashUpdate *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__HashUpdate *awsm__hash_update__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__hash_update__free_unpacked(AWSM__HashUpdate *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__HashFinal methods */
|
||||
void awsm__hash_final__init(AWSM__HashFinal *message);
|
||||
size_t awsm__hash_final__get_packed_size(const AWSM__HashFinal *message);
|
||||
size_t awsm__hash_final__pack(const AWSM__HashFinal *message, uint8_t *out);
|
||||
size_t awsm__hash_final__pack_to_buffer(const AWSM__HashFinal *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__HashFinal *awsm__hash_final__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__hash_final__free_unpacked(AWSM__HashFinal *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__Hash methods */
|
||||
void awsm__hash__init(AWSM__Hash *message);
|
||||
size_t awsm__hash__get_packed_size(const AWSM__Hash *message);
|
||||
size_t awsm__hash__pack(const AWSM__Hash *message, uint8_t *out);
|
||||
size_t awsm__hash__pack_to_buffer(const AWSM__Hash *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__Hash *awsm__hash__unpack(ProtobufCAllocator *allocator, size_t len,
|
||||
const uint8_t *data);
|
||||
void awsm__hash__free_unpacked(AWSM__Hash *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__Rand methods */
|
||||
void awsm__rand__init(AWSM__Rand *message);
|
||||
size_t awsm__rand__get_packed_size(const AWSM__Rand *message);
|
||||
size_t awsm__rand__pack(const AWSM__Rand *message, uint8_t *out);
|
||||
size_t awsm__rand__pack_to_buffer(const AWSM__Rand *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__Rand *awsm__rand__unpack(ProtobufCAllocator *allocator, size_t len,
|
||||
const uint8_t *data);
|
||||
void awsm__rand__free_unpacked(AWSM__Rand *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__SignatureByIntPrikey methods */
|
||||
void awsm__signature_by_int_prikey__init(AWSM__SignatureByIntPrikey *message);
|
||||
size_t awsm__signature_by_int_prikey__get_packed_size(
|
||||
const AWSM__SignatureByIntPrikey *message);
|
||||
size_t
|
||||
awsm__signature_by_int_prikey__pack(const AWSM__SignatureByIntPrikey *message,
|
||||
uint8_t *out);
|
||||
size_t awsm__signature_by_int_prikey__pack_to_buffer(
|
||||
const AWSM__SignatureByIntPrikey *message, ProtobufCBuffer *buffer);
|
||||
AWSM__SignatureByIntPrikey *
|
||||
awsm__signature_by_int_prikey__unpack(ProtobufCAllocator *allocator, size_t len,
|
||||
const uint8_t *data);
|
||||
void awsm__signature_by_int_prikey__free_unpacked(
|
||||
AWSM__SignatureByIntPrikey *message, ProtobufCAllocator *allocator);
|
||||
/* AWSM__SignatureByExtPrikey methods */
|
||||
void awsm__signature_by_ext_prikey__init(AWSM__SignatureByExtPrikey *message);
|
||||
size_t awsm__signature_by_ext_prikey__get_packed_size(
|
||||
const AWSM__SignatureByExtPrikey *message);
|
||||
size_t
|
||||
awsm__signature_by_ext_prikey__pack(const AWSM__SignatureByExtPrikey *message,
|
||||
uint8_t *out);
|
||||
size_t awsm__signature_by_ext_prikey__pack_to_buffer(
|
||||
const AWSM__SignatureByExtPrikey *message, ProtobufCBuffer *buffer);
|
||||
AWSM__SignatureByExtPrikey *
|
||||
awsm__signature_by_ext_prikey__unpack(ProtobufCAllocator *allocator, size_t len,
|
||||
const uint8_t *data);
|
||||
void awsm__signature_by_ext_prikey__free_unpacked(
|
||||
AWSM__SignatureByExtPrikey *message, ProtobufCAllocator *allocator);
|
||||
/* AWSM__VerifySignature methods */
|
||||
void awsm__verify_signature__init(AWSM__VerifySignature *message);
|
||||
size_t
|
||||
awsm__verify_signature__get_packed_size(const AWSM__VerifySignature *message);
|
||||
size_t awsm__verify_signature__pack(const AWSM__VerifySignature *message,
|
||||
uint8_t *out);
|
||||
size_t
|
||||
awsm__verify_signature__pack_to_buffer(const AWSM__VerifySignature *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__VerifySignature *
|
||||
awsm__verify_signature__unpack(ProtobufCAllocator *allocator, size_t len,
|
||||
const uint8_t *data);
|
||||
void awsm__verify_signature__free_unpacked(AWSM__VerifySignature *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__SM2EncryptByExtPubKey methods */
|
||||
void awsm__sm2_encrypt_by_ext_pub_key__init(
|
||||
AWSM__SM2EncryptByExtPubKey *message);
|
||||
size_t awsm__sm2_encrypt_by_ext_pub_key__get_packed_size(
|
||||
const AWSM__SM2EncryptByExtPubKey *message);
|
||||
size_t awsm__sm2_encrypt_by_ext_pub_key__pack(
|
||||
const AWSM__SM2EncryptByExtPubKey *message, uint8_t *out);
|
||||
size_t awsm__sm2_encrypt_by_ext_pub_key__pack_to_buffer(
|
||||
const AWSM__SM2EncryptByExtPubKey *message, ProtobufCBuffer *buffer);
|
||||
AWSM__SM2EncryptByExtPubKey *
|
||||
awsm__sm2_encrypt_by_ext_pub_key__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__sm2_encrypt_by_ext_pub_key__free_unpacked(
|
||||
AWSM__SM2EncryptByExtPubKey *message, ProtobufCAllocator *allocator);
|
||||
/* AWSM__SM2DecryptByExtPrikey methods */
|
||||
void awsm__sm2_decrypt_by_ext_prikey__init(
|
||||
AWSM__SM2DecryptByExtPrikey *message);
|
||||
size_t awsm__sm2_decrypt_by_ext_prikey__get_packed_size(
|
||||
const AWSM__SM2DecryptByExtPrikey *message);
|
||||
size_t awsm__sm2_decrypt_by_ext_prikey__pack(
|
||||
const AWSM__SM2DecryptByExtPrikey *message, uint8_t *out);
|
||||
size_t awsm__sm2_decrypt_by_ext_prikey__pack_to_buffer(
|
||||
const AWSM__SM2DecryptByExtPrikey *message, ProtobufCBuffer *buffer);
|
||||
AWSM__SM2DecryptByExtPrikey *
|
||||
awsm__sm2_decrypt_by_ext_prikey__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__sm2_decrypt_by_ext_prikey__free_unpacked(
|
||||
AWSM__SM2DecryptByExtPrikey *message, ProtobufCAllocator *allocator);
|
||||
/* AWSM__SM2DecryptByIntPrikey methods */
|
||||
void awsm__sm2_decrypt_by_int_prikey__init(
|
||||
AWSM__SM2DecryptByIntPrikey *message);
|
||||
size_t awsm__sm2_decrypt_by_int_prikey__get_packed_size(
|
||||
const AWSM__SM2DecryptByIntPrikey *message);
|
||||
size_t awsm__sm2_decrypt_by_int_prikey__pack(
|
||||
const AWSM__SM2DecryptByIntPrikey *message, uint8_t *out);
|
||||
size_t awsm__sm2_decrypt_by_int_prikey__pack_to_buffer(
|
||||
const AWSM__SM2DecryptByIntPrikey *message, ProtobufCBuffer *buffer);
|
||||
AWSM__SM2DecryptByIntPrikey *
|
||||
awsm__sm2_decrypt_by_int_prikey__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__sm2_decrypt_by_int_prikey__free_unpacked(
|
||||
AWSM__SM2DecryptByIntPrikey *message, ProtobufCAllocator *allocator);
|
||||
/* AWSM__SM2DecryptByIntCryptPrikey methods */
|
||||
void awsm__sm2_decrypt_by_int_crypt_prikey__init(
|
||||
AWSM__SM2DecryptByIntCryptPrikey *message);
|
||||
size_t awsm__sm2_decrypt_by_int_crypt_prikey__get_packed_size(
|
||||
const AWSM__SM2DecryptByIntCryptPrikey *message);
|
||||
size_t awsm__sm2_decrypt_by_int_crypt_prikey__pack(
|
||||
const AWSM__SM2DecryptByIntCryptPrikey *message, uint8_t *out);
|
||||
size_t awsm__sm2_decrypt_by_int_crypt_prikey__pack_to_buffer(
|
||||
const AWSM__SM2DecryptByIntCryptPrikey *message, ProtobufCBuffer *buffer);
|
||||
AWSM__SM2DecryptByIntCryptPrikey *
|
||||
awsm__sm2_decrypt_by_int_crypt_prikey__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__sm2_decrypt_by_int_crypt_prikey__free_unpacked(
|
||||
AWSM__SM2DecryptByIntCryptPrikey *message, ProtobufCAllocator *allocator);
|
||||
/* AWSM__SM1Encrypt methods */
|
||||
void awsm__sm1_encrypt__init(AWSM__SM1Encrypt *message);
|
||||
size_t awsm__sm1_encrypt__get_packed_size(const AWSM__SM1Encrypt *message);
|
||||
size_t awsm__sm1_encrypt__pack(const AWSM__SM1Encrypt *message, uint8_t *out);
|
||||
size_t awsm__sm1_encrypt__pack_to_buffer(const AWSM__SM1Encrypt *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__SM1Encrypt *awsm__sm1_encrypt__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__sm1_encrypt__free_unpacked(AWSM__SM1Encrypt *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__SM1Decrypt methods */
|
||||
void awsm__sm1_decrypt__init(AWSM__SM1Decrypt *message);
|
||||
size_t awsm__sm1_decrypt__get_packed_size(const AWSM__SM1Decrypt *message);
|
||||
size_t awsm__sm1_decrypt__pack(const AWSM__SM1Decrypt *message, uint8_t *out);
|
||||
size_t awsm__sm1_decrypt__pack_to_buffer(const AWSM__SM1Decrypt *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__SM1Decrypt *awsm__sm1_decrypt__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__sm1_decrypt__free_unpacked(AWSM__SM1Decrypt *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__SM4Encrypt methods */
|
||||
void awsm__sm4_encrypt__init(AWSM__SM4Encrypt *message);
|
||||
size_t awsm__sm4_encrypt__get_packed_size(const AWSM__SM4Encrypt *message);
|
||||
size_t awsm__sm4_encrypt__pack(const AWSM__SM4Encrypt *message, uint8_t *out);
|
||||
size_t awsm__sm4_encrypt__pack_to_buffer(const AWSM__SM4Encrypt *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__SM4Encrypt *awsm__sm4_encrypt__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__sm4_encrypt__free_unpacked(AWSM__SM4Encrypt *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__SM4Decrypt methods */
|
||||
void awsm__sm4_decrypt__init(AWSM__SM4Decrypt *message);
|
||||
size_t awsm__sm4_decrypt__get_packed_size(const AWSM__SM4Decrypt *message);
|
||||
size_t awsm__sm4_decrypt__pack(const AWSM__SM4Decrypt *message, uint8_t *out);
|
||||
size_t awsm__sm4_decrypt__pack_to_buffer(const AWSM__SM4Decrypt *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__SM4Decrypt *awsm__sm4_decrypt__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__sm4_decrypt__free_unpacked(AWSM__SM4Decrypt *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__GenerateECCKeyPair methods */
|
||||
void awsm__generate_ecckey_pair__init(AWSM__GenerateECCKeyPair *message);
|
||||
size_t awsm__generate_ecckey_pair__get_packed_size(
|
||||
const AWSM__GenerateECCKeyPair *message);
|
||||
size_t awsm__generate_ecckey_pair__pack(const AWSM__GenerateECCKeyPair *message,
|
||||
uint8_t *out);
|
||||
size_t awsm__generate_ecckey_pair__pack_to_buffer(
|
||||
const AWSM__GenerateECCKeyPair *message, ProtobufCBuffer *buffer);
|
||||
AWSM__GenerateECCKeyPair *
|
||||
awsm__generate_ecckey_pair__unpack(ProtobufCAllocator *allocator, size_t len,
|
||||
const uint8_t *data);
|
||||
void awsm__generate_ecckey_pair__free_unpacked(
|
||||
AWSM__GenerateECCKeyPair *message, ProtobufCAllocator *allocator);
|
||||
/* AWSM__ExportPubkey methods */
|
||||
void awsm__export_pubkey__init(AWSM__ExportPubkey *message);
|
||||
size_t awsm__export_pubkey__get_packed_size(const AWSM__ExportPubkey *message);
|
||||
size_t awsm__export_pubkey__pack(const AWSM__ExportPubkey *message,
|
||||
uint8_t *out);
|
||||
size_t awsm__export_pubkey__pack_to_buffer(const AWSM__ExportPubkey *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__ExportPubkey *awsm__export_pubkey__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len,
|
||||
const uint8_t *data);
|
||||
void awsm__export_pubkey__free_unpacked(AWSM__ExportPubkey *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__ImportKeyPair methods */
|
||||
void awsm__import_key_pair__init(AWSM__ImportKeyPair *message);
|
||||
size_t
|
||||
awsm__import_key_pair__get_packed_size(const AWSM__ImportKeyPair *message);
|
||||
size_t awsm__import_key_pair__pack(const AWSM__ImportKeyPair *message,
|
||||
uint8_t *out);
|
||||
size_t awsm__import_key_pair__pack_to_buffer(const AWSM__ImportKeyPair *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__ImportKeyPair *
|
||||
awsm__import_key_pair__unpack(ProtobufCAllocator *allocator, size_t len,
|
||||
const uint8_t *data);
|
||||
void awsm__import_key_pair__free_unpacked(AWSM__ImportKeyPair *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__ImportCertificate methods */
|
||||
void awsm__import_certificate__init(AWSM__ImportCertificate *message);
|
||||
size_t awsm__import_certificate__get_packed_size(
|
||||
const AWSM__ImportCertificate *message);
|
||||
size_t awsm__import_certificate__pack(const AWSM__ImportCertificate *message,
|
||||
uint8_t *out);
|
||||
size_t
|
||||
awsm__import_certificate__pack_to_buffer(const AWSM__ImportCertificate *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__ImportCertificate *
|
||||
awsm__import_certificate__unpack(ProtobufCAllocator *allocator, size_t len,
|
||||
const uint8_t *data);
|
||||
void awsm__import_certificate__free_unpacked(AWSM__ImportCertificate *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__ExportCertificate methods */
|
||||
void awsm__export_certificate__init(AWSM__ExportCertificate *message);
|
||||
size_t awsm__export_certificate__get_packed_size(
|
||||
const AWSM__ExportCertificate *message);
|
||||
size_t awsm__export_certificate__pack(const AWSM__ExportCertificate *message,
|
||||
uint8_t *out);
|
||||
size_t
|
||||
awsm__export_certificate__pack_to_buffer(const AWSM__ExportCertificate *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__ExportCertificate *
|
||||
awsm__export_certificate__unpack(ProtobufCAllocator *allocator, size_t len,
|
||||
const uint8_t *data);
|
||||
void awsm__export_certificate__free_unpacked(AWSM__ExportCertificate *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__ImportFile methods */
|
||||
void awsm__import_file__init(AWSM__ImportFile *message);
|
||||
size_t awsm__import_file__get_packed_size(const AWSM__ImportFile *message);
|
||||
size_t awsm__import_file__pack(const AWSM__ImportFile *message, uint8_t *out);
|
||||
size_t awsm__import_file__pack_to_buffer(const AWSM__ImportFile *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__ImportFile *awsm__import_file__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__import_file__free_unpacked(AWSM__ImportFile *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__ExportFile methods */
|
||||
void awsm__export_file__init(AWSM__ExportFile *message);
|
||||
size_t awsm__export_file__get_packed_size(const AWSM__ExportFile *message);
|
||||
size_t awsm__export_file__pack(const AWSM__ExportFile *message, uint8_t *out);
|
||||
size_t awsm__export_file__pack_to_buffer(const AWSM__ExportFile *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__ExportFile *awsm__export_file__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__export_file__free_unpacked(AWSM__ExportFile *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__GetHwcode methods */
|
||||
void awsm__get_hwcode__init(AWSM__GetHwcode *message);
|
||||
size_t awsm__get_hwcode__get_packed_size(const AWSM__GetHwcode *message);
|
||||
size_t awsm__get_hwcode__pack(const AWSM__GetHwcode *message, uint8_t *out);
|
||||
size_t awsm__get_hwcode__pack_to_buffer(const AWSM__GetHwcode *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__GetHwcode *awsm__get_hwcode__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__get_hwcode__free_unpacked(AWSM__GetHwcode *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* AWSM__GetDevInfo methods */
|
||||
void awsm__get_dev_info__init(AWSM__GetDevInfo *message);
|
||||
size_t awsm__get_dev_info__get_packed_size(const AWSM__GetDevInfo *message);
|
||||
size_t awsm__get_dev_info__pack(const AWSM__GetDevInfo *message, uint8_t *out);
|
||||
size_t awsm__get_dev_info__pack_to_buffer(const AWSM__GetDevInfo *message,
|
||||
ProtobufCBuffer *buffer);
|
||||
AWSM__GetDevInfo *awsm__get_dev_info__unpack(ProtobufCAllocator *allocator,
|
||||
size_t len, const uint8_t *data);
|
||||
void awsm__get_dev_info__free_unpacked(AWSM__GetDevInfo *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* --- per-message closures --- */
|
||||
|
||||
typedef void (*AWSM__HashInit_Closure)(const AWSM__HashInit *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__HashUpdate_Closure)(const AWSM__HashUpdate *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__HashFinal_Closure)(const AWSM__HashFinal *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__Hash_Closure)(const AWSM__Hash *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__Rand_Closure)(const AWSM__Rand *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__SignatureByIntPrikey_Closure)(
|
||||
const AWSM__SignatureByIntPrikey *message, void *closure_data);
|
||||
typedef void (*AWSM__SignatureByExtPrikey_Closure)(
|
||||
const AWSM__SignatureByExtPrikey *message, void *closure_data);
|
||||
typedef void (*AWSM__VerifySignature_Closure)(
|
||||
const AWSM__VerifySignature *message, void *closure_data);
|
||||
typedef void (*AWSM__SM2EncryptByExtPubKey_Closure)(
|
||||
const AWSM__SM2EncryptByExtPubKey *message, void *closure_data);
|
||||
typedef void (*AWSM__SM2DecryptByExtPrikey_Closure)(
|
||||
const AWSM__SM2DecryptByExtPrikey *message, void *closure_data);
|
||||
typedef void (*AWSM__SM2DecryptByIntPrikey_Closure)(
|
||||
const AWSM__SM2DecryptByIntPrikey *message, void *closure_data);
|
||||
typedef void (*AWSM__SM2DecryptByIntCryptPrikey_Closure)(
|
||||
const AWSM__SM2DecryptByIntCryptPrikey *message, void *closure_data);
|
||||
typedef void (*AWSM__SM1Encrypt_Closure)(const AWSM__SM1Encrypt *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__SM1Decrypt_Closure)(const AWSM__SM1Decrypt *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__SM4Encrypt_Closure)(const AWSM__SM4Encrypt *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__SM4Decrypt_Closure)(const AWSM__SM4Decrypt *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__GenerateECCKeyPair_Closure)(
|
||||
const AWSM__GenerateECCKeyPair *message, void *closure_data);
|
||||
typedef void (*AWSM__ExportPubkey_Closure)(const AWSM__ExportPubkey *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__ImportKeyPair_Closure)(const AWSM__ImportKeyPair *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__ImportCertificate_Closure)(
|
||||
const AWSM__ImportCertificate *message, void *closure_data);
|
||||
typedef void (*AWSM__ExportCertificate_Closure)(
|
||||
const AWSM__ExportCertificate *message, void *closure_data);
|
||||
typedef void (*AWSM__ImportFile_Closure)(const AWSM__ImportFile *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__ExportFile_Closure)(const AWSM__ExportFile *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__GetHwcode_Closure)(const AWSM__GetHwcode *message,
|
||||
void *closure_data);
|
||||
typedef void (*AWSM__GetDevInfo_Closure)(const AWSM__GetDevInfo *message,
|
||||
void *closure_data);
|
||||
|
||||
/* --- services --- */
|
||||
|
||||
/* --- descriptors --- */
|
||||
|
||||
extern const ProtobufCMessageDescriptor awsm__hash_init__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__hash_update__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__hash_final__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__hash__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__rand__descriptor;
|
||||
extern const ProtobufCMessageDescriptor
|
||||
awsm__signature_by_int_prikey__descriptor;
|
||||
extern const ProtobufCMessageDescriptor
|
||||
awsm__signature_by_ext_prikey__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__verify_signature__descriptor;
|
||||
extern const ProtobufCMessageDescriptor
|
||||
awsm__sm2_encrypt_by_ext_pub_key__descriptor;
|
||||
extern const ProtobufCMessageDescriptor
|
||||
awsm__sm2_decrypt_by_ext_prikey__descriptor;
|
||||
extern const ProtobufCMessageDescriptor
|
||||
awsm__sm2_decrypt_by_int_prikey__descriptor;
|
||||
extern const ProtobufCMessageDescriptor
|
||||
awsm__sm2_decrypt_by_int_crypt_prikey__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__sm1_encrypt__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__sm1_decrypt__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__sm4_encrypt__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__sm4_decrypt__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__generate_ecckey_pair__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__export_pubkey__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__import_key_pair__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__import_certificate__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__export_certificate__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__import_file__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__export_file__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__get_hwcode__descriptor;
|
||||
extern const ProtobufCMessageDescriptor awsm__get_dev_info__descriptor;
|
||||
|
||||
PROTOBUF_C__END_DECLS
|
||||
|
||||
#endif /* PROTOBUF_C_AWSM_2eproto__INCLUDED */
|
1110
utils/AWSMProtobuf/include/protobuf-c/protobuf-c.h
Normal file
1110
utils/AWSMProtobuf/include/protobuf-c/protobuf-c.h
Normal file
File diff suppressed because it is too large
Load Diff
3453
utils/AWSMProtobuf/src/AWSM.pb-c.c
Normal file
3453
utils/AWSMProtobuf/src/AWSM.pb-c.c
Normal file
File diff suppressed because it is too large
Load Diff
37
utils/VSClock/CMakeLists.txt
Executable file
37
utils/VSClock/CMakeLists.txt
Executable file
@ -0,0 +1,37 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
|
||||
PROJECT(VSClock)
|
||||
|
||||
### SET CONFIGURE
|
||||
|
||||
OPTION(SUBPROJECT "AS SubProject" OFF)
|
||||
|
||||
ADD_COMPILE_OPTIONS(-fPIC)
|
||||
|
||||
SET(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
### SET COMPILE
|
||||
|
||||
AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/src src_list)
|
||||
|
||||
if(SUBPROJECT)
|
||||
ADD_LIBRARY(${PROJECT_NAME} STATIC ${src_list})
|
||||
else()
|
||||
ADD_LIBRARY(${PROJECT_NAME} SHARED ${src_list})
|
||||
endif()
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
### SET INSTALL
|
||||
|
||||
if(NOT SUBPROJECT)
|
||||
INSTALL(TARGETS ${CMAKE_PROJECT_NAME}
|
||||
LIBRARY DESTINATION lib)
|
||||
endif()
|
||||
|
||||
FILE(GLOB INCLUDE "${PROJECT_SOURCE_DIR}/include/*.h" )
|
||||
|
||||
INSTALL(FILES
|
||||
${INCLUDE} DESTINATION include/${CMAKE_PROJECT_NAME}/)
|
||||
|
26
utils/VSClock/include/VSClock.h
Normal file
26
utils/VSClock/include/VSClock.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef __VSCLOCK_H__
|
||||
#define __VSCLOCK_H__
|
||||
|
||||
typedef struct VSClock_S
|
||||
{
|
||||
long lClock;
|
||||
int iYear;
|
||||
int iMonth:8;
|
||||
int iDay:8;
|
||||
int iHour:8;
|
||||
int iMinute:8;
|
||||
int iSecond:8;
|
||||
int iMilliSecond;
|
||||
}VSClock_s, *pVSClock_s;
|
||||
|
||||
long VSClock(pVSClock_s psVSClock, int iOffsetSecond, int iOffsetMilliSecond);
|
||||
|
||||
long VSClock2L(pVSClock_s psVSClock);
|
||||
|
||||
int VSClockL2(long lClock, pVSClock_s psVSClock);
|
||||
|
||||
int VSClockTimeOut(pVSClock_s psVSClock);
|
||||
|
||||
#define VSClockClone(SRCpVSClock, DSTpVSClock) VSClockL2(SRCpVSClock->lClock, DSTpVSClock)
|
||||
|
||||
#endif
|
94
utils/VSClock/src/VSClock.c
Normal file
94
utils/VSClock/src/VSClock.c
Normal file
@ -0,0 +1,94 @@
|
||||
#include "VSClock.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/timeb.h>
|
||||
#define _XOPEN_SOURCE
|
||||
#define __USE_XOPEN
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/*
|
||||
* The IDs of the various system clocks (for POSIX.1b interval timers):
|
||||
*/
|
||||
#define CLOCK_REALTIME 0
|
||||
#define CLOCK_MONOTONIC 1
|
||||
#define CLOCK_PROCESS_CPUTIME_ID 2
|
||||
#define CLOCK_THREAD_CPUTIME_ID 3
|
||||
#define CLOCK_MONOTONIC_RAW 4
|
||||
#define CLOCK_REALTIME_COARSE 5
|
||||
#define CLOCK_MONOTONIC_COARSE 6
|
||||
#define CLOCK_BOOTTIME 7
|
||||
#define CLOCK_REALTIME_ALARM 8
|
||||
#define CLOCK_BOOTTIME_ALARM 9
|
||||
|
||||
long VSClock(pVSClock_s psVSClock, int iOffsetSecond, int iOffsetMilliSecond)
|
||||
{
|
||||
struct timespec sTimespec = {0};
|
||||
clock_gettime(CLOCK_REALTIME, &sTimespec);
|
||||
|
||||
long rv = sTimespec.tv_sec * 1000 + sTimespec.tv_nsec / 1000000 + iOffsetSecond * 1000 + iOffsetMilliSecond;
|
||||
|
||||
if(!psVSClock) return rv;
|
||||
|
||||
time_t Second = rv / 1000; //秒
|
||||
int MilliSecond = rv % 1000; //毫秒
|
||||
|
||||
struct tm *pTM = NULL;
|
||||
|
||||
pTM = localtime(&Second);
|
||||
if(!pTM) { return -1; }
|
||||
|
||||
psVSClock->iYear = 1900 + pTM->tm_year;
|
||||
psVSClock->iMonth = 1 + pTM->tm_mon;
|
||||
psVSClock->iDay = pTM->tm_mday;
|
||||
psVSClock->iHour = pTM->tm_hour;
|
||||
psVSClock->iMinute = pTM->tm_min;
|
||||
psVSClock->iSecond = pTM->tm_sec;
|
||||
psVSClock->iMilliSecond = MilliSecond;
|
||||
|
||||
return (psVSClock->lClock = Second * 1000 + MilliSecond);
|
||||
}
|
||||
|
||||
long VSClock2L(pVSClock_s psVSClock)
|
||||
{
|
||||
char pcDate[32] = {0};
|
||||
snprintf(pcDate, 32, "%d-%d-%d-%d-%d-%d",
|
||||
psVSClock->iYear, psVSClock->iMonth, psVSClock->iDay,
|
||||
psVSClock->iHour, psVSClock->iMinute, psVSClock->iSecond);
|
||||
|
||||
struct tm tm;
|
||||
strptime((char *)pcDate, "%Y-%m-%d-%H-%M-%S", &tm);
|
||||
|
||||
return mktime(&tm) * 1000 + psVSClock->iMilliSecond;
|
||||
}
|
||||
|
||||
int VSClockL2(long lClock, pVSClock_s psVSClock)
|
||||
{
|
||||
long iSeconds = lClock / 1000;
|
||||
int iMilliSecond = lClock % 1000;
|
||||
|
||||
struct tm *pTM = NULL;
|
||||
|
||||
pTM = localtime(&iSeconds);
|
||||
if(!pTM) { return -1; }
|
||||
|
||||
psVSClock->iYear = 1900 + pTM->tm_year;
|
||||
psVSClock->iMonth = 1 + pTM->tm_mon;
|
||||
psVSClock->iDay = pTM->tm_mday;
|
||||
psVSClock->iHour = pTM->tm_hour;
|
||||
psVSClock->iMinute = pTM->tm_min;
|
||||
psVSClock->iSecond = pTM->tm_sec;
|
||||
psVSClock->iMilliSecond = iMilliSecond;
|
||||
|
||||
psVSClock->lClock = lClock;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int VSClockTimeOut(pVSClock_s psVSClock)
|
||||
{
|
||||
if(psVSClock->lClock < VSClock(NULL, 0, 0)) return 1;
|
||||
// printf("%ld %ld\n", psVSClock->lClock, VSClock(NULL, 0, 0));
|
||||
return 0;
|
||||
}
|
37
utils/VSConfig/CMakeLists.txt
Executable file
37
utils/VSConfig/CMakeLists.txt
Executable file
@ -0,0 +1,37 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
|
||||
PROJECT(VSConfig)
|
||||
|
||||
### SET CONFIGURE
|
||||
|
||||
OPTION(SUBPROJECT "AS SubProject" OFF)
|
||||
|
||||
ADD_COMPILE_OPTIONS(-fPIC -std=c99)
|
||||
|
||||
SET(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
### SET COMPILE
|
||||
|
||||
AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/src src_list)
|
||||
|
||||
if(SUBPROJECT)
|
||||
ADD_LIBRARY(${PROJECT_NAME} STATIC ${src_list})
|
||||
else()
|
||||
ADD_LIBRARY(${PROJECT_NAME} SHARED ${src_list})
|
||||
endif()
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
### SET INSTALL
|
||||
|
||||
if(NOT SUBPROJECT)
|
||||
INSTALL(TARGETS ${CMAKE_PROJECT_NAME}
|
||||
LIBRARY DESTINATION lib)
|
||||
endif()
|
||||
|
||||
FILE(GLOB INCLUDE "${PROJECT_SOURCE_DIR}/include/*.h" )
|
||||
|
||||
INSTALL(FILES
|
||||
${INCLUDE} DESTINATION include/${CMAKE_PROJECT_NAME}/)
|
||||
|
377
utils/VSConfig/build/CMakeCache.txt
Normal file
377
utils/VSConfig/build/CMakeCache.txt
Normal file
@ -0,0 +1,377 @@
|
||||
# This is the CMakeCache file.
|
||||
# For build in directory: /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build
|
||||
# It was generated by CMake: /usr/data/zt/download/cmake-3.26.3/bin/cmake
|
||||
# You can edit this file to change values found and used by cmake.
|
||||
# If you do not want to change any of the values, simply exit the editor.
|
||||
# If you do want to change a value, simply edit, save, and exit the editor.
|
||||
# The syntax for the file is as follows:
|
||||
# KEY:TYPE=VALUE
|
||||
# KEY is the name of a variable in the cache.
|
||||
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
|
||||
# VALUE is the current value for the KEY.
|
||||
|
||||
########################
|
||||
# EXTERNAL cache entries
|
||||
########################
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_AR:FILEPATH=/usr/bin/ar
|
||||
|
||||
//Choose the type of build, options are: None Debug Release RelWithDebInfo
|
||||
// MinSizeRel ...
|
||||
CMAKE_BUILD_TYPE:STRING=
|
||||
|
||||
//Enable/Disable color output during build.
|
||||
CMAKE_COLOR_MAKEFILE:BOOL=ON
|
||||
|
||||
//CXX compiler
|
||||
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++
|
||||
|
||||
//A wrapper around 'ar' adding the appropriate '--plugin' option
|
||||
// for the GCC compiler
|
||||
CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar
|
||||
|
||||
//A wrapper around 'ranlib' adding the appropriate '--plugin' option
|
||||
// for the GCC compiler
|
||||
CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib
|
||||
|
||||
//Flags used by the CXX compiler during all build types.
|
||||
CMAKE_CXX_FLAGS:STRING=
|
||||
|
||||
//Flags used by the CXX compiler during DEBUG builds.
|
||||
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
|
||||
|
||||
//Flags used by the CXX compiler during MINSIZEREL builds.
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
|
||||
|
||||
//Flags used by the CXX compiler during RELEASE builds.
|
||||
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
|
||||
|
||||
//Flags used by the CXX compiler during RELWITHDEBINFO builds.
|
||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
|
||||
|
||||
//C compiler
|
||||
CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc
|
||||
|
||||
//A wrapper around 'ar' adding the appropriate '--plugin' option
|
||||
// for the GCC compiler
|
||||
CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar
|
||||
|
||||
//A wrapper around 'ranlib' adding the appropriate '--plugin' option
|
||||
// for the GCC compiler
|
||||
CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib
|
||||
|
||||
//Flags used by the C compiler during all build types.
|
||||
CMAKE_C_FLAGS:STRING=
|
||||
|
||||
//Flags used by the C compiler during DEBUG builds.
|
||||
CMAKE_C_FLAGS_DEBUG:STRING=-g
|
||||
|
||||
//Flags used by the C compiler during MINSIZEREL builds.
|
||||
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
|
||||
|
||||
//Flags used by the C compiler during RELEASE builds.
|
||||
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
|
||||
|
||||
//Flags used by the C compiler during RELWITHDEBINFO builds.
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND
|
||||
|
||||
//Flags used by the linker during all build types.
|
||||
CMAKE_EXE_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during DEBUG builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during MINSIZEREL builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during RELEASE builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during RELWITHDEBINFO builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Enable/Disable output of compile commands during generation.
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=
|
||||
|
||||
//Value Computed by CMake.
|
||||
CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/pkgRedirects
|
||||
|
||||
//Install path prefix, prepended onto install directories.
|
||||
CMAKE_INSTALL_PREFIX:PATH=/usr/local
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_LINKER:FILEPATH=/usr/bin/ld
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// all build types.
|
||||
CMAKE_MODULE_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// DEBUG builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// MINSIZEREL builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// RELEASE builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// RELWITHDEBINFO builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_NM:FILEPATH=/usr/bin/nm
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_DESCRIPTION:STATIC=
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_NAME:STATIC=VSConfig
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_READELF:FILEPATH=/usr/bin/readelf
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during all build types.
|
||||
CMAKE_SHARED_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during DEBUG builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during MINSIZEREL builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during RELEASE builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during RELWITHDEBINFO builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//If set, runtime paths are not added when installing shared libraries,
|
||||
// but are added when building.
|
||||
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
|
||||
|
||||
//If set, runtime paths are not added when using shared libraries.
|
||||
CMAKE_SKIP_RPATH:BOOL=NO
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during all build types.
|
||||
CMAKE_STATIC_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during DEBUG builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during MINSIZEREL builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during RELEASE builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during RELWITHDEBINFO builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_STRIP:FILEPATH=/usr/bin/strip
|
||||
|
||||
//If this value is on, makefiles will be generated without the
|
||||
// .SILENT directive, and all commands will be echoed to the console
|
||||
// during the make. This is useful for debugging only. With Visual
|
||||
// Studio IDE projects all commands are done without /nologo.
|
||||
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
|
||||
|
||||
//AS SubProject
|
||||
SUBPROJECT:BOOL=OFF
|
||||
|
||||
//Value Computed by CMake
|
||||
VSConfig_BINARY_DIR:STATIC=/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build
|
||||
|
||||
//Value Computed by CMake
|
||||
VSConfig_IS_TOP_LEVEL:STATIC=ON
|
||||
|
||||
//Value Computed by CMake
|
||||
VSConfig_SOURCE_DIR:STATIC=/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig
|
||||
|
||||
|
||||
########################
|
||||
# INTERNAL cache entries
|
||||
########################
|
||||
|
||||
//ADVANCED property for variable: CMAKE_ADDR2LINE
|
||||
CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_AR
|
||||
CMAKE_AR-ADVANCED:INTERNAL=1
|
||||
//This is the directory where this CMakeCache.txt was created
|
||||
CMAKE_CACHEFILE_DIR:INTERNAL=/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build
|
||||
//Major version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
|
||||
//Minor version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_MINOR_VERSION:INTERNAL=26
|
||||
//Patch version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_PATCH_VERSION:INTERNAL=3
|
||||
//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE
|
||||
CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
|
||||
//Path to CMake executable.
|
||||
CMAKE_COMMAND:INTERNAL=/usr/data/zt/download/cmake-3.26.3/bin/cmake
|
||||
//Path to cpack program executable.
|
||||
CMAKE_CPACK_COMMAND:INTERNAL=/usr/data/zt/download/cmake-3.26.3/bin/cpack
|
||||
//Path to ctest program executable.
|
||||
CMAKE_CTEST_COMMAND:INTERNAL=/usr/data/zt/download/cmake-3.26.3/bin/ctest
|
||||
//ADVANCED property for variable: CMAKE_CXX_COMPILER
|
||||
CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR
|
||||
CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB
|
||||
CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS
|
||||
CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER
|
||||
CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER_AR
|
||||
CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB
|
||||
CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS
|
||||
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
|
||||
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_DLLTOOL
|
||||
CMAKE_DLLTOOL-ADVANCED:INTERNAL=1
|
||||
//Executable file format
|
||||
CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
|
||||
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
|
||||
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
|
||||
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1
|
||||
//Name of external makefile project generator.
|
||||
CMAKE_EXTRA_GENERATOR:INTERNAL=
|
||||
//Name of generator.
|
||||
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
|
||||
//Generator instance identifier.
|
||||
CMAKE_GENERATOR_INSTANCE:INTERNAL=
|
||||
//Name of generator platform.
|
||||
CMAKE_GENERATOR_PLATFORM:INTERNAL=
|
||||
//Name of generator toolset.
|
||||
CMAKE_GENERATOR_TOOLSET:INTERNAL=
|
||||
//Source directory with the top level CMakeLists.txt file for this
|
||||
// project
|
||||
CMAKE_HOME_DIRECTORY:INTERNAL=/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig
|
||||
//Install .so files without execute permission.
|
||||
CMAKE_INSTALL_SO_NO_EXE:INTERNAL=0
|
||||
//ADVANCED property for variable: CMAKE_LINKER
|
||||
CMAKE_LINKER-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
|
||||
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
|
||||
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
|
||||
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_NM
|
||||
CMAKE_NM-ADVANCED:INTERNAL=1
|
||||
//number of local generators
|
||||
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_OBJCOPY
|
||||
CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_OBJDUMP
|
||||
CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
|
||||
//Platform information initialized
|
||||
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_RANLIB
|
||||
CMAKE_RANLIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_READELF
|
||||
CMAKE_READELF-ADVANCED:INTERNAL=1
|
||||
//Path to CMake installation.
|
||||
CMAKE_ROOT:INTERNAL=/usr/data/zt/download/cmake-3.26.3
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
|
||||
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
|
||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
|
||||
CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SKIP_RPATH
|
||||
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS
|
||||
CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG
|
||||
CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STRIP
|
||||
CMAKE_STRIP-ADVANCED:INTERNAL=1
|
||||
//uname command
|
||||
CMAKE_UNAME:INTERNAL=/usr/bin/uname
|
||||
//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
|
||||
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
|
||||
//linker supports push/pop state
|
||||
_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED:INTERNAL=TRUE
|
||||
|
72
utils/VSConfig/build/CMakeFiles/3.26.3/CMakeCCompiler.cmake
Normal file
72
utils/VSConfig/build/CMakeFiles/3.26.3/CMakeCCompiler.cmake
Normal file
@ -0,0 +1,72 @@
|
||||
set(CMAKE_C_COMPILER "/usr/bin/cc")
|
||||
set(CMAKE_C_COMPILER_ARG1 "")
|
||||
set(CMAKE_C_COMPILER_ID "GNU")
|
||||
set(CMAKE_C_COMPILER_VERSION "8.3.1")
|
||||
set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
|
||||
set(CMAKE_C_COMPILER_WRAPPER "")
|
||||
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17")
|
||||
set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON")
|
||||
set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17")
|
||||
set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
|
||||
set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
|
||||
set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
|
||||
set(CMAKE_C17_COMPILE_FEATURES "c_std_17")
|
||||
set(CMAKE_C23_COMPILE_FEATURES "")
|
||||
|
||||
set(CMAKE_C_PLATFORM_ID "Linux")
|
||||
set(CMAKE_C_SIMULATE_ID "")
|
||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
set(CMAKE_C_SIMULATE_VERSION "")
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_AR "/usr/bin/ar")
|
||||
set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar")
|
||||
set(CMAKE_RANLIB "/usr/bin/ranlib")
|
||||
set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib")
|
||||
set(CMAKE_LINKER "/usr/bin/ld")
|
||||
set(CMAKE_MT "")
|
||||
set(CMAKE_COMPILER_IS_GNUCC 1)
|
||||
set(CMAKE_C_COMPILER_LOADED 1)
|
||||
set(CMAKE_C_COMPILER_WORKS TRUE)
|
||||
set(CMAKE_C_ABI_COMPILED TRUE)
|
||||
|
||||
set(CMAKE_C_COMPILER_ENV_VAR "CC")
|
||||
|
||||
set(CMAKE_C_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
|
||||
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
set(CMAKE_C_LINKER_PREFERENCE 10)
|
||||
|
||||
# Save compiler ABI information.
|
||||
set(CMAKE_C_SIZEOF_DATA_PTR "8")
|
||||
set(CMAKE_C_COMPILER_ABI "ELF")
|
||||
set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN")
|
||||
set(CMAKE_C_LIBRARY_ARCHITECTURE "")
|
||||
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
|
||||
if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
|
||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-redhat-linux/8/include;/usr/local/include;/usr/include")
|
||||
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s")
|
||||
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-redhat-linux/8;/usr/lib64;/lib64;/usr/lib")
|
||||
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
@ -0,0 +1,83 @@
|
||||
set(CMAKE_CXX_COMPILER "/usr/bin/c++")
|
||||
set(CMAKE_CXX_COMPILER_ARG1 "")
|
||||
set(CMAKE_CXX_COMPILER_ID "GNU")
|
||||
set(CMAKE_CXX_COMPILER_VERSION "8.3.1")
|
||||
set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "")
|
||||
set(CMAKE_CXX_COMPILER_WRAPPER "")
|
||||
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14")
|
||||
set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON")
|
||||
set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20")
|
||||
set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters")
|
||||
set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
|
||||
set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
|
||||
set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17")
|
||||
set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20")
|
||||
set(CMAKE_CXX23_COMPILE_FEATURES "")
|
||||
|
||||
set(CMAKE_CXX_PLATFORM_ID "Linux")
|
||||
set(CMAKE_CXX_SIMULATE_ID "")
|
||||
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
set(CMAKE_CXX_SIMULATE_VERSION "")
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_AR "/usr/bin/ar")
|
||||
set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar")
|
||||
set(CMAKE_RANLIB "/usr/bin/ranlib")
|
||||
set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib")
|
||||
set(CMAKE_LINKER "/usr/bin/ld")
|
||||
set(CMAKE_MT "")
|
||||
set(CMAKE_COMPILER_IS_GNUCXX 1)
|
||||
set(CMAKE_CXX_COMPILER_LOADED 1)
|
||||
set(CMAKE_CXX_COMPILER_WORKS TRUE)
|
||||
set(CMAKE_CXX_ABI_COMPILED TRUE)
|
||||
|
||||
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
|
||||
|
||||
set(CMAKE_CXX_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm)
|
||||
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
|
||||
foreach (lang C OBJC OBJCXX)
|
||||
if (CMAKE_${lang}_COMPILER_ID_RUN)
|
||||
foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS)
|
||||
list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension})
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(CMAKE_CXX_LINKER_PREFERENCE 30)
|
||||
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
|
||||
|
||||
# Save compiler ABI information.
|
||||
set(CMAKE_CXX_SIZEOF_DATA_PTR "8")
|
||||
set(CMAKE_CXX_COMPILER_ABI "ELF")
|
||||
set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN")
|
||||
set(CMAKE_CXX_LIBRARY_ARCHITECTURE "")
|
||||
|
||||
if(CMAKE_CXX_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "")
|
||||
if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX)
|
||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/8;/usr/include/c++/8/x86_64-redhat-linux;/usr/include/c++/8/backward;/usr/lib/gcc/x86_64-redhat-linux/8/include;/usr/local/include;/usr/include")
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc")
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-redhat-linux/8;/usr/lib64;/lib64;/usr/lib")
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
BIN
utils/VSConfig/build/CMakeFiles/3.26.3/CMakeDetermineCompilerABI_C.bin
Executable file
BIN
utils/VSConfig/build/CMakeFiles/3.26.3/CMakeDetermineCompilerABI_C.bin
Executable file
Binary file not shown.
BIN
utils/VSConfig/build/CMakeFiles/3.26.3/CMakeDetermineCompilerABI_CXX.bin
Executable file
BIN
utils/VSConfig/build/CMakeFiles/3.26.3/CMakeDetermineCompilerABI_CXX.bin
Executable file
Binary file not shown.
15
utils/VSConfig/build/CMakeFiles/3.26.3/CMakeSystem.cmake
Normal file
15
utils/VSConfig/build/CMakeFiles/3.26.3/CMakeSystem.cmake
Normal file
@ -0,0 +1,15 @@
|
||||
set(CMAKE_HOST_SYSTEM "Linux-3.10.0-1160.66.1.el7.x86_64")
|
||||
set(CMAKE_HOST_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_HOST_SYSTEM_VERSION "3.10.0-1160.66.1.el7.x86_64")
|
||||
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
|
||||
|
||||
|
||||
|
||||
set(CMAKE_SYSTEM "Linux-3.10.0-1160.66.1.el7.x86_64")
|
||||
set(CMAKE_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_SYSTEM_VERSION "3.10.0-1160.66.1.el7.x86_64")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
|
||||
|
||||
set(CMAKE_CROSSCOMPILING "FALSE")
|
||||
|
||||
set(CMAKE_SYSTEM_LOADED 1)
|
@ -0,0 +1,866 @@
|
||||
#ifdef __cplusplus
|
||||
# error "A C++ compiler has been selected for C."
|
||||
#endif
|
||||
|
||||
#if defined(__18CXX)
|
||||
# define ID_VOID_MAIN
|
||||
#endif
|
||||
#if defined(__CLASSIC_C__)
|
||||
/* cv-qualifiers did not exist in K&R C */
|
||||
# define const
|
||||
# define volatile
|
||||
#endif
|
||||
|
||||
#if !defined(__has_include)
|
||||
/* If the compiler does not have __has_include, pretend the answer is
|
||||
always no. */
|
||||
# define __has_include(x) 0
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number components: V=Version, R=Revision, P=Patch
|
||||
Version date components: YYYY=Year, MM=Month, DD=Day */
|
||||
|
||||
#if defined(__INTEL_COMPILER) || defined(__ICC)
|
||||
# define COMPILER_ID "Intel"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
# endif
|
||||
/* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later,
|
||||
except that a few beta releases use the old format with V=2021. */
|
||||
# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
|
||||
# if defined(__INTEL_COMPILER_UPDATE)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
|
||||
# else
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
|
||||
# endif
|
||||
# else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE)
|
||||
/* The third version component from --version is an update index,
|
||||
but no macro is provided for it. */
|
||||
# define COMPILER_VERSION_PATCH DEC(0)
|
||||
# endif
|
||||
# if defined(__INTEL_COMPILER_BUILD_DATE)
|
||||
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
|
||||
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
|
||||
# endif
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
# elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
# endif
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER)
|
||||
# define COMPILER_ID "IntelLLVM"
|
||||
#if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
#endif
|
||||
/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
|
||||
* later. Look for 6 digit vs. 8 digit version number to decide encoding.
|
||||
* VVVV is no smaller than the current year when a version is released.
|
||||
*/
|
||||
#if __INTEL_LLVM_COMPILER < 1000000L
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10)
|
||||
#else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100)
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
#elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
#endif
|
||||
#if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
#endif
|
||||
#if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
#elif defined(__PATHCC__)
|
||||
# define COMPILER_ID "PathScale"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
|
||||
# if defined(__PATHCC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
|
||||
# define COMPILER_ID "Embarcadero"
|
||||
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
|
||||
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
|
||||
# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
# define COMPILER_ID "Borland"
|
||||
/* __BORLANDC__ = 0xVRR */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
|
||||
|
||||
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
|
||||
# define COMPILER_ID "Watcom"
|
||||
/* __WATCOMC__ = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# define COMPILER_ID "OpenWatcom"
|
||||
/* __WATCOMC__ = VVRP + 1100 */
|
||||
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__SUNPRO_C)
|
||||
# define COMPILER_ID "SunPro"
|
||||
# if __SUNPRO_C >= 0x5100
|
||||
/* __SUNPRO_C = 0xVRRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
|
||||
# else
|
||||
/* __SUNPRO_CC = 0xVRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
|
||||
# endif
|
||||
|
||||
#elif defined(__HP_cc)
|
||||
# define COMPILER_ID "HP"
|
||||
/* __HP_cc = VVRRPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
|
||||
|
||||
#elif defined(__DECC)
|
||||
# define COMPILER_ID "Compaq"
|
||||
/* __DECC_VER = VVRRTPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
|
||||
|
||||
#elif defined(__IBMC__) && defined(__COMPILER_VER__)
|
||||
# define COMPILER_ID "zOS"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__open_xl__) && defined(__clang__)
|
||||
# define COMPILER_ID "IBMClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__open_xl_release__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__)
|
||||
|
||||
|
||||
#elif defined(__ibmxl__) && defined(__clang__)
|
||||
# define COMPILER_ID "XLClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
|
||||
|
||||
|
||||
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800
|
||||
# define COMPILER_ID "XL"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
|
||||
# define COMPILER_ID "VisualAge"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__NVCOMPILER)
|
||||
# define COMPILER_ID "NVHPC"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
|
||||
# if defined(__NVCOMPILER_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__PGI)
|
||||
# define COMPILER_ID "PGI"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
|
||||
# if defined(__PGIC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_CRAYC)
|
||||
# define COMPILER_ID "Cray"
|
||||
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# define COMPILER_ID "TI"
|
||||
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
|
||||
|
||||
#elif defined(__CLANG_FUJITSU)
|
||||
# define COMPILER_ID "FujitsuClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
|
||||
|
||||
|
||||
#elif defined(__FUJITSU)
|
||||
# define COMPILER_ID "Fujitsu"
|
||||
# if defined(__FCC_version__)
|
||||
# define COMPILER_VERSION __FCC_version__
|
||||
# elif defined(__FCC_major__)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# endif
|
||||
# if defined(__fcc_version)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
|
||||
# elif defined(__FCC_VERSION)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
|
||||
# endif
|
||||
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# define COMPILER_ID "GHS"
|
||||
/* __GHS_VERSION_NUMBER = VVVVRP */
|
||||
# ifdef __GHS_VERSION_NUMBER
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__TASKING__)
|
||||
# define COMPILER_ID "Tasking"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__VERSION__)
|
||||
|
||||
#elif defined(__TINYC__)
|
||||
# define COMPILER_ID "TinyCC"
|
||||
|
||||
#elif defined(__BCC__)
|
||||
# define COMPILER_ID "Bruce"
|
||||
|
||||
#elif defined(__SCO_VERSION__)
|
||||
# define COMPILER_ID "SCO"
|
||||
|
||||
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
|
||||
# define COMPILER_ID "ARMCC"
|
||||
#if __ARMCC_VERSION >= 1000000
|
||||
/* __ARMCC_VERSION = VRRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#else
|
||||
/* __ARMCC_VERSION = VRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#endif
|
||||
|
||||
|
||||
#elif defined(__clang__) && defined(__apple_build_version__)
|
||||
# define COMPILER_ID "AppleClang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
|
||||
|
||||
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
|
||||
# define COMPILER_ID "ARMClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
|
||||
|
||||
#elif defined(__clang__)
|
||||
# define COMPILER_ID "Clang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
|
||||
#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))
|
||||
# define COMPILER_ID "LCC"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100)
|
||||
# if defined(__LCC_MINOR__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
# define COMPILER_ID "GNU"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
# define COMPILER_ID "MSVC"
|
||||
/* _MSC_VER = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# if defined(_MSC_FULL_VER)
|
||||
# if _MSC_VER >= 1400
|
||||
/* _MSC_FULL_VER = VVRRPPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
|
||||
# else
|
||||
/* _MSC_FULL_VER = VVRRPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
|
||||
# endif
|
||||
# endif
|
||||
# if defined(_MSC_BUILD)
|
||||
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
|
||||
# endif
|
||||
|
||||
#elif defined(_ADI_COMPILER)
|
||||
# define COMPILER_ID "ADSP"
|
||||
#if defined(__VERSIONNUM__)
|
||||
/* __VERSIONNUM__ = 0xVVRRPPTT */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF)
|
||||
# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF)
|
||||
#endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# define COMPILER_ID "IAR"
|
||||
# if defined(__VER__) && defined(__ICCARM__)
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
|
||||
# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# endif
|
||||
|
||||
#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
|
||||
# define COMPILER_ID "SDCC"
|
||||
# if defined(__SDCC_VERSION_MAJOR)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
|
||||
# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
|
||||
# else
|
||||
/* SDCC = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
|
||||
# endif
|
||||
|
||||
|
||||
/* These compilers are either not known or too old to define an
|
||||
identification macro. Try to identify the platform and guess that
|
||||
it is the native compiler. */
|
||||
#elif defined(__hpux) || defined(__hpua)
|
||||
# define COMPILER_ID "HP"
|
||||
|
||||
#else /* unknown compiler */
|
||||
# define COMPILER_ID ""
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||
#ifdef SIMULATE_ID
|
||||
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
||||
#endif
|
||||
|
||||
#ifdef __QNXNTO__
|
||||
char const* qnxnto = "INFO" ":" "qnxnto[]";
|
||||
#endif
|
||||
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
|
||||
#endif
|
||||
|
||||
#define STRINGIFY_HELPER(X) #X
|
||||
#define STRINGIFY(X) STRINGIFY_HELPER(X)
|
||||
|
||||
/* Identify known platforms by name. */
|
||||
#if defined(__linux) || defined(__linux__) || defined(linux)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
#elif defined(__MSYS__)
|
||||
# define PLATFORM_ID "MSYS"
|
||||
|
||||
#elif defined(__CYGWIN__)
|
||||
# define PLATFORM_ID "Cygwin"
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define PLATFORM_ID "MinGW"
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
# define PLATFORM_ID "Darwin"
|
||||
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
# define PLATFORM_ID "Windows"
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD)
|
||||
# define PLATFORM_ID "FreeBSD"
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__NetBSD)
|
||||
# define PLATFORM_ID "NetBSD"
|
||||
|
||||
#elif defined(__OpenBSD__) || defined(__OPENBSD)
|
||||
# define PLATFORM_ID "OpenBSD"
|
||||
|
||||
#elif defined(__sun) || defined(sun)
|
||||
# define PLATFORM_ID "SunOS"
|
||||
|
||||
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
|
||||
# define PLATFORM_ID "AIX"
|
||||
|
||||
#elif defined(__hpux) || defined(__hpux__)
|
||||
# define PLATFORM_ID "HP-UX"
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
# define PLATFORM_ID "Haiku"
|
||||
|
||||
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
|
||||
# define PLATFORM_ID "BeOS"
|
||||
|
||||
#elif defined(__QNX__) || defined(__QNXNTO__)
|
||||
# define PLATFORM_ID "QNX"
|
||||
|
||||
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
|
||||
# define PLATFORM_ID "Tru64"
|
||||
|
||||
#elif defined(__riscos) || defined(__riscos__)
|
||||
# define PLATFORM_ID "RISCos"
|
||||
|
||||
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
|
||||
# define PLATFORM_ID "SINIX"
|
||||
|
||||
#elif defined(__UNIX_SV__)
|
||||
# define PLATFORM_ID "UNIX_SV"
|
||||
|
||||
#elif defined(__bsdos__)
|
||||
# define PLATFORM_ID "BSDOS"
|
||||
|
||||
#elif defined(_MPRAS) || defined(MPRAS)
|
||||
# define PLATFORM_ID "MP-RAS"
|
||||
|
||||
#elif defined(__osf) || defined(__osf__)
|
||||
# define PLATFORM_ID "OSF1"
|
||||
|
||||
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
|
||||
# define PLATFORM_ID "SCO_SV"
|
||||
|
||||
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
|
||||
# define PLATFORM_ID "ULTRIX"
|
||||
|
||||
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
|
||||
# define PLATFORM_ID "Xenix"
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(__LINUX__)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
# elif defined(__DOS__)
|
||||
# define PLATFORM_ID "DOS"
|
||||
|
||||
# elif defined(__OS2__)
|
||||
# define PLATFORM_ID "OS2"
|
||||
|
||||
# elif defined(__WINDOWS__)
|
||||
# define PLATFORM_ID "Windows3x"
|
||||
|
||||
# elif defined(__VXWORKS__)
|
||||
# define PLATFORM_ID "VxWorks"
|
||||
|
||||
# else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
# endif
|
||||
|
||||
#elif defined(__INTEGRITY)
|
||||
# if defined(INT_178B)
|
||||
# define PLATFORM_ID "Integrity178"
|
||||
|
||||
# else /* regular Integrity */
|
||||
# define PLATFORM_ID "Integrity"
|
||||
# endif
|
||||
|
||||
# elif defined(_ADI_COMPILER)
|
||||
# define PLATFORM_ID "ADSP"
|
||||
|
||||
#else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
|
||||
#endif
|
||||
|
||||
/* For windows compilers MSVC and Intel we can determine
|
||||
the architecture of the compiler being used. This is because
|
||||
the compilers do not have flags that can change the architecture,
|
||||
but rather depend on which compiler is being used
|
||||
*/
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
# if defined(_M_IA64)
|
||||
# define ARCHITECTURE_ID "IA64"
|
||||
|
||||
# elif defined(_M_ARM64EC)
|
||||
# define ARCHITECTURE_ID "ARM64EC"
|
||||
|
||||
# elif defined(_M_X64) || defined(_M_AMD64)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# elif defined(_M_ARM64)
|
||||
# define ARCHITECTURE_ID "ARM64"
|
||||
|
||||
# elif defined(_M_ARM)
|
||||
# if _M_ARM == 4
|
||||
# define ARCHITECTURE_ID "ARMV4I"
|
||||
# elif _M_ARM == 5
|
||||
# define ARCHITECTURE_ID "ARMV5I"
|
||||
# else
|
||||
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
|
||||
# endif
|
||||
|
||||
# elif defined(_M_MIPS)
|
||||
# define ARCHITECTURE_ID "MIPS"
|
||||
|
||||
# elif defined(_M_SH)
|
||||
# define ARCHITECTURE_ID "SHx"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(_M_I86)
|
||||
# define ARCHITECTURE_ID "I86"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# if defined(__ICCARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__ICCRX__)
|
||||
# define ARCHITECTURE_ID "RX"
|
||||
|
||||
# elif defined(__ICCRH850__)
|
||||
# define ARCHITECTURE_ID "RH850"
|
||||
|
||||
# elif defined(__ICCRL78__)
|
||||
# define ARCHITECTURE_ID "RL78"
|
||||
|
||||
# elif defined(__ICCRISCV__)
|
||||
# define ARCHITECTURE_ID "RISCV"
|
||||
|
||||
# elif defined(__ICCAVR__)
|
||||
# define ARCHITECTURE_ID "AVR"
|
||||
|
||||
# elif defined(__ICC430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__ICCV850__)
|
||||
# define ARCHITECTURE_ID "V850"
|
||||
|
||||
# elif defined(__ICC8051__)
|
||||
# define ARCHITECTURE_ID "8051"
|
||||
|
||||
# elif defined(__ICCSTM8__)
|
||||
# define ARCHITECTURE_ID "STM8"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# if defined(__PPC64__)
|
||||
# define ARCHITECTURE_ID "PPC64"
|
||||
|
||||
# elif defined(__ppc__)
|
||||
# define ARCHITECTURE_ID "PPC"
|
||||
|
||||
# elif defined(__ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__x86_64__)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(__i386__)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# if defined(__TI_ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__MSP430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__TMS320C28XX__)
|
||||
# define ARCHITECTURE_ID "TMS320C28x"
|
||||
|
||||
# elif defined(__TMS320C6X__) || defined(_TMS320C6X)
|
||||
# define ARCHITECTURE_ID "TMS320C6x"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
# elif defined(__ADSPSHARC__)
|
||||
# define ARCHITECTURE_ID "SHARC"
|
||||
|
||||
# elif defined(__ADSPBLACKFIN__)
|
||||
# define ARCHITECTURE_ID "Blackfin"
|
||||
|
||||
#elif defined(__TASKING__)
|
||||
|
||||
# if defined(__CTC__) || defined(__CPTC__)
|
||||
# define ARCHITECTURE_ID "TriCore"
|
||||
|
||||
# elif defined(__CMCS__)
|
||||
# define ARCHITECTURE_ID "MCS"
|
||||
|
||||
# elif defined(__CARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__CARC__)
|
||||
# define ARCHITECTURE_ID "ARC"
|
||||
|
||||
# elif defined(__C51__)
|
||||
# define ARCHITECTURE_ID "8051"
|
||||
|
||||
# elif defined(__CPCP__)
|
||||
# define ARCHITECTURE_ID "PCP"
|
||||
|
||||
# else
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#else
|
||||
# define ARCHITECTURE_ID
|
||||
#endif
|
||||
|
||||
/* Convert integer to decimal digit literals. */
|
||||
#define DEC(n) \
|
||||
('0' + (((n) / 10000000)%10)), \
|
||||
('0' + (((n) / 1000000)%10)), \
|
||||
('0' + (((n) / 100000)%10)), \
|
||||
('0' + (((n) / 10000)%10)), \
|
||||
('0' + (((n) / 1000)%10)), \
|
||||
('0' + (((n) / 100)%10)), \
|
||||
('0' + (((n) / 10)%10)), \
|
||||
('0' + ((n) % 10))
|
||||
|
||||
/* Convert integer to hex digit literals. */
|
||||
#define HEX(n) \
|
||||
('0' + ((n)>>28 & 0xF)), \
|
||||
('0' + ((n)>>24 & 0xF)), \
|
||||
('0' + ((n)>>20 & 0xF)), \
|
||||
('0' + ((n)>>16 & 0xF)), \
|
||||
('0' + ((n)>>12 & 0xF)), \
|
||||
('0' + ((n)>>8 & 0xF)), \
|
||||
('0' + ((n)>>4 & 0xF)), \
|
||||
('0' + ((n) & 0xF))
|
||||
|
||||
/* Construct a string literal encoding the version number. */
|
||||
#ifdef COMPILER_VERSION
|
||||
char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#elif defined(COMPILER_VERSION_MAJOR)
|
||||
char const info_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
|
||||
COMPILER_VERSION_MAJOR,
|
||||
# ifdef COMPILER_VERSION_MINOR
|
||||
'.', COMPILER_VERSION_MINOR,
|
||||
# ifdef COMPILER_VERSION_PATCH
|
||||
'.', COMPILER_VERSION_PATCH,
|
||||
# ifdef COMPILER_VERSION_TWEAK
|
||||
'.', COMPILER_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the internal version number. */
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
char const info_version_internal[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
|
||||
'i','n','t','e','r','n','a','l','[',
|
||||
COMPILER_VERSION_INTERNAL,']','\0'};
|
||||
#elif defined(COMPILER_VERSION_INTERNAL_STR)
|
||||
char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
char const info_simulate_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
|
||||
SIMULATE_VERSION_MAJOR,
|
||||
# ifdef SIMULATE_VERSION_MINOR
|
||||
'.', SIMULATE_VERSION_MINOR,
|
||||
# ifdef SIMULATE_VERSION_PATCH
|
||||
'.', SIMULATE_VERSION_PATCH,
|
||||
# ifdef SIMULATE_VERSION_TWEAK
|
||||
'.', SIMULATE_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
|
||||
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
|
||||
|
||||
|
||||
|
||||
#if !defined(__STDC__) && !defined(__clang__)
|
||||
# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
|
||||
# define C_VERSION "90"
|
||||
# else
|
||||
# define C_VERSION
|
||||
# endif
|
||||
#elif __STDC_VERSION__ > 201710L
|
||||
# define C_VERSION "23"
|
||||
#elif __STDC_VERSION__ >= 201710L
|
||||
# define C_VERSION "17"
|
||||
#elif __STDC_VERSION__ >= 201000L
|
||||
# define C_VERSION "11"
|
||||
#elif __STDC_VERSION__ >= 199901L
|
||||
# define C_VERSION "99"
|
||||
#else
|
||||
# define C_VERSION "90"
|
||||
#endif
|
||||
const char* info_language_standard_default =
|
||||
"INFO" ":" "standard_default[" C_VERSION "]";
|
||||
|
||||
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
|
||||
#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
|
||||
defined(__TI_COMPILER_VERSION__)) && \
|
||||
!defined(__STRICT_ANSI__)
|
||||
"ON"
|
||||
#else
|
||||
"OFF"
|
||||
#endif
|
||||
"]";
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef ID_VOID_MAIN
|
||||
void main() {}
|
||||
#else
|
||||
# if defined(__CLASSIC_C__)
|
||||
int main(argc, argv) int argc; char *argv[];
|
||||
# else
|
||||
int main(int argc, char* argv[])
|
||||
# endif
|
||||
{
|
||||
int require = 0;
|
||||
require += info_compiler[argc];
|
||||
require += info_platform[argc];
|
||||
require += info_arch[argc];
|
||||
#ifdef COMPILER_VERSION_MAJOR
|
||||
require += info_version[argc];
|
||||
#endif
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
require += info_version_internal[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_ID
|
||||
require += info_simulate[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
require += info_simulate_version[argc];
|
||||
#endif
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
require += info_cray[argc];
|
||||
#endif
|
||||
require += info_language_standard_default[argc];
|
||||
require += info_language_extensions_default[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
||||
#endif
|
BIN
utils/VSConfig/build/CMakeFiles/3.26.3/CompilerIdC/a.out
Executable file
BIN
utils/VSConfig/build/CMakeFiles/3.26.3/CompilerIdC/a.out
Executable file
Binary file not shown.
@ -0,0 +1,855 @@
|
||||
/* This source file must have a .cpp extension so that all C++ compilers
|
||||
recognize the extension without flags. Borland does not know .cxx for
|
||||
example. */
|
||||
#ifndef __cplusplus
|
||||
# error "A C compiler has been selected for C++."
|
||||
#endif
|
||||
|
||||
#if !defined(__has_include)
|
||||
/* If the compiler does not have __has_include, pretend the answer is
|
||||
always no. */
|
||||
# define __has_include(x) 0
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number components: V=Version, R=Revision, P=Patch
|
||||
Version date components: YYYY=Year, MM=Month, DD=Day */
|
||||
|
||||
#if defined(__COMO__)
|
||||
# define COMPILER_ID "Comeau"
|
||||
/* __COMO_VERSION__ = VRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
|
||||
|
||||
#elif defined(__INTEL_COMPILER) || defined(__ICC)
|
||||
# define COMPILER_ID "Intel"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
# endif
|
||||
/* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later,
|
||||
except that a few beta releases use the old format with V=2021. */
|
||||
# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
|
||||
# if defined(__INTEL_COMPILER_UPDATE)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
|
||||
# else
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
|
||||
# endif
|
||||
# else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE)
|
||||
/* The third version component from --version is an update index,
|
||||
but no macro is provided for it. */
|
||||
# define COMPILER_VERSION_PATCH DEC(0)
|
||||
# endif
|
||||
# if defined(__INTEL_COMPILER_BUILD_DATE)
|
||||
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
|
||||
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
|
||||
# endif
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
# elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
# endif
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER)
|
||||
# define COMPILER_ID "IntelLLVM"
|
||||
#if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
#endif
|
||||
/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
|
||||
* later. Look for 6 digit vs. 8 digit version number to decide encoding.
|
||||
* VVVV is no smaller than the current year when a version is released.
|
||||
*/
|
||||
#if __INTEL_LLVM_COMPILER < 1000000L
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10)
|
||||
#else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100)
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
#elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
#endif
|
||||
#if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
#endif
|
||||
#if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
#elif defined(__PATHCC__)
|
||||
# define COMPILER_ID "PathScale"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
|
||||
# if defined(__PATHCC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
|
||||
# define COMPILER_ID "Embarcadero"
|
||||
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
|
||||
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
|
||||
# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
# define COMPILER_ID "Borland"
|
||||
/* __BORLANDC__ = 0xVRR */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
|
||||
|
||||
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
|
||||
# define COMPILER_ID "Watcom"
|
||||
/* __WATCOMC__ = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# define COMPILER_ID "OpenWatcom"
|
||||
/* __WATCOMC__ = VVRP + 1100 */
|
||||
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__SUNPRO_CC)
|
||||
# define COMPILER_ID "SunPro"
|
||||
# if __SUNPRO_CC >= 0x5100
|
||||
/* __SUNPRO_CC = 0xVRRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
|
||||
# else
|
||||
/* __SUNPRO_CC = 0xVRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
|
||||
# endif
|
||||
|
||||
#elif defined(__HP_aCC)
|
||||
# define COMPILER_ID "HP"
|
||||
/* __HP_aCC = VVRRPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
|
||||
|
||||
#elif defined(__DECCXX)
|
||||
# define COMPILER_ID "Compaq"
|
||||
/* __DECCXX_VER = VVRRTPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
|
||||
|
||||
#elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
|
||||
# define COMPILER_ID "zOS"
|
||||
/* __IBMCPP__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
|
||||
|
||||
#elif defined(__open_xl__) && defined(__clang__)
|
||||
# define COMPILER_ID "IBMClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__open_xl_release__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__)
|
||||
|
||||
|
||||
#elif defined(__ibmxl__) && defined(__clang__)
|
||||
# define COMPILER_ID "XLClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
|
||||
|
||||
|
||||
#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
|
||||
# define COMPILER_ID "XL"
|
||||
/* __IBMCPP__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
|
||||
|
||||
#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
|
||||
# define COMPILER_ID "VisualAge"
|
||||
/* __IBMCPP__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
|
||||
|
||||
#elif defined(__NVCOMPILER)
|
||||
# define COMPILER_ID "NVHPC"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
|
||||
# if defined(__NVCOMPILER_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__PGI)
|
||||
# define COMPILER_ID "PGI"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
|
||||
# if defined(__PGIC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_CRAYC)
|
||||
# define COMPILER_ID "Cray"
|
||||
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# define COMPILER_ID "TI"
|
||||
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
|
||||
|
||||
#elif defined(__CLANG_FUJITSU)
|
||||
# define COMPILER_ID "FujitsuClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
|
||||
|
||||
|
||||
#elif defined(__FUJITSU)
|
||||
# define COMPILER_ID "Fujitsu"
|
||||
# if defined(__FCC_version__)
|
||||
# define COMPILER_VERSION __FCC_version__
|
||||
# elif defined(__FCC_major__)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# endif
|
||||
# if defined(__fcc_version)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
|
||||
# elif defined(__FCC_VERSION)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
|
||||
# endif
|
||||
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# define COMPILER_ID "GHS"
|
||||
/* __GHS_VERSION_NUMBER = VVVVRP */
|
||||
# ifdef __GHS_VERSION_NUMBER
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__TASKING__)
|
||||
# define COMPILER_ID "Tasking"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__VERSION__)
|
||||
|
||||
#elif defined(__SCO_VERSION__)
|
||||
# define COMPILER_ID "SCO"
|
||||
|
||||
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
|
||||
# define COMPILER_ID "ARMCC"
|
||||
#if __ARMCC_VERSION >= 1000000
|
||||
/* __ARMCC_VERSION = VRRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#else
|
||||
/* __ARMCC_VERSION = VRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#endif
|
||||
|
||||
|
||||
#elif defined(__clang__) && defined(__apple_build_version__)
|
||||
# define COMPILER_ID "AppleClang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
|
||||
|
||||
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
|
||||
# define COMPILER_ID "ARMClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
|
||||
|
||||
#elif defined(__clang__)
|
||||
# define COMPILER_ID "Clang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
|
||||
#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))
|
||||
# define COMPILER_ID "LCC"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100)
|
||||
# if defined(__LCC_MINOR__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
||||
# define COMPILER_ID "GNU"
|
||||
# if defined(__GNUC__)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
|
||||
# else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GNUG__)
|
||||
# endif
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
# define COMPILER_ID "MSVC"
|
||||
/* _MSC_VER = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# if defined(_MSC_FULL_VER)
|
||||
# if _MSC_VER >= 1400
|
||||
/* _MSC_FULL_VER = VVRRPPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
|
||||
# else
|
||||
/* _MSC_FULL_VER = VVRRPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
|
||||
# endif
|
||||
# endif
|
||||
# if defined(_MSC_BUILD)
|
||||
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
|
||||
# endif
|
||||
|
||||
#elif defined(_ADI_COMPILER)
|
||||
# define COMPILER_ID "ADSP"
|
||||
#if defined(__VERSIONNUM__)
|
||||
/* __VERSIONNUM__ = 0xVVRRPPTT */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF)
|
||||
# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF)
|
||||
#endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# define COMPILER_ID "IAR"
|
||||
# if defined(__VER__) && defined(__ICCARM__)
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
|
||||
# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# endif
|
||||
|
||||
|
||||
/* These compilers are either not known or too old to define an
|
||||
identification macro. Try to identify the platform and guess that
|
||||
it is the native compiler. */
|
||||
#elif defined(__hpux) || defined(__hpua)
|
||||
# define COMPILER_ID "HP"
|
||||
|
||||
#else /* unknown compiler */
|
||||
# define COMPILER_ID ""
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||
#ifdef SIMULATE_ID
|
||||
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
||||
#endif
|
||||
|
||||
#ifdef __QNXNTO__
|
||||
char const* qnxnto = "INFO" ":" "qnxnto[]";
|
||||
#endif
|
||||
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
|
||||
#endif
|
||||
|
||||
#define STRINGIFY_HELPER(X) #X
|
||||
#define STRINGIFY(X) STRINGIFY_HELPER(X)
|
||||
|
||||
/* Identify known platforms by name. */
|
||||
#if defined(__linux) || defined(__linux__) || defined(linux)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
#elif defined(__MSYS__)
|
||||
# define PLATFORM_ID "MSYS"
|
||||
|
||||
#elif defined(__CYGWIN__)
|
||||
# define PLATFORM_ID "Cygwin"
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define PLATFORM_ID "MinGW"
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
# define PLATFORM_ID "Darwin"
|
||||
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
# define PLATFORM_ID "Windows"
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD)
|
||||
# define PLATFORM_ID "FreeBSD"
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__NetBSD)
|
||||
# define PLATFORM_ID "NetBSD"
|
||||
|
||||
#elif defined(__OpenBSD__) || defined(__OPENBSD)
|
||||
# define PLATFORM_ID "OpenBSD"
|
||||
|
||||
#elif defined(__sun) || defined(sun)
|
||||
# define PLATFORM_ID "SunOS"
|
||||
|
||||
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
|
||||
# define PLATFORM_ID "AIX"
|
||||
|
||||
#elif defined(__hpux) || defined(__hpux__)
|
||||
# define PLATFORM_ID "HP-UX"
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
# define PLATFORM_ID "Haiku"
|
||||
|
||||
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
|
||||
# define PLATFORM_ID "BeOS"
|
||||
|
||||
#elif defined(__QNX__) || defined(__QNXNTO__)
|
||||
# define PLATFORM_ID "QNX"
|
||||
|
||||
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
|
||||
# define PLATFORM_ID "Tru64"
|
||||
|
||||
#elif defined(__riscos) || defined(__riscos__)
|
||||
# define PLATFORM_ID "RISCos"
|
||||
|
||||
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
|
||||
# define PLATFORM_ID "SINIX"
|
||||
|
||||
#elif defined(__UNIX_SV__)
|
||||
# define PLATFORM_ID "UNIX_SV"
|
||||
|
||||
#elif defined(__bsdos__)
|
||||
# define PLATFORM_ID "BSDOS"
|
||||
|
||||
#elif defined(_MPRAS) || defined(MPRAS)
|
||||
# define PLATFORM_ID "MP-RAS"
|
||||
|
||||
#elif defined(__osf) || defined(__osf__)
|
||||
# define PLATFORM_ID "OSF1"
|
||||
|
||||
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
|
||||
# define PLATFORM_ID "SCO_SV"
|
||||
|
||||
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
|
||||
# define PLATFORM_ID "ULTRIX"
|
||||
|
||||
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
|
||||
# define PLATFORM_ID "Xenix"
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(__LINUX__)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
# elif defined(__DOS__)
|
||||
# define PLATFORM_ID "DOS"
|
||||
|
||||
# elif defined(__OS2__)
|
||||
# define PLATFORM_ID "OS2"
|
||||
|
||||
# elif defined(__WINDOWS__)
|
||||
# define PLATFORM_ID "Windows3x"
|
||||
|
||||
# elif defined(__VXWORKS__)
|
||||
# define PLATFORM_ID "VxWorks"
|
||||
|
||||
# else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
# endif
|
||||
|
||||
#elif defined(__INTEGRITY)
|
||||
# if defined(INT_178B)
|
||||
# define PLATFORM_ID "Integrity178"
|
||||
|
||||
# else /* regular Integrity */
|
||||
# define PLATFORM_ID "Integrity"
|
||||
# endif
|
||||
|
||||
# elif defined(_ADI_COMPILER)
|
||||
# define PLATFORM_ID "ADSP"
|
||||
|
||||
#else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
|
||||
#endif
|
||||
|
||||
/* For windows compilers MSVC and Intel we can determine
|
||||
the architecture of the compiler being used. This is because
|
||||
the compilers do not have flags that can change the architecture,
|
||||
but rather depend on which compiler is being used
|
||||
*/
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
# if defined(_M_IA64)
|
||||
# define ARCHITECTURE_ID "IA64"
|
||||
|
||||
# elif defined(_M_ARM64EC)
|
||||
# define ARCHITECTURE_ID "ARM64EC"
|
||||
|
||||
# elif defined(_M_X64) || defined(_M_AMD64)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# elif defined(_M_ARM64)
|
||||
# define ARCHITECTURE_ID "ARM64"
|
||||
|
||||
# elif defined(_M_ARM)
|
||||
# if _M_ARM == 4
|
||||
# define ARCHITECTURE_ID "ARMV4I"
|
||||
# elif _M_ARM == 5
|
||||
# define ARCHITECTURE_ID "ARMV5I"
|
||||
# else
|
||||
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
|
||||
# endif
|
||||
|
||||
# elif defined(_M_MIPS)
|
||||
# define ARCHITECTURE_ID "MIPS"
|
||||
|
||||
# elif defined(_M_SH)
|
||||
# define ARCHITECTURE_ID "SHx"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(_M_I86)
|
||||
# define ARCHITECTURE_ID "I86"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# if defined(__ICCARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__ICCRX__)
|
||||
# define ARCHITECTURE_ID "RX"
|
||||
|
||||
# elif defined(__ICCRH850__)
|
||||
# define ARCHITECTURE_ID "RH850"
|
||||
|
||||
# elif defined(__ICCRL78__)
|
||||
# define ARCHITECTURE_ID "RL78"
|
||||
|
||||
# elif defined(__ICCRISCV__)
|
||||
# define ARCHITECTURE_ID "RISCV"
|
||||
|
||||
# elif defined(__ICCAVR__)
|
||||
# define ARCHITECTURE_ID "AVR"
|
||||
|
||||
# elif defined(__ICC430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__ICCV850__)
|
||||
# define ARCHITECTURE_ID "V850"
|
||||
|
||||
# elif defined(__ICC8051__)
|
||||
# define ARCHITECTURE_ID "8051"
|
||||
|
||||
# elif defined(__ICCSTM8__)
|
||||
# define ARCHITECTURE_ID "STM8"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# if defined(__PPC64__)
|
||||
# define ARCHITECTURE_ID "PPC64"
|
||||
|
||||
# elif defined(__ppc__)
|
||||
# define ARCHITECTURE_ID "PPC"
|
||||
|
||||
# elif defined(__ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__x86_64__)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(__i386__)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# if defined(__TI_ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__MSP430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__TMS320C28XX__)
|
||||
# define ARCHITECTURE_ID "TMS320C28x"
|
||||
|
||||
# elif defined(__TMS320C6X__) || defined(_TMS320C6X)
|
||||
# define ARCHITECTURE_ID "TMS320C6x"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
# elif defined(__ADSPSHARC__)
|
||||
# define ARCHITECTURE_ID "SHARC"
|
||||
|
||||
# elif defined(__ADSPBLACKFIN__)
|
||||
# define ARCHITECTURE_ID "Blackfin"
|
||||
|
||||
#elif defined(__TASKING__)
|
||||
|
||||
# if defined(__CTC__) || defined(__CPTC__)
|
||||
# define ARCHITECTURE_ID "TriCore"
|
||||
|
||||
# elif defined(__CMCS__)
|
||||
# define ARCHITECTURE_ID "MCS"
|
||||
|
||||
# elif defined(__CARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__CARC__)
|
||||
# define ARCHITECTURE_ID "ARC"
|
||||
|
||||
# elif defined(__C51__)
|
||||
# define ARCHITECTURE_ID "8051"
|
||||
|
||||
# elif defined(__CPCP__)
|
||||
# define ARCHITECTURE_ID "PCP"
|
||||
|
||||
# else
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#else
|
||||
# define ARCHITECTURE_ID
|
||||
#endif
|
||||
|
||||
/* Convert integer to decimal digit literals. */
|
||||
#define DEC(n) \
|
||||
('0' + (((n) / 10000000)%10)), \
|
||||
('0' + (((n) / 1000000)%10)), \
|
||||
('0' + (((n) / 100000)%10)), \
|
||||
('0' + (((n) / 10000)%10)), \
|
||||
('0' + (((n) / 1000)%10)), \
|
||||
('0' + (((n) / 100)%10)), \
|
||||
('0' + (((n) / 10)%10)), \
|
||||
('0' + ((n) % 10))
|
||||
|
||||
/* Convert integer to hex digit literals. */
|
||||
#define HEX(n) \
|
||||
('0' + ((n)>>28 & 0xF)), \
|
||||
('0' + ((n)>>24 & 0xF)), \
|
||||
('0' + ((n)>>20 & 0xF)), \
|
||||
('0' + ((n)>>16 & 0xF)), \
|
||||
('0' + ((n)>>12 & 0xF)), \
|
||||
('0' + ((n)>>8 & 0xF)), \
|
||||
('0' + ((n)>>4 & 0xF)), \
|
||||
('0' + ((n) & 0xF))
|
||||
|
||||
/* Construct a string literal encoding the version number. */
|
||||
#ifdef COMPILER_VERSION
|
||||
char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#elif defined(COMPILER_VERSION_MAJOR)
|
||||
char const info_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
|
||||
COMPILER_VERSION_MAJOR,
|
||||
# ifdef COMPILER_VERSION_MINOR
|
||||
'.', COMPILER_VERSION_MINOR,
|
||||
# ifdef COMPILER_VERSION_PATCH
|
||||
'.', COMPILER_VERSION_PATCH,
|
||||
# ifdef COMPILER_VERSION_TWEAK
|
||||
'.', COMPILER_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the internal version number. */
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
char const info_version_internal[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
|
||||
'i','n','t','e','r','n','a','l','[',
|
||||
COMPILER_VERSION_INTERNAL,']','\0'};
|
||||
#elif defined(COMPILER_VERSION_INTERNAL_STR)
|
||||
char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
char const info_simulate_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
|
||||
SIMULATE_VERSION_MAJOR,
|
||||
# ifdef SIMULATE_VERSION_MINOR
|
||||
'.', SIMULATE_VERSION_MINOR,
|
||||
# ifdef SIMULATE_VERSION_PATCH
|
||||
'.', SIMULATE_VERSION_PATCH,
|
||||
# ifdef SIMULATE_VERSION_TWEAK
|
||||
'.', SIMULATE_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
|
||||
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
|
||||
|
||||
|
||||
|
||||
#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
|
||||
# if defined(__INTEL_CXX11_MODE__)
|
||||
# if defined(__cpp_aggregate_nsdmi)
|
||||
# define CXX_STD 201402L
|
||||
# else
|
||||
# define CXX_STD 201103L
|
||||
# endif
|
||||
# else
|
||||
# define CXX_STD 199711L
|
||||
# endif
|
||||
#elif defined(_MSC_VER) && defined(_MSVC_LANG)
|
||||
# define CXX_STD _MSVC_LANG
|
||||
#else
|
||||
# define CXX_STD __cplusplus
|
||||
#endif
|
||||
|
||||
const char* info_language_standard_default = "INFO" ":" "standard_default["
|
||||
#if CXX_STD > 202002L
|
||||
"23"
|
||||
#elif CXX_STD > 201703L
|
||||
"20"
|
||||
#elif CXX_STD >= 201703L
|
||||
"17"
|
||||
#elif CXX_STD >= 201402L
|
||||
"14"
|
||||
#elif CXX_STD >= 201103L
|
||||
"11"
|
||||
#else
|
||||
"98"
|
||||
#endif
|
||||
"]";
|
||||
|
||||
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
|
||||
#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
|
||||
defined(__TI_COMPILER_VERSION__)) && \
|
||||
!defined(__STRICT_ANSI__)
|
||||
"ON"
|
||||
#else
|
||||
"OFF"
|
||||
#endif
|
||||
"]";
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int require = 0;
|
||||
require += info_compiler[argc];
|
||||
require += info_platform[argc];
|
||||
require += info_arch[argc];
|
||||
#ifdef COMPILER_VERSION_MAJOR
|
||||
require += info_version[argc];
|
||||
#endif
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
require += info_version_internal[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_ID
|
||||
require += info_simulate[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
require += info_simulate_version[argc];
|
||||
#endif
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
require += info_cray[argc];
|
||||
#endif
|
||||
require += info_language_standard_default[argc];
|
||||
require += info_language_extensions_default[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
BIN
utils/VSConfig/build/CMakeFiles/3.26.3/CompilerIdCXX/a.out
Executable file
BIN
utils/VSConfig/build/CMakeFiles/3.26.3/CompilerIdCXX/a.out
Executable file
Binary file not shown.
497
utils/VSConfig/build/CMakeFiles/CMakeConfigureLog.yaml
Normal file
497
utils/VSConfig/build/CMakeFiles/CMakeConfigureLog.yaml
Normal file
@ -0,0 +1,497 @@
|
||||
|
||||
---
|
||||
events:
|
||||
-
|
||||
kind: "message-v1"
|
||||
backtrace:
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineSystem.cmake:204 (message)"
|
||||
- "CMakeLists.txt:2 (PROJECT)"
|
||||
message: |
|
||||
The system is: Linux - 3.10.0-1160.66.1.el7.x86_64 - x86_64
|
||||
-
|
||||
kind: "message-v1"
|
||||
backtrace:
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompilerId.cmake:17 (message)"
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)"
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)"
|
||||
- "CMakeLists.txt:2 (PROJECT)"
|
||||
message: |
|
||||
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
|
||||
Compiler: /usr/bin/cc
|
||||
Build flags:
|
||||
Id flags:
|
||||
|
||||
The output was:
|
||||
0
|
||||
|
||||
|
||||
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"
|
||||
|
||||
The C compiler identification is GNU, found in:
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/3.26.3/CompilerIdC/a.out
|
||||
|
||||
-
|
||||
kind: "message-v1"
|
||||
backtrace:
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompilerId.cmake:17 (message)"
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)"
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)"
|
||||
- "CMakeLists.txt:2 (PROJECT)"
|
||||
message: |
|
||||
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
|
||||
Compiler: /usr/bin/c++
|
||||
Build flags:
|
||||
Id flags:
|
||||
|
||||
The output was:
|
||||
0
|
||||
|
||||
|
||||
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"
|
||||
|
||||
The CXX compiler identification is GNU, found in:
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/3.26.3/CompilerIdCXX/a.out
|
||||
|
||||
-
|
||||
kind: "try_compile-v1"
|
||||
backtrace:
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompilerABI.cmake:57 (try_compile)"
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)"
|
||||
- "CMakeLists.txt:2 (PROJECT)"
|
||||
checks:
|
||||
- "Detecting C compiler ABI info"
|
||||
directories:
|
||||
source: "/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-Y9GOXZ"
|
||||
binary: "/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-Y9GOXZ"
|
||||
cmakeVariables:
|
||||
CMAKE_C_FLAGS: ""
|
||||
CMAKE_C_FLAGS_DEBUG: "-g"
|
||||
CMAKE_EXE_LINKER_FLAGS: ""
|
||||
buildResult:
|
||||
variable: "CMAKE_C_ABI_COMPILED"
|
||||
cached: true
|
||||
stdout: |
|
||||
Change Dir: /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-Y9GOXZ
|
||||
|
||||
Run Build Command(s):/usr/data/zt/download/cmake-3.26.3/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_77c4e/fast && /usr/bin/gmake -f CMakeFiles/cmTC_77c4e.dir/build.make CMakeFiles/cmTC_77c4e.dir/build
|
||||
gmake[1]: Entering directory '/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-Y9GOXZ'
|
||||
Building C object CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o
|
||||
/usr/bin/cc -v -o CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o -c /usr/data/zt/download/cmake-3.26.3/Modules/CMakeCCompilerABI.c
|
||||
Using built-in specs.
|
||||
COLLECT_GCC=/usr/bin/cc
|
||||
OFFLOAD_TARGET_NAMES=nvptx-none
|
||||
OFFLOAD_TARGET_DEFAULT=1
|
||||
Target: x86_64-redhat-linux
|
||||
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
|
||||
Thread model: posix
|
||||
gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'
|
||||
/usr/libexec/gcc/x86_64-redhat-linux/8/cc1 -quiet -v /usr/data/zt/download/cmake-3.26.3/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o -version -o /tmp/ccmS5CcS.s
|
||||
GNU C17 (GCC) version 8.3.1 20191121 (Red Hat 8.3.1-5) (x86_64-redhat-linux)
|
||||
compiled by GNU C version 8.3.1 20191121 (Red Hat 8.3.1-5), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.0.2, isl version isl-0.16.1-GMP
|
||||
|
||||
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
|
||||
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/8/include-fixed"
|
||||
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/include"
|
||||
#include "..." search starts here:
|
||||
#include <...> search starts here:
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
End of search list.
|
||||
GNU C17 (GCC) version 8.3.1 20191121 (Red Hat 8.3.1-5) (x86_64-redhat-linux)
|
||||
compiled by GNU C version 8.3.1 20191121 (Red Hat 8.3.1-5), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.0.2, isl version isl-0.16.1-GMP
|
||||
|
||||
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
|
||||
Compiler executable checksum: 220dcc731601936c0ccef916bbdca837
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'
|
||||
as -v --64 -o CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o /tmp/ccmS5CcS.s
|
||||
GNU assembler version 2.30 (x86_64-redhat-linux) using BFD version version 2.30-73.el8
|
||||
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/
|
||||
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../:/lib/:/usr/lib/
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'
|
||||
Linking C executable cmTC_77c4e
|
||||
/usr/data/zt/download/cmake-3.26.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_77c4e.dir/link.txt --verbose=1
|
||||
/usr/bin/cc -v CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o -o cmTC_77c4e
|
||||
Using built-in specs.
|
||||
COLLECT_GCC=/usr/bin/cc
|
||||
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
|
||||
OFFLOAD_TARGET_NAMES=nvptx-none
|
||||
OFFLOAD_TARGET_DEFAULT=1
|
||||
Target: x86_64-redhat-linux
|
||||
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
|
||||
Thread model: posix
|
||||
gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)
|
||||
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/
|
||||
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../:/lib/:/usr/lib/
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_77c4e' '-mtune=generic' '-march=x86-64'
|
||||
/usr/libexec/gcc/x86_64-redhat-linux/8/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper -plugin-opt=-fresolution=/tmp/cc3BtBVY.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_77c4e /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/8 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../.. CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/8/crtend.o /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_77c4e' '-mtune=generic' '-march=x86-64'
|
||||
gmake[1]: Leaving directory '/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-Y9GOXZ'
|
||||
|
||||
exitCode: 0
|
||||
-
|
||||
kind: "message-v1"
|
||||
backtrace:
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompilerABI.cmake:127 (message)"
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)"
|
||||
- "CMakeLists.txt:2 (PROJECT)"
|
||||
message: |
|
||||
Parsed C implicit include dir info: rv=done
|
||||
found start of include info
|
||||
found start of implicit include info
|
||||
add: [/usr/lib/gcc/x86_64-redhat-linux/8/include]
|
||||
add: [/usr/local/include]
|
||||
add: [/usr/include]
|
||||
end of search list found
|
||||
collapse include dir [/usr/lib/gcc/x86_64-redhat-linux/8/include] ==> [/usr/lib/gcc/x86_64-redhat-linux/8/include]
|
||||
collapse include dir [/usr/local/include] ==> [/usr/local/include]
|
||||
collapse include dir [/usr/include] ==> [/usr/include]
|
||||
implicit include dirs: [/usr/lib/gcc/x86_64-redhat-linux/8/include;/usr/local/include;/usr/include]
|
||||
|
||||
|
||||
-
|
||||
kind: "message-v1"
|
||||
backtrace:
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompilerABI.cmake:152 (message)"
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)"
|
||||
- "CMakeLists.txt:2 (PROJECT)"
|
||||
message: |
|
||||
Parsed C implicit link information:
|
||||
link line regex: [^( *|.*[/\\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)]
|
||||
ignore line: [Change Dir: /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-Y9GOXZ]
|
||||
ignore line: []
|
||||
ignore line: [Run Build Command(s):/usr/data/zt/download/cmake-3.26.3/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_77c4e/fast && /usr/bin/gmake -f CMakeFiles/cmTC_77c4e.dir/build.make CMakeFiles/cmTC_77c4e.dir/build]
|
||||
ignore line: [gmake[1]: Entering directory '/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-Y9GOXZ']
|
||||
ignore line: [Building C object CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o]
|
||||
ignore line: [/usr/bin/cc -v -o CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o -c /usr/data/zt/download/cmake-3.26.3/Modules/CMakeCCompilerABI.c]
|
||||
ignore line: [Using built-in specs.]
|
||||
ignore line: [COLLECT_GCC=/usr/bin/cc]
|
||||
ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none]
|
||||
ignore line: [OFFLOAD_TARGET_DEFAULT=1]
|
||||
ignore line: [Target: x86_64-redhat-linux]
|
||||
ignore line: [Configured with: ../configure --enable-bootstrap --enable-languages=c c++ fortran lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux]
|
||||
ignore line: [Thread model: posix]
|
||||
ignore line: [gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC) ]
|
||||
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64']
|
||||
ignore line: [ /usr/libexec/gcc/x86_64-redhat-linux/8/cc1 -quiet -v /usr/data/zt/download/cmake-3.26.3/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o -version -o /tmp/ccmS5CcS.s]
|
||||
ignore line: [GNU C17 (GCC) version 8.3.1 20191121 (Red Hat 8.3.1-5) (x86_64-redhat-linux)]
|
||||
ignore line: [ compiled by GNU C version 8.3.1 20191121 (Red Hat 8.3.1-5) GMP version 6.1.2 MPFR version 3.1.6-p2 MPC version 1.0.2 isl version isl-0.16.1-GMP]
|
||||
ignore line: []
|
||||
ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
|
||||
ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/8/include-fixed"]
|
||||
ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/include"]
|
||||
ignore line: [#include "..." search starts here:]
|
||||
ignore line: [#include <...> search starts here:]
|
||||
ignore line: [ /usr/lib/gcc/x86_64-redhat-linux/8/include]
|
||||
ignore line: [ /usr/local/include]
|
||||
ignore line: [ /usr/include]
|
||||
ignore line: [End of search list.]
|
||||
ignore line: [GNU C17 (GCC) version 8.3.1 20191121 (Red Hat 8.3.1-5) (x86_64-redhat-linux)]
|
||||
ignore line: [ compiled by GNU C version 8.3.1 20191121 (Red Hat 8.3.1-5) GMP version 6.1.2 MPFR version 3.1.6-p2 MPC version 1.0.2 isl version isl-0.16.1-GMP]
|
||||
ignore line: []
|
||||
ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
|
||||
ignore line: [Compiler executable checksum: 220dcc731601936c0ccef916bbdca837]
|
||||
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64']
|
||||
ignore line: [ as -v --64 -o CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o /tmp/ccmS5CcS.s]
|
||||
ignore line: [GNU assembler version 2.30 (x86_64-redhat-linux) using BFD version version 2.30-73.el8]
|
||||
ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/]
|
||||
ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../:/lib/:/usr/lib/]
|
||||
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64']
|
||||
ignore line: [Linking C executable cmTC_77c4e]
|
||||
ignore line: [/usr/data/zt/download/cmake-3.26.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_77c4e.dir/link.txt --verbose=1]
|
||||
ignore line: [/usr/bin/cc -v CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o -o cmTC_77c4e ]
|
||||
ignore line: [Using built-in specs.]
|
||||
ignore line: [COLLECT_GCC=/usr/bin/cc]
|
||||
ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper]
|
||||
ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none]
|
||||
ignore line: [OFFLOAD_TARGET_DEFAULT=1]
|
||||
ignore line: [Target: x86_64-redhat-linux]
|
||||
ignore line: [Configured with: ../configure --enable-bootstrap --enable-languages=c c++ fortran lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux]
|
||||
ignore line: [Thread model: posix]
|
||||
ignore line: [gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC) ]
|
||||
ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/]
|
||||
ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../:/lib/:/usr/lib/]
|
||||
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_77c4e' '-mtune=generic' '-march=x86-64']
|
||||
link line: [ /usr/libexec/gcc/x86_64-redhat-linux/8/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper -plugin-opt=-fresolution=/tmp/cc3BtBVY.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_77c4e /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/8 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../.. CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/8/crtend.o /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o]
|
||||
arg [/usr/libexec/gcc/x86_64-redhat-linux/8/collect2] ==> ignore
|
||||
arg [-plugin] ==> ignore
|
||||
arg [/usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so] ==> ignore
|
||||
arg [-plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper] ==> ignore
|
||||
arg [-plugin-opt=-fresolution=/tmp/cc3BtBVY.res] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lc] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
|
||||
arg [--build-id] ==> ignore
|
||||
arg [--no-add-needed] ==> ignore
|
||||
arg [--eh-frame-hdr] ==> ignore
|
||||
arg [--hash-style=gnu] ==> ignore
|
||||
arg [-m] ==> ignore
|
||||
arg [elf_x86_64] ==> ignore
|
||||
arg [-dynamic-linker] ==> ignore
|
||||
arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
|
||||
arg [-o] ==> ignore
|
||||
arg [cmTC_77c4e] ==> ignore
|
||||
arg [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o] ==> obj [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o]
|
||||
arg [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o] ==> obj [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o]
|
||||
arg [/usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o] ==> obj [/usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o]
|
||||
arg [-L/usr/lib/gcc/x86_64-redhat-linux/8] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/8]
|
||||
arg [-L/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64]
|
||||
arg [-L/lib/../lib64] ==> dir [/lib/../lib64]
|
||||
arg [-L/usr/lib/../lib64] ==> dir [/usr/lib/../lib64]
|
||||
arg [-L/usr/lib/gcc/x86_64-redhat-linux/8/../../..] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/8/../../..]
|
||||
arg [CMakeFiles/cmTC_77c4e.dir/CMakeCCompilerABI.c.o] ==> ignore
|
||||
arg [-lgcc] ==> lib [gcc]
|
||||
arg [--as-needed] ==> ignore
|
||||
arg [-lgcc_s] ==> lib [gcc_s]
|
||||
arg [--no-as-needed] ==> ignore
|
||||
arg [-lc] ==> lib [c]
|
||||
arg [-lgcc] ==> lib [gcc]
|
||||
arg [--as-needed] ==> ignore
|
||||
arg [-lgcc_s] ==> lib [gcc_s]
|
||||
arg [--no-as-needed] ==> ignore
|
||||
arg [/usr/lib/gcc/x86_64-redhat-linux/8/crtend.o] ==> obj [/usr/lib/gcc/x86_64-redhat-linux/8/crtend.o]
|
||||
arg [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o] ==> obj [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o]
|
||||
collapse obj [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o] ==> [/usr/lib64/crt1.o]
|
||||
collapse obj [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o] ==> [/usr/lib64/crti.o]
|
||||
collapse obj [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o] ==> [/usr/lib64/crtn.o]
|
||||
collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/8] ==> [/usr/lib/gcc/x86_64-redhat-linux/8]
|
||||
collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64] ==> [/usr/lib64]
|
||||
collapse library dir [/lib/../lib64] ==> [/lib64]
|
||||
collapse library dir [/usr/lib/../lib64] ==> [/usr/lib64]
|
||||
collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/8/../../..] ==> [/usr/lib]
|
||||
implicit libs: [gcc;gcc_s;c;gcc;gcc_s]
|
||||
implicit objs: [/usr/lib64/crt1.o;/usr/lib64/crti.o;/usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o;/usr/lib/gcc/x86_64-redhat-linux/8/crtend.o;/usr/lib64/crtn.o]
|
||||
implicit dirs: [/usr/lib/gcc/x86_64-redhat-linux/8;/usr/lib64;/lib64;/usr/lib]
|
||||
implicit fwks: []
|
||||
|
||||
|
||||
-
|
||||
kind: "try_compile-v1"
|
||||
backtrace:
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompilerABI.cmake:57 (try_compile)"
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)"
|
||||
- "CMakeLists.txt:2 (PROJECT)"
|
||||
checks:
|
||||
- "Detecting CXX compiler ABI info"
|
||||
directories:
|
||||
source: "/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-7kwaOk"
|
||||
binary: "/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-7kwaOk"
|
||||
cmakeVariables:
|
||||
CMAKE_CXX_FLAGS: ""
|
||||
CMAKE_CXX_FLAGS_DEBUG: "-g"
|
||||
CMAKE_EXE_LINKER_FLAGS: ""
|
||||
buildResult:
|
||||
variable: "CMAKE_CXX_ABI_COMPILED"
|
||||
cached: true
|
||||
stdout: |
|
||||
Change Dir: /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-7kwaOk
|
||||
|
||||
Run Build Command(s):/usr/data/zt/download/cmake-3.26.3/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_f24e3/fast && /usr/bin/gmake -f CMakeFiles/cmTC_f24e3.dir/build.make CMakeFiles/cmTC_f24e3.dir/build
|
||||
gmake[1]: Entering directory '/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-7kwaOk'
|
||||
Building CXX object CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o
|
||||
/usr/bin/c++ -v -o CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o -c /usr/data/zt/download/cmake-3.26.3/Modules/CMakeCXXCompilerABI.cpp
|
||||
Using built-in specs.
|
||||
COLLECT_GCC=/usr/bin/c++
|
||||
OFFLOAD_TARGET_NAMES=nvptx-none
|
||||
OFFLOAD_TARGET_DEFAULT=1
|
||||
Target: x86_64-redhat-linux
|
||||
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
|
||||
Thread model: posix
|
||||
gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
|
||||
/usr/libexec/gcc/x86_64-redhat-linux/8/cc1plus -quiet -v -D_GNU_SOURCE /usr/data/zt/download/cmake-3.26.3/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o -version -o /tmp/ccunZP2p.s
|
||||
GNU C++14 (GCC) version 8.3.1 20191121 (Red Hat 8.3.1-5) (x86_64-redhat-linux)
|
||||
compiled by GNU C version 8.3.1 20191121 (Red Hat 8.3.1-5), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.0.2, isl version isl-0.16.1-GMP
|
||||
|
||||
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
|
||||
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/8/include-fixed"
|
||||
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/include"
|
||||
#include "..." search starts here:
|
||||
#include <...> search starts here:
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
End of search list.
|
||||
GNU C++14 (GCC) version 8.3.1 20191121 (Red Hat 8.3.1-5) (x86_64-redhat-linux)
|
||||
compiled by GNU C version 8.3.1 20191121 (Red Hat 8.3.1-5), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.0.2, isl version isl-0.16.1-GMP
|
||||
|
||||
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
|
||||
Compiler executable checksum: 6bc037fd95a01018b18727df05c3a70b
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
|
||||
as -v --64 -o CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccunZP2p.s
|
||||
GNU assembler version 2.30 (x86_64-redhat-linux) using BFD version version 2.30-73.el8
|
||||
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/
|
||||
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../:/lib/:/usr/lib/
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
|
||||
Linking CXX executable cmTC_f24e3
|
||||
/usr/data/zt/download/cmake-3.26.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f24e3.dir/link.txt --verbose=1
|
||||
/usr/bin/c++ -v CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_f24e3
|
||||
Using built-in specs.
|
||||
COLLECT_GCC=/usr/bin/c++
|
||||
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
|
||||
OFFLOAD_TARGET_NAMES=nvptx-none
|
||||
OFFLOAD_TARGET_DEFAULT=1
|
||||
Target: x86_64-redhat-linux
|
||||
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
|
||||
Thread model: posix
|
||||
gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)
|
||||
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/
|
||||
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../:/lib/:/usr/lib/
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_f24e3' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
|
||||
/usr/libexec/gcc/x86_64-redhat-linux/8/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper -plugin-opt=-fresolution=/tmp/ccfxVUjz.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_f24e3 /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/8 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../.. CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/8/crtend.o /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_f24e3' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
|
||||
gmake[1]: Leaving directory '/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-7kwaOk'
|
||||
|
||||
exitCode: 0
|
||||
-
|
||||
kind: "message-v1"
|
||||
backtrace:
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompilerABI.cmake:127 (message)"
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)"
|
||||
- "CMakeLists.txt:2 (PROJECT)"
|
||||
message: |
|
||||
Parsed CXX implicit include dir info: rv=done
|
||||
found start of include info
|
||||
found start of implicit include info
|
||||
add: [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8]
|
||||
add: [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux]
|
||||
add: [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward]
|
||||
add: [/usr/lib/gcc/x86_64-redhat-linux/8/include]
|
||||
add: [/usr/local/include]
|
||||
add: [/usr/include]
|
||||
end of search list found
|
||||
collapse include dir [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8] ==> [/usr/include/c++/8]
|
||||
collapse include dir [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux] ==> [/usr/include/c++/8/x86_64-redhat-linux]
|
||||
collapse include dir [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward] ==> [/usr/include/c++/8/backward]
|
||||
collapse include dir [/usr/lib/gcc/x86_64-redhat-linux/8/include] ==> [/usr/lib/gcc/x86_64-redhat-linux/8/include]
|
||||
collapse include dir [/usr/local/include] ==> [/usr/local/include]
|
||||
collapse include dir [/usr/include] ==> [/usr/include]
|
||||
implicit include dirs: [/usr/include/c++/8;/usr/include/c++/8/x86_64-redhat-linux;/usr/include/c++/8/backward;/usr/lib/gcc/x86_64-redhat-linux/8/include;/usr/local/include;/usr/include]
|
||||
|
||||
|
||||
-
|
||||
kind: "message-v1"
|
||||
backtrace:
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompilerABI.cmake:152 (message)"
|
||||
- "/usr/data/zt/download/cmake-3.26.3/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)"
|
||||
- "CMakeLists.txt:2 (PROJECT)"
|
||||
message: |
|
||||
Parsed CXX implicit link information:
|
||||
link line regex: [^( *|.*[/\\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)]
|
||||
ignore line: [Change Dir: /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-7kwaOk]
|
||||
ignore line: []
|
||||
ignore line: [Run Build Command(s):/usr/data/zt/download/cmake-3.26.3/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_f24e3/fast && /usr/bin/gmake -f CMakeFiles/cmTC_f24e3.dir/build.make CMakeFiles/cmTC_f24e3.dir/build]
|
||||
ignore line: [gmake[1]: Entering directory '/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/CMakeScratch/TryCompile-7kwaOk']
|
||||
ignore line: [Building CXX object CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o]
|
||||
ignore line: [/usr/bin/c++ -v -o CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o -c /usr/data/zt/download/cmake-3.26.3/Modules/CMakeCXXCompilerABI.cpp]
|
||||
ignore line: [Using built-in specs.]
|
||||
ignore line: [COLLECT_GCC=/usr/bin/c++]
|
||||
ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none]
|
||||
ignore line: [OFFLOAD_TARGET_DEFAULT=1]
|
||||
ignore line: [Target: x86_64-redhat-linux]
|
||||
ignore line: [Configured with: ../configure --enable-bootstrap --enable-languages=c c++ fortran lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux]
|
||||
ignore line: [Thread model: posix]
|
||||
ignore line: [gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC) ]
|
||||
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64']
|
||||
ignore line: [ /usr/libexec/gcc/x86_64-redhat-linux/8/cc1plus -quiet -v -D_GNU_SOURCE /usr/data/zt/download/cmake-3.26.3/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o -version -o /tmp/ccunZP2p.s]
|
||||
ignore line: [GNU C++14 (GCC) version 8.3.1 20191121 (Red Hat 8.3.1-5) (x86_64-redhat-linux)]
|
||||
ignore line: [ compiled by GNU C version 8.3.1 20191121 (Red Hat 8.3.1-5) GMP version 6.1.2 MPFR version 3.1.6-p2 MPC version 1.0.2 isl version isl-0.16.1-GMP]
|
||||
ignore line: []
|
||||
ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
|
||||
ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/8/include-fixed"]
|
||||
ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/include"]
|
||||
ignore line: [#include "..." search starts here:]
|
||||
ignore line: [#include <...> search starts here:]
|
||||
ignore line: [ /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8]
|
||||
ignore line: [ /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux]
|
||||
ignore line: [ /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward]
|
||||
ignore line: [ /usr/lib/gcc/x86_64-redhat-linux/8/include]
|
||||
ignore line: [ /usr/local/include]
|
||||
ignore line: [ /usr/include]
|
||||
ignore line: [End of search list.]
|
||||
ignore line: [GNU C++14 (GCC) version 8.3.1 20191121 (Red Hat 8.3.1-5) (x86_64-redhat-linux)]
|
||||
ignore line: [ compiled by GNU C version 8.3.1 20191121 (Red Hat 8.3.1-5) GMP version 6.1.2 MPFR version 3.1.6-p2 MPC version 1.0.2 isl version isl-0.16.1-GMP]
|
||||
ignore line: []
|
||||
ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
|
||||
ignore line: [Compiler executable checksum: 6bc037fd95a01018b18727df05c3a70b]
|
||||
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64']
|
||||
ignore line: [ as -v --64 -o CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccunZP2p.s]
|
||||
ignore line: [GNU assembler version 2.30 (x86_64-redhat-linux) using BFD version version 2.30-73.el8]
|
||||
ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/]
|
||||
ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../:/lib/:/usr/lib/]
|
||||
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64']
|
||||
ignore line: [Linking CXX executable cmTC_f24e3]
|
||||
ignore line: [/usr/data/zt/download/cmake-3.26.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f24e3.dir/link.txt --verbose=1]
|
||||
ignore line: [/usr/bin/c++ -v CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_f24e3 ]
|
||||
ignore line: [Using built-in specs.]
|
||||
ignore line: [COLLECT_GCC=/usr/bin/c++]
|
||||
ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper]
|
||||
ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none]
|
||||
ignore line: [OFFLOAD_TARGET_DEFAULT=1]
|
||||
ignore line: [Target: x86_64-redhat-linux]
|
||||
ignore line: [Configured with: ../configure --enable-bootstrap --enable-languages=c c++ fortran lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux]
|
||||
ignore line: [Thread model: posix]
|
||||
ignore line: [gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC) ]
|
||||
ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/8/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/]
|
||||
ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/8/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/8/../../../:/lib/:/usr/lib/]
|
||||
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_f24e3' '-shared-libgcc' '-mtune=generic' '-march=x86-64']
|
||||
link line: [ /usr/libexec/gcc/x86_64-redhat-linux/8/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper -plugin-opt=-fresolution=/tmp/ccfxVUjz.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_f24e3 /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/8 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../.. CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/8/crtend.o /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o]
|
||||
arg [/usr/libexec/gcc/x86_64-redhat-linux/8/collect2] ==> ignore
|
||||
arg [-plugin] ==> ignore
|
||||
arg [/usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so] ==> ignore
|
||||
arg [-plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper] ==> ignore
|
||||
arg [-plugin-opt=-fresolution=/tmp/ccfxVUjz.res] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lc] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
|
||||
arg [--build-id] ==> ignore
|
||||
arg [--no-add-needed] ==> ignore
|
||||
arg [--eh-frame-hdr] ==> ignore
|
||||
arg [--hash-style=gnu] ==> ignore
|
||||
arg [-m] ==> ignore
|
||||
arg [elf_x86_64] ==> ignore
|
||||
arg [-dynamic-linker] ==> ignore
|
||||
arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
|
||||
arg [-o] ==> ignore
|
||||
arg [cmTC_f24e3] ==> ignore
|
||||
arg [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o] ==> obj [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o]
|
||||
arg [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o] ==> obj [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o]
|
||||
arg [/usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o] ==> obj [/usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o]
|
||||
arg [-L/usr/lib/gcc/x86_64-redhat-linux/8] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/8]
|
||||
arg [-L/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64]
|
||||
arg [-L/lib/../lib64] ==> dir [/lib/../lib64]
|
||||
arg [-L/usr/lib/../lib64] ==> dir [/usr/lib/../lib64]
|
||||
arg [-L/usr/lib/gcc/x86_64-redhat-linux/8/../../..] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/8/../../..]
|
||||
arg [CMakeFiles/cmTC_f24e3.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore
|
||||
arg [-lstdc++] ==> lib [stdc++]
|
||||
arg [-lm] ==> lib [m]
|
||||
arg [-lgcc_s] ==> lib [gcc_s]
|
||||
arg [-lgcc] ==> lib [gcc]
|
||||
arg [-lc] ==> lib [c]
|
||||
arg [-lgcc_s] ==> lib [gcc_s]
|
||||
arg [-lgcc] ==> lib [gcc]
|
||||
arg [/usr/lib/gcc/x86_64-redhat-linux/8/crtend.o] ==> obj [/usr/lib/gcc/x86_64-redhat-linux/8/crtend.o]
|
||||
arg [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o] ==> obj [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o]
|
||||
collapse obj [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o] ==> [/usr/lib64/crt1.o]
|
||||
collapse obj [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o] ==> [/usr/lib64/crti.o]
|
||||
collapse obj [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o] ==> [/usr/lib64/crtn.o]
|
||||
collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/8] ==> [/usr/lib/gcc/x86_64-redhat-linux/8]
|
||||
collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64] ==> [/usr/lib64]
|
||||
collapse library dir [/lib/../lib64] ==> [/lib64]
|
||||
collapse library dir [/usr/lib/../lib64] ==> [/usr/lib64]
|
||||
collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/8/../../..] ==> [/usr/lib]
|
||||
implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc]
|
||||
implicit objs: [/usr/lib64/crt1.o;/usr/lib64/crti.o;/usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o;/usr/lib/gcc/x86_64-redhat-linux/8/crtend.o;/usr/lib64/crtn.o]
|
||||
implicit dirs: [/usr/lib/gcc/x86_64-redhat-linux/8;/usr/lib64;/lib64;/usr/lib]
|
||||
implicit fwks: []
|
||||
|
||||
|
||||
...
|
@ -0,0 +1,16 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.26
|
||||
|
||||
# Relative path conversion top directories.
|
||||
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig")
|
||||
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build")
|
||||
|
||||
# Force unix paths in dependencies.
|
||||
set(CMAKE_FORCE_UNIX_PATHS 1)
|
||||
|
||||
|
||||
# The C and CXX include file regular expressions for this directory.
|
||||
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
|
||||
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
|
||||
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
|
||||
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})
|
127
utils/VSConfig/build/CMakeFiles/Makefile.cmake
Normal file
127
utils/VSConfig/build/CMakeFiles/Makefile.cmake
Normal file
@ -0,0 +1,127 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.26
|
||||
|
||||
# The generator used is:
|
||||
set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles")
|
||||
|
||||
# The top level Makefile was generated from the following files:
|
||||
set(CMAKE_MAKEFILE_DEPENDS
|
||||
"CMakeCache.txt"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeCCompiler.cmake.in"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeCCompilerABI.c"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeCInformation.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeCXXCompiler.cmake.in"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeCXXCompilerABI.cpp"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeCXXInformation.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeCommonLanguageInclude.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeCompilerIdDetection.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCXXCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompileFeatures.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompilerABI.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineCompilerId.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeDetermineSystem.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeFindBinUtils.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeGenericSystem.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeInitializeConfigs.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeLanguageInformation.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeParseImplicitIncludeInfo.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeParseImplicitLinkInfo.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeParseLibraryArchitecture.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeSystem.cmake.in"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeSystemSpecificInformation.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeSystemSpecificInitialize.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeTestCCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeTestCXXCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeTestCompilerCommon.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/CMakeUnixFindMake.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/ADSP-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/ARMCC-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/ARMClang-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/AppleClang-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Borland-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Bruce-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/CMakeCommonCompilerMacros.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Clang-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Compaq-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Cray-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Embarcadero-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Fujitsu-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/GHS-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/GNU-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/GNU-C.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/GNU-CXX.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/GNU-FindBinUtils.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/GNU.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/HP-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/HP-CXX-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/IAR-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Intel-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/LCC-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/MSVC-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/NVHPC-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/NVIDIA-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/PGI-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/PathScale-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/SCO-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/SDCC-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/SunPro-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/TI-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Tasking-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/Watcom-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/XL-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/XL-CXX-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/XLClang-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/zOS-C-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Internal/FeatureTesting.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Platform/Linux-Determine-CXX.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Platform/Linux-GNU-C.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Platform/Linux-GNU-CXX.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Platform/Linux-GNU.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Platform/Linux.cmake"
|
||||
"/usr/data/zt/download/cmake-3.26.3/Modules/Platform/UnixPaths.cmake"
|
||||
"/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/CMakeLists.txt"
|
||||
"CMakeFiles/3.26.3/CMakeCCompiler.cmake"
|
||||
"CMakeFiles/3.26.3/CMakeCXXCompiler.cmake"
|
||||
"CMakeFiles/3.26.3/CMakeSystem.cmake"
|
||||
)
|
||||
|
||||
# The corresponding makefile is:
|
||||
set(CMAKE_MAKEFILE_OUTPUTS
|
||||
"Makefile"
|
||||
"CMakeFiles/cmake.check_cache"
|
||||
)
|
||||
|
||||
# Byproducts of CMake generate step:
|
||||
set(CMAKE_MAKEFILE_PRODUCTS
|
||||
"CMakeFiles/3.26.3/CMakeSystem.cmake"
|
||||
"CMakeFiles/3.26.3/CMakeCCompiler.cmake"
|
||||
"CMakeFiles/3.26.3/CMakeCXXCompiler.cmake"
|
||||
"CMakeFiles/3.26.3/CMakeCCompiler.cmake"
|
||||
"CMakeFiles/3.26.3/CMakeCXXCompiler.cmake"
|
||||
"CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
)
|
||||
|
||||
# Dependency information for all targets:
|
||||
set(CMAKE_DEPEND_INFO_FILES
|
||||
"CMakeFiles/VSConfig.dir/DependInfo.cmake"
|
||||
)
|
112
utils/VSConfig/build/CMakeFiles/Makefile2
Normal file
112
utils/VSConfig/build/CMakeFiles/Makefile2
Normal file
@ -0,0 +1,112 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.26
|
||||
|
||||
# Default target executed when no arguments are given to make.
|
||||
default_target: all
|
||||
.PHONY : default_target
|
||||
|
||||
#=============================================================================
|
||||
# Special targets provided by cmake.
|
||||
|
||||
# Disable implicit rules so canonical targets will work.
|
||||
.SUFFIXES:
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : %,v
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : RCS/%
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : RCS/%,v
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : SCCS/s.%
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : s.%
|
||||
|
||||
.SUFFIXES: .hpux_make_needs_suffix_list
|
||||
|
||||
# Command-line flag to silence nested $(MAKE).
|
||||
$(VERBOSE)MAKESILENT = -s
|
||||
|
||||
#Suppress display of executed commands.
|
||||
$(VERBOSE).SILENT:
|
||||
|
||||
# A target that is always out of date.
|
||||
cmake_force:
|
||||
.PHONY : cmake_force
|
||||
|
||||
#=============================================================================
|
||||
# Set environment variables for the build.
|
||||
|
||||
# The shell in which to execute make rules.
|
||||
SHELL = /bin/sh
|
||||
|
||||
# The CMake executable.
|
||||
CMAKE_COMMAND = /usr/data/zt/download/cmake-3.26.3/bin/cmake
|
||||
|
||||
# The command to remove a file.
|
||||
RM = /usr/data/zt/download/cmake-3.26.3/bin/cmake -E rm -f
|
||||
|
||||
# Escaping for special characters.
|
||||
EQUALS = =
|
||||
|
||||
# The top-level source directory on which CMake was run.
|
||||
CMAKE_SOURCE_DIR = /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig
|
||||
|
||||
# The top-level build directory on which CMake was run.
|
||||
CMAKE_BINARY_DIR = /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build
|
||||
|
||||
#=============================================================================
|
||||
# Directory level rules for the build root directory
|
||||
|
||||
# The main recursive "all" target.
|
||||
all: CMakeFiles/VSConfig.dir/all
|
||||
.PHONY : all
|
||||
|
||||
# The main recursive "preinstall" target.
|
||||
preinstall:
|
||||
.PHONY : preinstall
|
||||
|
||||
# The main recursive "clean" target.
|
||||
clean: CMakeFiles/VSConfig.dir/clean
|
||||
.PHONY : clean
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for target CMakeFiles/VSConfig.dir
|
||||
|
||||
# All Build rule for target.
|
||||
CMakeFiles/VSConfig.dir/all:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/depend
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/build
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles --progress-num=1,2,3,4 "Built target VSConfig"
|
||||
.PHONY : CMakeFiles/VSConfig.dir/all
|
||||
|
||||
# Build rule for subdir invocation for target.
|
||||
CMakeFiles/VSConfig.dir/rule: cmake_check_build_system
|
||||
$(CMAKE_COMMAND) -E cmake_progress_start /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles 4
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 CMakeFiles/VSConfig.dir/all
|
||||
$(CMAKE_COMMAND) -E cmake_progress_start /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles 0
|
||||
.PHONY : CMakeFiles/VSConfig.dir/rule
|
||||
|
||||
# Convenience name for target.
|
||||
VSConfig: CMakeFiles/VSConfig.dir/rule
|
||||
.PHONY : VSConfig
|
||||
|
||||
# clean rule for target.
|
||||
CMakeFiles/VSConfig.dir/clean:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/clean
|
||||
.PHONY : CMakeFiles/VSConfig.dir/clean
|
||||
|
||||
#=============================================================================
|
||||
# Special targets to cleanup operation of make.
|
||||
|
||||
# Special rule to run CMake to check the build system integrity.
|
||||
# No rule that depends on this can have commands that come from listfiles
|
||||
# because they might be regenerated.
|
||||
cmake_check_build_system:
|
||||
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
|
||||
.PHONY : cmake_check_build_system
|
||||
|
7
utils/VSConfig/build/CMakeFiles/TargetDirectories.txt
Normal file
7
utils/VSConfig/build/CMakeFiles/TargetDirectories.txt
Normal file
@ -0,0 +1,7 @@
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/VSConfig.dir
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/edit_cache.dir
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/rebuild_cache.dir
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/list_install_components.dir
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/install.dir
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/install/local.dir
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/install/strip.dir
|
@ -0,0 +1,21 @@
|
||||
|
||||
# Consider dependencies only in project.
|
||||
set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF)
|
||||
|
||||
# The set of languages for which implicit dependencies are needed:
|
||||
set(CMAKE_DEPENDS_LANGUAGES
|
||||
)
|
||||
|
||||
# The set of dependency files which are needed:
|
||||
set(CMAKE_DEPENDS_DEPENDENCY_FILES
|
||||
"/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/VSConfig.c" "CMakeFiles/VSConfig.dir/src/VSConfig.c.o" "gcc" "CMakeFiles/VSConfig.dir/src/VSConfig.c.o.d"
|
||||
"/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/cJSON.c" "CMakeFiles/VSConfig.dir/src/cJSON.c.o" "gcc" "CMakeFiles/VSConfig.dir/src/cJSON.c.o.d"
|
||||
"/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/cJSON_Utils.c" "CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o" "gcc" "CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o.d"
|
||||
)
|
||||
|
||||
# Targets to which this target links which contain Fortran sources.
|
||||
set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES
|
||||
)
|
||||
|
||||
# Fortran module output directory.
|
||||
set(CMAKE_Fortran_TARGET_MODULE_DIR "")
|
142
utils/VSConfig/build/CMakeFiles/VSConfig.dir/build.make
Normal file
142
utils/VSConfig/build/CMakeFiles/VSConfig.dir/build.make
Normal file
@ -0,0 +1,142 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.26
|
||||
|
||||
# Delete rule output on recipe failure.
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
#=============================================================================
|
||||
# Special targets provided by cmake.
|
||||
|
||||
# Disable implicit rules so canonical targets will work.
|
||||
.SUFFIXES:
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : %,v
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : RCS/%
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : RCS/%,v
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : SCCS/s.%
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : s.%
|
||||
|
||||
.SUFFIXES: .hpux_make_needs_suffix_list
|
||||
|
||||
# Command-line flag to silence nested $(MAKE).
|
||||
$(VERBOSE)MAKESILENT = -s
|
||||
|
||||
#Suppress display of executed commands.
|
||||
$(VERBOSE).SILENT:
|
||||
|
||||
# A target that is always out of date.
|
||||
cmake_force:
|
||||
.PHONY : cmake_force
|
||||
|
||||
#=============================================================================
|
||||
# Set environment variables for the build.
|
||||
|
||||
# The shell in which to execute make rules.
|
||||
SHELL = /bin/sh
|
||||
|
||||
# The CMake executable.
|
||||
CMAKE_COMMAND = /usr/data/zt/download/cmake-3.26.3/bin/cmake
|
||||
|
||||
# The command to remove a file.
|
||||
RM = /usr/data/zt/download/cmake-3.26.3/bin/cmake -E rm -f
|
||||
|
||||
# Escaping for special characters.
|
||||
EQUALS = =
|
||||
|
||||
# The top-level source directory on which CMake was run.
|
||||
CMAKE_SOURCE_DIR = /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig
|
||||
|
||||
# The top-level build directory on which CMake was run.
|
||||
CMAKE_BINARY_DIR = /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build
|
||||
|
||||
# Include any dependencies generated for this target.
|
||||
include CMakeFiles/VSConfig.dir/depend.make
|
||||
# Include any dependencies generated by the compiler for this target.
|
||||
include CMakeFiles/VSConfig.dir/compiler_depend.make
|
||||
|
||||
# Include the progress variables for this target.
|
||||
include CMakeFiles/VSConfig.dir/progress.make
|
||||
|
||||
# Include the compile flags for this target's objects.
|
||||
include CMakeFiles/VSConfig.dir/flags.make
|
||||
|
||||
CMakeFiles/VSConfig.dir/src/VSConfig.c.o: CMakeFiles/VSConfig.dir/flags.make
|
||||
CMakeFiles/VSConfig.dir/src/VSConfig.c.o: /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/VSConfig.c
|
||||
CMakeFiles/VSConfig.dir/src/VSConfig.c.o: CMakeFiles/VSConfig.dir/compiler_depend.ts
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object CMakeFiles/VSConfig.dir/src/VSConfig.c.o"
|
||||
/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/VSConfig.dir/src/VSConfig.c.o -MF CMakeFiles/VSConfig.dir/src/VSConfig.c.o.d -o CMakeFiles/VSConfig.dir/src/VSConfig.c.o -c /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/VSConfig.c
|
||||
|
||||
CMakeFiles/VSConfig.dir/src/VSConfig.c.i: cmake_force
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/VSConfig.dir/src/VSConfig.c.i"
|
||||
/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/VSConfig.c > CMakeFiles/VSConfig.dir/src/VSConfig.c.i
|
||||
|
||||
CMakeFiles/VSConfig.dir/src/VSConfig.c.s: cmake_force
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/VSConfig.dir/src/VSConfig.c.s"
|
||||
/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/VSConfig.c -o CMakeFiles/VSConfig.dir/src/VSConfig.c.s
|
||||
|
||||
CMakeFiles/VSConfig.dir/src/cJSON.c.o: CMakeFiles/VSConfig.dir/flags.make
|
||||
CMakeFiles/VSConfig.dir/src/cJSON.c.o: /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/cJSON.c
|
||||
CMakeFiles/VSConfig.dir/src/cJSON.c.o: CMakeFiles/VSConfig.dir/compiler_depend.ts
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building C object CMakeFiles/VSConfig.dir/src/cJSON.c.o"
|
||||
/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/VSConfig.dir/src/cJSON.c.o -MF CMakeFiles/VSConfig.dir/src/cJSON.c.o.d -o CMakeFiles/VSConfig.dir/src/cJSON.c.o -c /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/cJSON.c
|
||||
|
||||
CMakeFiles/VSConfig.dir/src/cJSON.c.i: cmake_force
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/VSConfig.dir/src/cJSON.c.i"
|
||||
/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/cJSON.c > CMakeFiles/VSConfig.dir/src/cJSON.c.i
|
||||
|
||||
CMakeFiles/VSConfig.dir/src/cJSON.c.s: cmake_force
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/VSConfig.dir/src/cJSON.c.s"
|
||||
/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/cJSON.c -o CMakeFiles/VSConfig.dir/src/cJSON.c.s
|
||||
|
||||
CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o: CMakeFiles/VSConfig.dir/flags.make
|
||||
CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o: /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/cJSON_Utils.c
|
||||
CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o: CMakeFiles/VSConfig.dir/compiler_depend.ts
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Building C object CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o"
|
||||
/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o -MF CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o.d -o CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o -c /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/cJSON_Utils.c
|
||||
|
||||
CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.i: cmake_force
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.i"
|
||||
/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/cJSON_Utils.c > CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.i
|
||||
|
||||
CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.s: cmake_force
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.s"
|
||||
/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/cJSON_Utils.c -o CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.s
|
||||
|
||||
# Object files for target VSConfig
|
||||
VSConfig_OBJECTS = \
|
||||
"CMakeFiles/VSConfig.dir/src/VSConfig.c.o" \
|
||||
"CMakeFiles/VSConfig.dir/src/cJSON.c.o" \
|
||||
"CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o"
|
||||
|
||||
# External object files for target VSConfig
|
||||
VSConfig_EXTERNAL_OBJECTS =
|
||||
|
||||
libVSConfig.so: CMakeFiles/VSConfig.dir/src/VSConfig.c.o
|
||||
libVSConfig.so: CMakeFiles/VSConfig.dir/src/cJSON.c.o
|
||||
libVSConfig.so: CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o
|
||||
libVSConfig.so: CMakeFiles/VSConfig.dir/build.make
|
||||
libVSConfig.so: CMakeFiles/VSConfig.dir/link.txt
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_4) "Linking C shared library libVSConfig.so"
|
||||
$(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/VSConfig.dir/link.txt --verbose=$(VERBOSE)
|
||||
|
||||
# Rule to build all files generated by this target.
|
||||
CMakeFiles/VSConfig.dir/build: libVSConfig.so
|
||||
.PHONY : CMakeFiles/VSConfig.dir/build
|
||||
|
||||
CMakeFiles/VSConfig.dir/clean:
|
||||
$(CMAKE_COMMAND) -P CMakeFiles/VSConfig.dir/cmake_clean.cmake
|
||||
.PHONY : CMakeFiles/VSConfig.dir/clean
|
||||
|
||||
CMakeFiles/VSConfig.dir/depend:
|
||||
cd /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles/VSConfig.dir/DependInfo.cmake --color=$(COLOR)
|
||||
.PHONY : CMakeFiles/VSConfig.dir/depend
|
||||
|
@ -0,0 +1,15 @@
|
||||
file(REMOVE_RECURSE
|
||||
"CMakeFiles/VSConfig.dir/src/VSConfig.c.o"
|
||||
"CMakeFiles/VSConfig.dir/src/VSConfig.c.o.d"
|
||||
"CMakeFiles/VSConfig.dir/src/cJSON.c.o"
|
||||
"CMakeFiles/VSConfig.dir/src/cJSON.c.o.d"
|
||||
"CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o"
|
||||
"CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o.d"
|
||||
"libVSConfig.pdb"
|
||||
"libVSConfig.so"
|
||||
)
|
||||
|
||||
# Per-language clean rules from dependency scanning.
|
||||
foreach(lang C)
|
||||
include(CMakeFiles/VSConfig.dir/cmake_clean_${lang}.cmake OPTIONAL)
|
||||
endforeach()
|
@ -0,0 +1,2 @@
|
||||
# Empty compiler generated dependencies file for VSConfig.
|
||||
# This may be replaced when dependencies are built.
|
@ -0,0 +1,2 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Timestamp file for compiler generated dependencies management for VSConfig.
|
2
utils/VSConfig/build/CMakeFiles/VSConfig.dir/depend.make
Normal file
2
utils/VSConfig/build/CMakeFiles/VSConfig.dir/depend.make
Normal file
@ -0,0 +1,2 @@
|
||||
# Empty dependencies file for VSConfig.
|
||||
# This may be replaced when dependencies are built.
|
10
utils/VSConfig/build/CMakeFiles/VSConfig.dir/flags.make
Normal file
10
utils/VSConfig/build/CMakeFiles/VSConfig.dir/flags.make
Normal file
@ -0,0 +1,10 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.26
|
||||
|
||||
# compile C with /usr/bin/cc
|
||||
C_DEFINES = -DVSConfig_EXPORTS
|
||||
|
||||
C_INCLUDES = -I/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/include
|
||||
|
||||
C_FLAGS = -fPIC -fPIC
|
||||
|
1
utils/VSConfig/build/CMakeFiles/VSConfig.dir/link.txt
Normal file
1
utils/VSConfig/build/CMakeFiles/VSConfig.dir/link.txt
Normal file
@ -0,0 +1 @@
|
||||
/usr/bin/cc -fPIC -shared -Wl,-soname,libVSConfig.so -o libVSConfig.so CMakeFiles/VSConfig.dir/src/VSConfig.c.o CMakeFiles/VSConfig.dir/src/cJSON.c.o CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o
|
@ -0,0 +1,5 @@
|
||||
CMAKE_PROGRESS_1 = 1
|
||||
CMAKE_PROGRESS_2 = 2
|
||||
CMAKE_PROGRESS_3 = 3
|
||||
CMAKE_PROGRESS_4 = 4
|
||||
|
BIN
utils/VSConfig/build/CMakeFiles/VSConfig.dir/src/VSConfig.c.o
Normal file
BIN
utils/VSConfig/build/CMakeFiles/VSConfig.dir/src/VSConfig.c.o
Normal file
Binary file not shown.
@ -0,0 +1,37 @@
|
||||
CMakeFiles/VSConfig.dir/src/VSConfig.c.o: \
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/VSConfig.c \
|
||||
/usr/include/stdc-predef.h \
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/include/VSConfig.h \
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/include/cJSON/cJSON.h \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include/stddef.h /usr/include/stdio.h \
|
||||
/usr/include/bits/libc-header-start.h /usr/include/features.h \
|
||||
/usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
|
||||
/usr/include/bits/long-double.h /usr/include/gnu/stubs.h \
|
||||
/usr/include/gnu/stubs-64.h \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include/stdarg.h \
|
||||
/usr/include/bits/types.h /usr/include/bits/typesizes.h \
|
||||
/usr/include/bits/types/__fpos_t.h /usr/include/bits/types/__mbstate_t.h \
|
||||
/usr/include/bits/types/__fpos64_t.h /usr/include/bits/types/__FILE.h \
|
||||
/usr/include/bits/types/FILE.h /usr/include/bits/types/struct_FILE.h \
|
||||
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
|
||||
/usr/include/stdlib.h /usr/include/bits/waitflags.h \
|
||||
/usr/include/bits/waitstatus.h /usr/include/bits/floatn.h \
|
||||
/usr/include/bits/floatn-common.h /usr/include/sys/types.h \
|
||||
/usr/include/bits/types/clock_t.h /usr/include/bits/types/clockid_t.h \
|
||||
/usr/include/bits/types/time_t.h /usr/include/bits/types/timer_t.h \
|
||||
/usr/include/bits/stdint-intn.h /usr/include/endian.h \
|
||||
/usr/include/bits/endian.h /usr/include/bits/byteswap.h \
|
||||
/usr/include/bits/uintn-identity.h /usr/include/sys/select.h \
|
||||
/usr/include/bits/select.h /usr/include/bits/types/sigset_t.h \
|
||||
/usr/include/bits/types/__sigset_t.h \
|
||||
/usr/include/bits/types/struct_timeval.h \
|
||||
/usr/include/bits/types/struct_timespec.h \
|
||||
/usr/include/bits/pthreadtypes.h /usr/include/bits/thread-shared-types.h \
|
||||
/usr/include/bits/pthreadtypes-arch.h /usr/include/alloca.h \
|
||||
/usr/include/bits/stdlib-float.h /usr/include/string.h \
|
||||
/usr/include/bits/types/locale_t.h /usr/include/bits/types/__locale_t.h \
|
||||
/usr/include/strings.h /usr/include/fcntl.h /usr/include/bits/fcntl.h \
|
||||
/usr/include/bits/fcntl-linux.h /usr/include/bits/stat.h \
|
||||
/usr/include/unistd.h /usr/include/bits/posix_opt.h \
|
||||
/usr/include/bits/environments.h /usr/include/bits/confname.h \
|
||||
/usr/include/bits/getopt_posix.h /usr/include/bits/getopt_core.h
|
BIN
utils/VSConfig/build/CMakeFiles/VSConfig.dir/src/cJSON.c.o
Normal file
BIN
utils/VSConfig/build/CMakeFiles/VSConfig.dir/src/cJSON.c.o
Normal file
Binary file not shown.
42
utils/VSConfig/build/CMakeFiles/VSConfig.dir/src/cJSON.c.o.d
Normal file
42
utils/VSConfig/build/CMakeFiles/VSConfig.dir/src/cJSON.c.o.d
Normal file
@ -0,0 +1,42 @@
|
||||
CMakeFiles/VSConfig.dir/src/cJSON.c.o: \
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/cJSON.c \
|
||||
/usr/include/stdc-predef.h /usr/include/string.h \
|
||||
/usr/include/bits/libc-header-start.h /usr/include/features.h \
|
||||
/usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
|
||||
/usr/include/bits/long-double.h /usr/include/gnu/stubs.h \
|
||||
/usr/include/gnu/stubs-64.h \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include/stddef.h \
|
||||
/usr/include/bits/types/locale_t.h /usr/include/bits/types/__locale_t.h \
|
||||
/usr/include/strings.h /usr/include/stdio.h \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include/stdarg.h \
|
||||
/usr/include/bits/types.h /usr/include/bits/typesizes.h \
|
||||
/usr/include/bits/types/__fpos_t.h /usr/include/bits/types/__mbstate_t.h \
|
||||
/usr/include/bits/types/__fpos64_t.h /usr/include/bits/types/__FILE.h \
|
||||
/usr/include/bits/types/FILE.h /usr/include/bits/types/struct_FILE.h \
|
||||
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
|
||||
/usr/include/math.h /usr/include/bits/math-vector.h \
|
||||
/usr/include/bits/libm-simd-decl-stubs.h /usr/include/bits/floatn.h \
|
||||
/usr/include/bits/floatn-common.h /usr/include/bits/flt-eval-method.h \
|
||||
/usr/include/bits/fp-logb.h /usr/include/bits/fp-fast.h \
|
||||
/usr/include/bits/mathcalls-helper-functions.h \
|
||||
/usr/include/bits/mathcalls.h /usr/include/stdlib.h \
|
||||
/usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \
|
||||
/usr/include/sys/types.h /usr/include/bits/types/clock_t.h \
|
||||
/usr/include/bits/types/clockid_t.h /usr/include/bits/types/time_t.h \
|
||||
/usr/include/bits/types/timer_t.h /usr/include/bits/stdint-intn.h \
|
||||
/usr/include/endian.h /usr/include/bits/endian.h \
|
||||
/usr/include/bits/byteswap.h /usr/include/bits/uintn-identity.h \
|
||||
/usr/include/sys/select.h /usr/include/bits/select.h \
|
||||
/usr/include/bits/types/sigset_t.h /usr/include/bits/types/__sigset_t.h \
|
||||
/usr/include/bits/types/struct_timeval.h \
|
||||
/usr/include/bits/types/struct_timespec.h \
|
||||
/usr/include/bits/pthreadtypes.h /usr/include/bits/thread-shared-types.h \
|
||||
/usr/include/bits/pthreadtypes-arch.h /usr/include/alloca.h \
|
||||
/usr/include/bits/stdlib-float.h \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include/limits.h \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include/syslimits.h \
|
||||
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
|
||||
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
|
||||
/usr/include/bits/posix2_lim.h /usr/include/ctype.h \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include/float.h \
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/include/cJSON/cJSON.h
|
BIN
utils/VSConfig/build/CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o
Normal file
BIN
utils/VSConfig/build/CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o
Normal file
Binary file not shown.
@ -0,0 +1,43 @@
|
||||
CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o: \
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/src/cJSON_Utils.c \
|
||||
/usr/include/stdc-predef.h /usr/include/ctype.h /usr/include/features.h \
|
||||
/usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
|
||||
/usr/include/bits/long-double.h /usr/include/gnu/stubs.h \
|
||||
/usr/include/gnu/stubs-64.h /usr/include/bits/types.h \
|
||||
/usr/include/bits/typesizes.h /usr/include/endian.h \
|
||||
/usr/include/bits/endian.h /usr/include/bits/byteswap.h \
|
||||
/usr/include/bits/uintn-identity.h /usr/include/bits/types/locale_t.h \
|
||||
/usr/include/bits/types/__locale_t.h /usr/include/string.h \
|
||||
/usr/include/bits/libc-header-start.h \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include/stddef.h \
|
||||
/usr/include/strings.h /usr/include/stdlib.h \
|
||||
/usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \
|
||||
/usr/include/bits/floatn.h /usr/include/bits/floatn-common.h \
|
||||
/usr/include/sys/types.h /usr/include/bits/types/clock_t.h \
|
||||
/usr/include/bits/types/clockid_t.h /usr/include/bits/types/time_t.h \
|
||||
/usr/include/bits/types/timer_t.h /usr/include/bits/stdint-intn.h \
|
||||
/usr/include/sys/select.h /usr/include/bits/select.h \
|
||||
/usr/include/bits/types/sigset_t.h /usr/include/bits/types/__sigset_t.h \
|
||||
/usr/include/bits/types/struct_timeval.h \
|
||||
/usr/include/bits/types/struct_timespec.h \
|
||||
/usr/include/bits/pthreadtypes.h /usr/include/bits/thread-shared-types.h \
|
||||
/usr/include/bits/pthreadtypes-arch.h /usr/include/alloca.h \
|
||||
/usr/include/bits/stdlib-float.h /usr/include/stdio.h \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include/stdarg.h \
|
||||
/usr/include/bits/types/__fpos_t.h /usr/include/bits/types/__mbstate_t.h \
|
||||
/usr/include/bits/types/__fpos64_t.h /usr/include/bits/types/__FILE.h \
|
||||
/usr/include/bits/types/FILE.h /usr/include/bits/types/struct_FILE.h \
|
||||
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include/limits.h \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include/syslimits.h \
|
||||
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
|
||||
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
|
||||
/usr/include/bits/posix2_lim.h /usr/include/math.h \
|
||||
/usr/include/bits/math-vector.h /usr/include/bits/libm-simd-decl-stubs.h \
|
||||
/usr/include/bits/flt-eval-method.h /usr/include/bits/fp-logb.h \
|
||||
/usr/include/bits/fp-fast.h \
|
||||
/usr/include/bits/mathcalls-helper-functions.h \
|
||||
/usr/include/bits/mathcalls.h \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include/float.h \
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/include/cJSON/cJSON_Utils.h \
|
||||
/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/include/cJSON/cJSON.h
|
1
utils/VSConfig/build/CMakeFiles/cmake.check_cache
Normal file
1
utils/VSConfig/build/CMakeFiles/cmake.check_cache
Normal file
@ -0,0 +1 @@
|
||||
# This file is generated by cmake for dependency checking of the CMakeCache.txt file
|
1
utils/VSConfig/build/CMakeFiles/progress.marks
Normal file
1
utils/VSConfig/build/CMakeFiles/progress.marks
Normal file
@ -0,0 +1 @@
|
||||
4
|
284
utils/VSConfig/build/Makefile
Normal file
284
utils/VSConfig/build/Makefile
Normal file
@ -0,0 +1,284 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.26
|
||||
|
||||
# Default target executed when no arguments are given to make.
|
||||
default_target: all
|
||||
.PHONY : default_target
|
||||
|
||||
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
|
||||
.NOTPARALLEL:
|
||||
|
||||
#=============================================================================
|
||||
# Special targets provided by cmake.
|
||||
|
||||
# Disable implicit rules so canonical targets will work.
|
||||
.SUFFIXES:
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : %,v
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : RCS/%
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : RCS/%,v
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : SCCS/s.%
|
||||
|
||||
# Disable VCS-based implicit rules.
|
||||
% : s.%
|
||||
|
||||
.SUFFIXES: .hpux_make_needs_suffix_list
|
||||
|
||||
# Command-line flag to silence nested $(MAKE).
|
||||
$(VERBOSE)MAKESILENT = -s
|
||||
|
||||
#Suppress display of executed commands.
|
||||
$(VERBOSE).SILENT:
|
||||
|
||||
# A target that is always out of date.
|
||||
cmake_force:
|
||||
.PHONY : cmake_force
|
||||
|
||||
#=============================================================================
|
||||
# Set environment variables for the build.
|
||||
|
||||
# The shell in which to execute make rules.
|
||||
SHELL = /bin/sh
|
||||
|
||||
# The CMake executable.
|
||||
CMAKE_COMMAND = /usr/data/zt/download/cmake-3.26.3/bin/cmake
|
||||
|
||||
# The command to remove a file.
|
||||
RM = /usr/data/zt/download/cmake-3.26.3/bin/cmake -E rm -f
|
||||
|
||||
# Escaping for special characters.
|
||||
EQUALS = =
|
||||
|
||||
# The top-level source directory on which CMake was run.
|
||||
CMAKE_SOURCE_DIR = /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig
|
||||
|
||||
# The top-level build directory on which CMake was run.
|
||||
CMAKE_BINARY_DIR = /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build
|
||||
|
||||
#=============================================================================
|
||||
# Targets provided globally by CMake.
|
||||
|
||||
# Special rule for the target edit_cache
|
||||
edit_cache:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
|
||||
/usr/data/zt/download/cmake-3.26.3/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
|
||||
.PHONY : edit_cache
|
||||
|
||||
# Special rule for the target edit_cache
|
||||
edit_cache/fast: edit_cache
|
||||
.PHONY : edit_cache/fast
|
||||
|
||||
# Special rule for the target rebuild_cache
|
||||
rebuild_cache:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
|
||||
/usr/data/zt/download/cmake-3.26.3/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
|
||||
.PHONY : rebuild_cache
|
||||
|
||||
# Special rule for the target rebuild_cache
|
||||
rebuild_cache/fast: rebuild_cache
|
||||
.PHONY : rebuild_cache/fast
|
||||
|
||||
# Special rule for the target list_install_components
|
||||
list_install_components:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
|
||||
.PHONY : list_install_components
|
||||
|
||||
# Special rule for the target list_install_components
|
||||
list_install_components/fast: list_install_components
|
||||
.PHONY : list_install_components/fast
|
||||
|
||||
# Special rule for the target install
|
||||
install: preinstall
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
|
||||
/usr/data/zt/download/cmake-3.26.3/bin/cmake -P cmake_install.cmake
|
||||
.PHONY : install
|
||||
|
||||
# Special rule for the target install
|
||||
install/fast: preinstall/fast
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
|
||||
/usr/data/zt/download/cmake-3.26.3/bin/cmake -P cmake_install.cmake
|
||||
.PHONY : install/fast
|
||||
|
||||
# Special rule for the target install/local
|
||||
install/local: preinstall
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
|
||||
/usr/data/zt/download/cmake-3.26.3/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
|
||||
.PHONY : install/local
|
||||
|
||||
# Special rule for the target install/local
|
||||
install/local/fast: preinstall/fast
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
|
||||
/usr/data/zt/download/cmake-3.26.3/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
|
||||
.PHONY : install/local/fast
|
||||
|
||||
# Special rule for the target install/strip
|
||||
install/strip: preinstall
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
|
||||
/usr/data/zt/download/cmake-3.26.3/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
|
||||
.PHONY : install/strip
|
||||
|
||||
# Special rule for the target install/strip
|
||||
install/strip/fast: preinstall/fast
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
|
||||
/usr/data/zt/download/cmake-3.26.3/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
|
||||
.PHONY : install/strip/fast
|
||||
|
||||
# The main all target
|
||||
all: cmake_check_build_system
|
||||
$(CMAKE_COMMAND) -E cmake_progress_start /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build//CMakeFiles/progress.marks
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
|
||||
$(CMAKE_COMMAND) -E cmake_progress_start /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/CMakeFiles 0
|
||||
.PHONY : all
|
||||
|
||||
# The main clean target
|
||||
clean:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean
|
||||
.PHONY : clean
|
||||
|
||||
# The main clean target
|
||||
clean/fast: clean
|
||||
.PHONY : clean/fast
|
||||
|
||||
# Prepare targets for installation.
|
||||
preinstall: all
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
|
||||
.PHONY : preinstall
|
||||
|
||||
# Prepare targets for installation.
|
||||
preinstall/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
|
||||
.PHONY : preinstall/fast
|
||||
|
||||
# clear depends
|
||||
depend:
|
||||
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
|
||||
.PHONY : depend
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named VSConfig
|
||||
|
||||
# Build rule for target.
|
||||
VSConfig: cmake_check_build_system
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 VSConfig
|
||||
.PHONY : VSConfig
|
||||
|
||||
# fast build rule for target.
|
||||
VSConfig/fast:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/build
|
||||
.PHONY : VSConfig/fast
|
||||
|
||||
src/VSConfig.o: src/VSConfig.c.o
|
||||
.PHONY : src/VSConfig.o
|
||||
|
||||
# target to build an object file
|
||||
src/VSConfig.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/src/VSConfig.c.o
|
||||
.PHONY : src/VSConfig.c.o
|
||||
|
||||
src/VSConfig.i: src/VSConfig.c.i
|
||||
.PHONY : src/VSConfig.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/VSConfig.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/src/VSConfig.c.i
|
||||
.PHONY : src/VSConfig.c.i
|
||||
|
||||
src/VSConfig.s: src/VSConfig.c.s
|
||||
.PHONY : src/VSConfig.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/VSConfig.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/src/VSConfig.c.s
|
||||
.PHONY : src/VSConfig.c.s
|
||||
|
||||
src/cJSON.o: src/cJSON.c.o
|
||||
.PHONY : src/cJSON.o
|
||||
|
||||
# target to build an object file
|
||||
src/cJSON.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/src/cJSON.c.o
|
||||
.PHONY : src/cJSON.c.o
|
||||
|
||||
src/cJSON.i: src/cJSON.c.i
|
||||
.PHONY : src/cJSON.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/cJSON.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/src/cJSON.c.i
|
||||
.PHONY : src/cJSON.c.i
|
||||
|
||||
src/cJSON.s: src/cJSON.c.s
|
||||
.PHONY : src/cJSON.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/cJSON.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/src/cJSON.c.s
|
||||
.PHONY : src/cJSON.c.s
|
||||
|
||||
src/cJSON_Utils.o: src/cJSON_Utils.c.o
|
||||
.PHONY : src/cJSON_Utils.o
|
||||
|
||||
# target to build an object file
|
||||
src/cJSON_Utils.c.o:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.o
|
||||
.PHONY : src/cJSON_Utils.c.o
|
||||
|
||||
src/cJSON_Utils.i: src/cJSON_Utils.c.i
|
||||
.PHONY : src/cJSON_Utils.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/cJSON_Utils.c.i:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.i
|
||||
.PHONY : src/cJSON_Utils.c.i
|
||||
|
||||
src/cJSON_Utils.s: src/cJSON_Utils.c.s
|
||||
.PHONY : src/cJSON_Utils.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/cJSON_Utils.c.s:
|
||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/VSConfig.dir/build.make CMakeFiles/VSConfig.dir/src/cJSON_Utils.c.s
|
||||
.PHONY : src/cJSON_Utils.c.s
|
||||
|
||||
# Help Target
|
||||
help:
|
||||
@echo "The following are some of the valid targets for this Makefile:"
|
||||
@echo "... all (the default if no target is provided)"
|
||||
@echo "... clean"
|
||||
@echo "... depend"
|
||||
@echo "... edit_cache"
|
||||
@echo "... install"
|
||||
@echo "... install/local"
|
||||
@echo "... install/strip"
|
||||
@echo "... list_install_components"
|
||||
@echo "... rebuild_cache"
|
||||
@echo "... VSConfig"
|
||||
@echo "... src/VSConfig.o"
|
||||
@echo "... src/VSConfig.i"
|
||||
@echo "... src/VSConfig.s"
|
||||
@echo "... src/cJSON.o"
|
||||
@echo "... src/cJSON.i"
|
||||
@echo "... src/cJSON.s"
|
||||
@echo "... src/cJSON_Utils.o"
|
||||
@echo "... src/cJSON_Utils.i"
|
||||
@echo "... src/cJSON_Utils.s"
|
||||
.PHONY : help
|
||||
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# Special targets to cleanup operation of make.
|
||||
|
||||
# Special rule to run CMake to check the build system integrity.
|
||||
# No rule that depends on this can have commands that come from listfiles
|
||||
# because they might be regenerated.
|
||||
cmake_check_build_system:
|
||||
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
|
||||
.PHONY : cmake_check_build_system
|
||||
|
77
utils/VSConfig/build/cmake_install.cmake
Normal file
77
utils/VSConfig/build/cmake_install.cmake
Normal file
@ -0,0 +1,77 @@
|
||||
# Install script for directory: /usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig
|
||||
|
||||
# Set the install prefix
|
||||
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||
set(CMAKE_INSTALL_PREFIX "/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/bin")
|
||||
endif()
|
||||
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
# Set the install configuration name.
|
||||
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
||||
if(BUILD_TYPE)
|
||||
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
|
||||
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_CONFIG_NAME "")
|
||||
endif()
|
||||
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
|
||||
endif()
|
||||
|
||||
# Set the component getting installed.
|
||||
if(NOT CMAKE_INSTALL_COMPONENT)
|
||||
if(COMPONENT)
|
||||
message(STATUS "Install component: \"${COMPONENT}\"")
|
||||
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_COMPONENT)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Install shared libraries without execute permission?
|
||||
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
|
||||
set(CMAKE_INSTALL_SO_NO_EXE "0")
|
||||
endif()
|
||||
|
||||
# Is this installation the result of a crosscompile?
|
||||
if(NOT DEFINED CMAKE_CROSSCOMPILING)
|
||||
set(CMAKE_CROSSCOMPILING "FALSE")
|
||||
endif()
|
||||
|
||||
# Set default install directory permissions.
|
||||
if(NOT DEFINED CMAKE_OBJDUMP)
|
||||
set(CMAKE_OBJDUMP "/usr/bin/objdump")
|
||||
endif()
|
||||
|
||||
if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT)
|
||||
if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libVSConfig.so" AND
|
||||
NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libVSConfig.so")
|
||||
file(RPATH_CHECK
|
||||
FILE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libVSConfig.so"
|
||||
RPATH "")
|
||||
endif()
|
||||
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE SHARED_LIBRARY FILES "/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/libVSConfig.so")
|
||||
if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libVSConfig.so" AND
|
||||
NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libVSConfig.so")
|
||||
if(CMAKE_INSTALL_DO_STRIP)
|
||||
execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libVSConfig.so")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT)
|
||||
endif()
|
||||
|
||||
if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT)
|
||||
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/include/VSConfig" TYPE FILE FILES "/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/include/VSConfig.h")
|
||||
endif()
|
||||
|
||||
if(CMAKE_INSTALL_COMPONENT)
|
||||
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
|
||||
else()
|
||||
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
|
||||
"${CMAKE_INSTALL_MANIFEST_FILES}")
|
||||
file(WRITE "/usr/data/zt/git/AW-Sm-Rpc/utils/VSConfig/build/${CMAKE_INSTALL_MANIFEST}"
|
||||
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
|
BIN
utils/VSConfig/build/libVSConfig.so
Executable file
BIN
utils/VSConfig/build/libVSConfig.so
Executable file
Binary file not shown.
49
utils/VSConfig/include/VSConfig.h
Normal file
49
utils/VSConfig/include/VSConfig.h
Normal file
@ -0,0 +1,49 @@
|
||||
#ifndef __VSCONFIG_H__
|
||||
#define __VSCONFIG_H__
|
||||
|
||||
enum VSConfigType_E
|
||||
{
|
||||
VSConfigTypeString,
|
||||
VSConfigTypeInt,
|
||||
VSConfigTypeDouble,
|
||||
VSConfigTypeStringOption,
|
||||
VSConfigTypeIntOption,
|
||||
VSConfigTypeDoubleOption
|
||||
};
|
||||
|
||||
#define VSConfigMandatory 1
|
||||
#define VSConfigOptional 2
|
||||
|
||||
typedef struct VSConfig_S
|
||||
{
|
||||
int Type;
|
||||
char *Name;
|
||||
union
|
||||
{
|
||||
int *piValue;
|
||||
double *plfValue;
|
||||
char *pcValue;
|
||||
}pValue;
|
||||
int ValueMaxLen;
|
||||
char *Detail;
|
||||
}VSConfig_s, *pVSConfig_s;
|
||||
|
||||
#define VSConfigStart {
|
||||
|
||||
#define VSConfigString(Name, _Value, ValueMaxLen, Detail) { VSConfigTypeString, (char *)Name, .pValue.pcValue = (char *)(_Value), ValueMaxLen, Detail },
|
||||
#define VSConfigInt(Name, _Value, Detail) { VSConfigTypeInt, (char *)Name, .pValue.piValue = (int *)(_Value), 0, Detail },
|
||||
#define VSConfigDouble(Name, _Value, Detail) { VSConfigTypeDouble, (char *)Name, .pValue.plfValue = (double *)(_Value), 0, Detail },
|
||||
|
||||
#define VSConfigStringOption(Name, _Value, ValueMaxLen, Detail) { VSConfigTypeStringOption, (char *)Name, .pValue.pcValue = (char *)(_Value), ValueMaxLen, Detail },
|
||||
#define VSConfigIntOption(Name, _Value, Detail) { VSConfigTypeIntOption, (char *)Name, .pValue.piValue = (int *)(_Value), 0, Detail },
|
||||
#define VSConfigDoubleOption(Name, _Value, Detail) { VSConfigTypeDoubleOption, (char *)Name, .pValue.plfValue = (double *)(_Value), 0, Detail },
|
||||
|
||||
#define VSConfigNULL { 0, 0, 0, 0, 0 }
|
||||
#define VSConfigEnd VSConfigNULL };
|
||||
|
||||
void VSConfigHelp(pVSConfig_s psVSConfig);
|
||||
|
||||
int VSConfig(pVSConfig_s psVSConfig, char *pcFilePath);
|
||||
|
||||
|
||||
#endif
|
300
utils/VSConfig/include/cJSON/cJSON.h
Normal file
300
utils/VSConfig/include/cJSON/cJSON.h
Normal file
@ -0,0 +1,300 @@
|
||||
/*
|
||||
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef cJSON__h
|
||||
#define cJSON__h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options:
|
||||
|
||||
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
|
||||
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
|
||||
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
|
||||
|
||||
For *nix builds that support visibility attribute, you can define similar behavior by
|
||||
|
||||
setting default visibility to hidden by adding
|
||||
-fvisibility=hidden (for gcc)
|
||||
or
|
||||
-xldscope=hidden (for sun cc)
|
||||
to CFLAGS
|
||||
|
||||
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
|
||||
|
||||
*/
|
||||
|
||||
#define CJSON_CDECL __cdecl
|
||||
#define CJSON_STDCALL __stdcall
|
||||
|
||||
/* export symbols by default, this is necessary for copy pasting the C and header file */
|
||||
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_EXPORT_SYMBOLS
|
||||
#endif
|
||||
|
||||
#if defined(CJSON_HIDE_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) type CJSON_STDCALL
|
||||
#elif defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL
|
||||
#elif defined(CJSON_IMPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL
|
||||
#endif
|
||||
#else /* !__WINDOWS__ */
|
||||
#define CJSON_CDECL
|
||||
#define CJSON_STDCALL
|
||||
|
||||
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
|
||||
#else
|
||||
#define CJSON_PUBLIC(type) type
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* project version */
|
||||
#define CJSON_VERSION_MAJOR 1
|
||||
#define CJSON_VERSION_MINOR 7
|
||||
#define CJSON_VERSION_PATCH 15
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* cJSON Types: */
|
||||
#define cJSON_Invalid (0)
|
||||
#define cJSON_False (1 << 0)
|
||||
#define cJSON_True (1 << 1)
|
||||
#define cJSON_NULL (1 << 2)
|
||||
#define cJSON_Number (1 << 3)
|
||||
#define cJSON_String (1 << 4)
|
||||
#define cJSON_Array (1 << 5)
|
||||
#define cJSON_Object (1 << 6)
|
||||
#define cJSON_Raw (1 << 7) /* raw json */
|
||||
|
||||
#define cJSON_IsReference 256
|
||||
#define cJSON_StringIsConst 512
|
||||
|
||||
/* The cJSON structure: */
|
||||
typedef struct cJSON
|
||||
{
|
||||
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||
struct cJSON *next;
|
||||
struct cJSON *prev;
|
||||
/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||
struct cJSON *child;
|
||||
|
||||
/* The type of the item, as above. */
|
||||
int type;
|
||||
|
||||
/* The item's string, if type==cJSON_String and type == cJSON_Raw */
|
||||
char *valuestring;
|
||||
/* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
|
||||
int valueint;
|
||||
/* The item's number, if type==cJSON_Number */
|
||||
double valuedouble;
|
||||
|
||||
/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||
char *string;
|
||||
} cJSON;
|
||||
|
||||
typedef struct cJSON_Hooks
|
||||
{
|
||||
/* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
|
||||
void *(CJSON_CDECL *malloc_fn)(size_t sz);
|
||||
void (CJSON_CDECL *free_fn)(void *ptr);
|
||||
} cJSON_Hooks;
|
||||
|
||||
typedef int cJSON_bool;
|
||||
|
||||
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
|
||||
* This is to prevent stack overflows. */
|
||||
#ifndef CJSON_NESTING_LIMIT
|
||||
#define CJSON_NESTING_LIMIT 1000
|
||||
#endif
|
||||
|
||||
/* returns the version of cJSON as a string */
|
||||
CJSON_PUBLIC(const char*) cJSON_Version(void);
|
||||
|
||||
/* Supply malloc, realloc and free functions to cJSON */
|
||||
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||
|
||||
/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length);
|
||||
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||
/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||
|
||||
/* Render a cJSON entity to text for transfer/storage. */
|
||||
CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage without any formatting. */
|
||||
CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
|
||||
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
|
||||
CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
|
||||
/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
|
||||
/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
|
||||
/* Delete a cJSON entity and all subentities. */
|
||||
CJSON_PUBLIC(void) cJSON_Delete(cJSON *item);
|
||||
|
||||
/* Returns the number of items in an array (or object). */
|
||||
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
|
||||
/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
|
||||
/* Get item "string" from object. Case insensitive. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
|
||||
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
|
||||
|
||||
/* Check item type and return its value */
|
||||
CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item);
|
||||
CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item);
|
||||
|
||||
/* These functions check the type of an item */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
|
||||
|
||||
/* These calls create a cJSON item of the appropriate type. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
|
||||
/* raw json */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
|
||||
|
||||
/* Create a string where valuestring references a string so
|
||||
* it will not be freed by cJSON_Delete */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
|
||||
/* Create an object/array that only references it's elements so
|
||||
* they will not be freed by cJSON_Delete */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
|
||||
|
||||
/* These utilities create an Array of count items.
|
||||
* The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count);
|
||||
|
||||
/* Append item to the specified array/object. */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
|
||||
/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
|
||||
* WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
|
||||
* writing to `item->string` */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
|
||||
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
|
||||
|
||||
/* Remove/Detach items from Arrays/Objects. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||
|
||||
/* Update array items. */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
|
||||
|
||||
/* Duplicate a cJSON item */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
|
||||
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||
* need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||
* The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||
/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
|
||||
* case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
|
||||
|
||||
/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings.
|
||||
* The input pointer json cannot point to a read-only address area, such as a string constant,
|
||||
* but should point to a readable and writable address area. */
|
||||
CJSON_PUBLIC(void) cJSON_Minify(char *json);
|
||||
|
||||
/* Helper functions for creating and adding items to an object at the same time.
|
||||
* They return the added item or NULL on failure. */
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
|
||||
|
||||
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
|
||||
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
|
||||
/* helper for the cJSON_SetNumberValue macro */
|
||||
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
|
||||
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
|
||||
/* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */
|
||||
CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring);
|
||||
|
||||
/* If the object is not a boolean type this does nothing and returns cJSON_Invalid else it returns the new type*/
|
||||
#define cJSON_SetBoolValue(object, boolValue) ( \
|
||||
(object != NULL && ((object)->type & (cJSON_False|cJSON_True))) ? \
|
||||
(object)->type=((object)->type &(~(cJSON_False|cJSON_True)))|((boolValue)?cJSON_True:cJSON_False) : \
|
||||
cJSON_Invalid\
|
||||
)
|
||||
|
||||
/* Macro for iterating over an array or object */
|
||||
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
||||
|
||||
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
|
||||
CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
|
||||
CJSON_PUBLIC(void) cJSON_free(void *object);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
88
utils/VSConfig/include/cJSON/cJSON_Utils.h
Normal file
88
utils/VSConfig/include/cJSON/cJSON_Utils.h
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef cJSON_Utils__h
|
||||
#define cJSON_Utils__h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "cJSON.h"
|
||||
|
||||
/* Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec. */
|
||||
CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointer(cJSON * const object, const char *pointer);
|
||||
CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointerCaseSensitive(cJSON * const object, const char *pointer);
|
||||
|
||||
/* Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. */
|
||||
/* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */
|
||||
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatches(cJSON * const from, cJSON * const to);
|
||||
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatchesCaseSensitive(cJSON * const from, cJSON * const to);
|
||||
/* Utility for generating patch array entries. */
|
||||
CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON * const array, const char * const operation, const char * const path, const cJSON * const value);
|
||||
/* Returns 0 for success. */
|
||||
CJSON_PUBLIC(int) cJSONUtils_ApplyPatches(cJSON * const object, const cJSON * const patches);
|
||||
CJSON_PUBLIC(int) cJSONUtils_ApplyPatchesCaseSensitive(cJSON * const object, const cJSON * const patches);
|
||||
|
||||
/*
|
||||
// Note that ApplyPatches is NOT atomic on failure. To implement an atomic ApplyPatches, use:
|
||||
//int cJSONUtils_AtomicApplyPatches(cJSON **object, cJSON *patches)
|
||||
//{
|
||||
// cJSON *modme = cJSON_Duplicate(*object, 1);
|
||||
// int error = cJSONUtils_ApplyPatches(modme, patches);
|
||||
// if (!error)
|
||||
// {
|
||||
// cJSON_Delete(*object);
|
||||
// *object = modme;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// cJSON_Delete(modme);
|
||||
// }
|
||||
//
|
||||
// return error;
|
||||
//}
|
||||
// Code not added to library since this strategy is a LOT slower.
|
||||
*/
|
||||
|
||||
/* Implement RFC7386 (https://tools.ietf.org/html/rfc7396) JSON Merge Patch spec. */
|
||||
/* target will be modified by patch. return value is new ptr for target. */
|
||||
CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatch(cJSON *target, const cJSON * const patch);
|
||||
CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatchCaseSensitive(cJSON *target, const cJSON * const patch);
|
||||
/* generates a patch to move from -> to */
|
||||
/* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */
|
||||
CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatch(cJSON * const from, cJSON * const to);
|
||||
CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatchCaseSensitive(cJSON * const from, cJSON * const to);
|
||||
|
||||
/* Given a root object and a target object, construct a pointer from one to the other. */
|
||||
CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const object, const cJSON * const target);
|
||||
|
||||
/* Sorts the members of the object into alphabetical order. */
|
||||
CJSON_PUBLIC(void) cJSONUtils_SortObject(cJSON * const object);
|
||||
CJSON_PUBLIC(void) cJSONUtils_SortObjectCaseSensitive(cJSON * const object);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
113
utils/VSConfig/src/VSConfig.c
Normal file
113
utils/VSConfig/src/VSConfig.c
Normal file
@ -0,0 +1,113 @@
|
||||
#include "VSConfig.h"
|
||||
|
||||
#include "cJSON/cJSON.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void VSConfigHelp(pVSConfig_s psVSConfig)
|
||||
{
|
||||
printf("Config Help\n");
|
||||
|
||||
for(int iCnt = 0; psVSConfig[iCnt].Name; ++iCnt)
|
||||
{
|
||||
switch (psVSConfig[iCnt].Type)
|
||||
{
|
||||
case VSConfigTypeString:
|
||||
printf("*");
|
||||
case VSConfigTypeStringOption:
|
||||
printf("[String][MaxLen:%d]%s:%s\n", psVSConfig[iCnt].ValueMaxLen, psVSConfig[iCnt].Name, psVSConfig[iCnt].Detail);
|
||||
break;
|
||||
|
||||
case VSConfigTypeInt:
|
||||
printf("*");
|
||||
case VSConfigTypeIntOption:
|
||||
printf("[Integer]%s:%s\n", psVSConfig[iCnt].Name, psVSConfig[iCnt].Detail);
|
||||
break;
|
||||
|
||||
case VSConfigTypeDouble:
|
||||
printf("*");
|
||||
case VSConfigTypeDoubleOption:
|
||||
printf("[Double]%s:%s\n", psVSConfig[iCnt].Name, psVSConfig[iCnt].Detail);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
int VSConfig(pVSConfig_s psVSConfig, char *pcFilePath)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
int fdFile = -1;
|
||||
char *pcReadData = NULL;
|
||||
cJSON *cJSONRoot = NULL;
|
||||
do
|
||||
{
|
||||
fdFile = open(pcFilePath, O_RDONLY, 0777);
|
||||
if(!fdFile) { /*printf("Open %s fail\n", pcFilePath);*/ rv = -1; break; }
|
||||
|
||||
int iFileLen = lseek(fdFile, 0, SEEK_END);
|
||||
lseek(fdFile, 0, SEEK_SET);
|
||||
|
||||
pcReadData = (char *)malloc(sizeof(char) * (iFileLen + 1));
|
||||
if(!pcReadData) { /*printf("Read malloc %d size fail\n", iFileLen);*/ rv = -1; break; }
|
||||
|
||||
rv = read(fdFile, pcReadData, iFileLen);
|
||||
if(rv <= 0) { /*printf("Read fail rv = %d\n", rv);*/ rv = -1; break; }
|
||||
|
||||
cJSONRoot = cJSON_Parse(pcReadData);
|
||||
if(!cJSONRoot) { /*printf("cJSON_Parse %s fail\n", pcReadData);*/ rv = -1; break; }
|
||||
|
||||
cJSON *cJSONTmp = NULL;
|
||||
for(int iCnt = 0; psVSConfig[iCnt].Name; ++iCnt)
|
||||
{
|
||||
|
||||
cJSONTmp = cJSON_GetObjectItem(cJSONRoot, psVSConfig[iCnt].Name);
|
||||
if(psVSConfig[iCnt].Type < 3)
|
||||
{
|
||||
if(!cJSONTmp) { /*printf("%s not found\n", psVSConfig[iCnt].Name);*/ rv = -1; break; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!cJSONTmp) continue;
|
||||
}
|
||||
|
||||
switch (psVSConfig[iCnt].Type)
|
||||
{
|
||||
case VSConfigTypeString:
|
||||
case VSConfigTypeStringOption:
|
||||
snprintf(psVSConfig[iCnt].pValue.pcValue, psVSConfig[iCnt].ValueMaxLen, "%s", cJSON_GetStringValue(cJSONTmp));
|
||||
break;
|
||||
|
||||
case VSConfigTypeInt:
|
||||
case VSConfigTypeIntOption:
|
||||
*psVSConfig[iCnt].pValue.piValue = cJSON_GetNumberValue(cJSONTmp);
|
||||
break;
|
||||
|
||||
case VSConfigTypeDouble:
|
||||
case VSConfigTypeDoubleOption:
|
||||
*psVSConfig[iCnt].pValue.plfValue = cJSON_GetNumberValue(cJSONTmp);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(rv < 0) break;
|
||||
|
||||
rv = 0;
|
||||
}while(0);
|
||||
if(fdFile) close(fdFile);
|
||||
if(pcReadData) free(pcReadData);
|
||||
if(cJSONRoot) cJSON_Delete(cJSONRoot);
|
||||
|
||||
return rv;
|
||||
}
|
3114
utils/VSConfig/src/cJSON.c
Normal file
3114
utils/VSConfig/src/cJSON.c
Normal file
File diff suppressed because it is too large
Load Diff
1481
utils/VSConfig/src/cJSON_Utils.c
Normal file
1481
utils/VSConfig/src/cJSON_Utils.c
Normal file
File diff suppressed because it is too large
Load Diff
25
utils/ZMQLayout/CMakeLists.txt
Normal file
25
utils/ZMQLayout/CMakeLists.txt
Normal file
@ -0,0 +1,25 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
|
||||
PROJECT(ZMQLayout)
|
||||
|
||||
ADD_COMPILE_OPTIONS(-fPIC)
|
||||
|
||||
AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/src src_list)
|
||||
|
||||
ADD_LIBRARY(${PROJECT_NAME} STATIC ${src_list})
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/../VSClock/include)
|
||||
|
||||
TARGET_LINK_DIRECTORIES(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/lib
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
stdc++
|
||||
VSClock
|
||||
zmq
|
||||
)
|
26
utils/ZMQLayout/include/ZMQLayout.h
Normal file
26
utils/ZMQLayout/include/ZMQLayout.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef __ZMQLAYOUT_H__
|
||||
#define __ZMQLAYOUT_H__
|
||||
|
||||
#include "zmq.h"
|
||||
|
||||
typedef void * pZMQ_s;
|
||||
|
||||
pZMQ_s ZMQServerInit(const char *pcAddress);
|
||||
|
||||
pZMQ_s ZMQClientInit(const char *pcAddress);
|
||||
|
||||
void ZMQDestroy(pZMQ_s psZMQ);
|
||||
|
||||
int ZMQSend(void *phZMQ, const char *pcBuf, const int iBufLen);
|
||||
|
||||
typedef struct ZMQBuf_S
|
||||
{
|
||||
char *pcBuf;
|
||||
int iBufLen;
|
||||
}ZMQBuf_s, *pZMQBuf_s;
|
||||
|
||||
void ZMQBufDestroy(pZMQBuf_s psZMQBuf);
|
||||
|
||||
pZMQBuf_s ZMQRecv(void *phZMQSocket, int iWaitTime);
|
||||
|
||||
#endif
|
787
utils/ZMQLayout/include/zmq.h
Normal file
787
utils/ZMQLayout/include/zmq.h
Normal file
@ -0,0 +1,787 @@
|
||||
/* SPDX-License-Identifier: MPL-2.0 */
|
||||
/* *************************************************************************
|
||||
NOTE to contributors. This file comprises the principal public contract
|
||||
for ZeroMQ API users. Any change to this file supplied in a stable
|
||||
release SHOULD not break existing applications.
|
||||
In practice this means that the value of constants must not change, and
|
||||
that old values may not be reused for new constants.
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ZMQ_H_INCLUDED__
|
||||
#define __ZMQ_H_INCLUDED__
|
||||
|
||||
/* Version macros for compile-time API version detection */
|
||||
#define ZMQ_VERSION_MAJOR 4
|
||||
#define ZMQ_VERSION_MINOR 3
|
||||
#define ZMQ_VERSION_PATCH 6
|
||||
|
||||
#define ZMQ_MAKE_VERSION(major, minor, patch) \
|
||||
((major) *10000 + (minor) *100 + (patch))
|
||||
#define ZMQ_VERSION \
|
||||
ZMQ_MAKE_VERSION (ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined _WIN32_WCE
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Handle DSO symbol visibility */
|
||||
#if defined ZMQ_NO_EXPORT
|
||||
#define ZMQ_EXPORT
|
||||
#else
|
||||
#if defined _WIN32
|
||||
#if defined ZMQ_STATIC
|
||||
#define ZMQ_EXPORT
|
||||
#elif defined DLL_EXPORT
|
||||
#define ZMQ_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define ZMQ_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#if defined __SUNPRO_C || defined __SUNPRO_CC
|
||||
#define ZMQ_EXPORT __global
|
||||
#elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER
|
||||
#define ZMQ_EXPORT __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#define ZMQ_EXPORT
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define integer types needed for event interface */
|
||||
#define ZMQ_DEFINED_STDINT 1
|
||||
#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS
|
||||
#include <inttypes.h>
|
||||
#elif defined _MSC_VER && _MSC_VER < 1600
|
||||
#ifndef uint64_t
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#endif
|
||||
#ifndef int32_t
|
||||
typedef __int32 int32_t;
|
||||
#endif
|
||||
#ifndef uint32_t
|
||||
typedef unsigned __int32 uint32_t;
|
||||
#endif
|
||||
#ifndef uint16_t
|
||||
typedef unsigned __int16 uint16_t;
|
||||
#endif
|
||||
#ifndef uint8_t
|
||||
typedef unsigned __int8 uint8_t;
|
||||
#endif
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if !defined _WIN32
|
||||
// needed for sigset_t definition in zmq_ppoll
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
// 32-bit AIX's pollfd struct members are called reqevents and rtnevents so it
|
||||
// defines compatibility macros for them. Need to include that header first to
|
||||
// stop build failures since zmq_pollset_t defines them as events and revents.
|
||||
#ifdef ZMQ_HAVE_AIX
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* 0MQ errors. */
|
||||
/******************************************************************************/
|
||||
|
||||
/* A number random enough not to collide with different errno ranges on */
|
||||
/* different OSes. The assumption is that error_t is at least 32-bit type. */
|
||||
#define ZMQ_HAUSNUMERO 156384712
|
||||
|
||||
/* On Windows platform some of the standard POSIX errnos are not defined. */
|
||||
#ifndef ENOTSUP
|
||||
#define ENOTSUP (ZMQ_HAUSNUMERO + 1)
|
||||
#endif
|
||||
#ifndef EPROTONOSUPPORT
|
||||
#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2)
|
||||
#endif
|
||||
#ifndef ENOBUFS
|
||||
#define ENOBUFS (ZMQ_HAUSNUMERO + 3)
|
||||
#endif
|
||||
#ifndef ENETDOWN
|
||||
#define ENETDOWN (ZMQ_HAUSNUMERO + 4)
|
||||
#endif
|
||||
#ifndef EADDRINUSE
|
||||
#define EADDRINUSE (ZMQ_HAUSNUMERO + 5)
|
||||
#endif
|
||||
#ifndef EADDRNOTAVAIL
|
||||
#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6)
|
||||
#endif
|
||||
#ifndef ECONNREFUSED
|
||||
#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7)
|
||||
#endif
|
||||
#ifndef EINPROGRESS
|
||||
#define EINPROGRESS (ZMQ_HAUSNUMERO + 8)
|
||||
#endif
|
||||
#ifndef ENOTSOCK
|
||||
#define ENOTSOCK (ZMQ_HAUSNUMERO + 9)
|
||||
#endif
|
||||
#ifndef EMSGSIZE
|
||||
#define EMSGSIZE (ZMQ_HAUSNUMERO + 10)
|
||||
#endif
|
||||
#ifndef EAFNOSUPPORT
|
||||
#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11)
|
||||
#endif
|
||||
#ifndef ENETUNREACH
|
||||
#define ENETUNREACH (ZMQ_HAUSNUMERO + 12)
|
||||
#endif
|
||||
#ifndef ECONNABORTED
|
||||
#define ECONNABORTED (ZMQ_HAUSNUMERO + 13)
|
||||
#endif
|
||||
#ifndef ECONNRESET
|
||||
#define ECONNRESET (ZMQ_HAUSNUMERO + 14)
|
||||
#endif
|
||||
#ifndef ENOTCONN
|
||||
#define ENOTCONN (ZMQ_HAUSNUMERO + 15)
|
||||
#endif
|
||||
#ifndef ETIMEDOUT
|
||||
#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16)
|
||||
#endif
|
||||
#ifndef EHOSTUNREACH
|
||||
#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17)
|
||||
#endif
|
||||
#ifndef ENETRESET
|
||||
#define ENETRESET (ZMQ_HAUSNUMERO + 18)
|
||||
#endif
|
||||
|
||||
/* Native 0MQ error codes. */
|
||||
#define EFSM (ZMQ_HAUSNUMERO + 51)
|
||||
#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52)
|
||||
#define ETERM (ZMQ_HAUSNUMERO + 53)
|
||||
#define EMTHREAD (ZMQ_HAUSNUMERO + 54)
|
||||
|
||||
/* This function retrieves the errno as it is known to 0MQ library. The goal */
|
||||
/* of this function is to make the code 100% portable, including where 0MQ */
|
||||
/* compiled with certain CRT library (on Windows) is linked to an */
|
||||
/* application that uses different CRT library. */
|
||||
ZMQ_EXPORT int zmq_errno (void);
|
||||
|
||||
/* Resolves system errors and 0MQ errors to human-readable string. */
|
||||
ZMQ_EXPORT const char *zmq_strerror (int errnum_);
|
||||
|
||||
/* Run-time API version detection */
|
||||
ZMQ_EXPORT void zmq_version (int *major_, int *minor_, int *patch_);
|
||||
|
||||
/******************************************************************************/
|
||||
/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */
|
||||
/******************************************************************************/
|
||||
|
||||
/* Context options */
|
||||
#define ZMQ_IO_THREADS 1
|
||||
#define ZMQ_MAX_SOCKETS 2
|
||||
#define ZMQ_SOCKET_LIMIT 3
|
||||
#define ZMQ_THREAD_PRIORITY 3
|
||||
#define ZMQ_THREAD_SCHED_POLICY 4
|
||||
#define ZMQ_MAX_MSGSZ 5
|
||||
#define ZMQ_MSG_T_SIZE 6
|
||||
#define ZMQ_THREAD_AFFINITY_CPU_ADD 7
|
||||
#define ZMQ_THREAD_AFFINITY_CPU_REMOVE 8
|
||||
#define ZMQ_THREAD_NAME_PREFIX 9
|
||||
|
||||
/* Default for new contexts */
|
||||
#define ZMQ_IO_THREADS_DFLT 1
|
||||
#define ZMQ_MAX_SOCKETS_DFLT 1023
|
||||
#define ZMQ_THREAD_PRIORITY_DFLT -1
|
||||
#define ZMQ_THREAD_SCHED_POLICY_DFLT -1
|
||||
|
||||
ZMQ_EXPORT void *zmq_ctx_new (void);
|
||||
ZMQ_EXPORT int zmq_ctx_term (void *context_);
|
||||
ZMQ_EXPORT int zmq_ctx_shutdown (void *context_);
|
||||
ZMQ_EXPORT int zmq_ctx_set (void *context_, int option_, int optval_);
|
||||
ZMQ_EXPORT int zmq_ctx_get (void *context_, int option_);
|
||||
|
||||
/* Old (legacy) API */
|
||||
ZMQ_EXPORT void *zmq_init (int io_threads_);
|
||||
ZMQ_EXPORT int zmq_term (void *context_);
|
||||
ZMQ_EXPORT int zmq_ctx_destroy (void *context_);
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* 0MQ message definition. */
|
||||
/******************************************************************************/
|
||||
|
||||
/* Some architectures, like sparc64 and some variants of aarch64, enforce pointer
|
||||
* alignment and raise sigbus on violations. Make sure applications allocate
|
||||
* zmq_msg_t on addresses aligned on a pointer-size boundary to avoid this issue.
|
||||
*/
|
||||
typedef struct zmq_msg_t
|
||||
{
|
||||
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64))
|
||||
__declspec(align (8)) unsigned char _[64];
|
||||
#elif defined(_MSC_VER) \
|
||||
&& (defined(_M_IX86) || defined(_M_ARM_ARMV7VE) || defined(_M_ARM))
|
||||
__declspec(align (4)) unsigned char _[64];
|
||||
#elif defined(__GNUC__) || defined(__INTEL_COMPILER) \
|
||||
|| (defined(__SUNPRO_C) && __SUNPRO_C >= 0x590) \
|
||||
|| (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590)
|
||||
unsigned char _[64] __attribute__ ((aligned (sizeof (void *))));
|
||||
#else
|
||||
unsigned char _[64];
|
||||
#endif
|
||||
} zmq_msg_t;
|
||||
|
||||
typedef void (zmq_free_fn) (void *data_, void *hint_);
|
||||
|
||||
ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg_);
|
||||
ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg_, size_t size_);
|
||||
ZMQ_EXPORT int zmq_msg_init_data (
|
||||
zmq_msg_t *msg_, void *data_, size_t size_, zmq_free_fn *ffn_, void *hint_);
|
||||
ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg_, void *s_, int flags_);
|
||||
ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg_, void *s_, int flags_);
|
||||
ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg_);
|
||||
ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest_, zmq_msg_t *src_);
|
||||
ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest_, zmq_msg_t *src_);
|
||||
ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg_);
|
||||
ZMQ_EXPORT size_t zmq_msg_size (const zmq_msg_t *msg_);
|
||||
ZMQ_EXPORT int zmq_msg_more (const zmq_msg_t *msg_);
|
||||
ZMQ_EXPORT int zmq_msg_get (const zmq_msg_t *msg_, int property_);
|
||||
ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg_, int property_, int optval_);
|
||||
ZMQ_EXPORT const char *zmq_msg_gets (const zmq_msg_t *msg_,
|
||||
const char *property_);
|
||||
|
||||
/******************************************************************************/
|
||||
/* 0MQ socket definition. */
|
||||
/******************************************************************************/
|
||||
|
||||
/* Socket types. */
|
||||
#define ZMQ_PAIR 0
|
||||
#define ZMQ_PUB 1
|
||||
#define ZMQ_SUB 2
|
||||
#define ZMQ_REQ 3
|
||||
#define ZMQ_REP 4
|
||||
#define ZMQ_DEALER 5
|
||||
#define ZMQ_ROUTER 6
|
||||
#define ZMQ_PULL 7
|
||||
#define ZMQ_PUSH 8
|
||||
#define ZMQ_XPUB 9
|
||||
#define ZMQ_XSUB 10
|
||||
#define ZMQ_STREAM 11
|
||||
|
||||
/* Deprecated aliases */
|
||||
#define ZMQ_XREQ ZMQ_DEALER
|
||||
#define ZMQ_XREP ZMQ_ROUTER
|
||||
|
||||
/* Socket options. */
|
||||
#define ZMQ_AFFINITY 4
|
||||
#define ZMQ_ROUTING_ID 5
|
||||
#define ZMQ_SUBSCRIBE 6
|
||||
#define ZMQ_UNSUBSCRIBE 7
|
||||
#define ZMQ_RATE 8
|
||||
#define ZMQ_RECOVERY_IVL 9
|
||||
#define ZMQ_SNDBUF 11
|
||||
#define ZMQ_RCVBUF 12
|
||||
#define ZMQ_RCVMORE 13
|
||||
#define ZMQ_FD 14
|
||||
#define ZMQ_EVENTS 15
|
||||
#define ZMQ_TYPE 16
|
||||
#define ZMQ_LINGER 17
|
||||
#define ZMQ_RECONNECT_IVL 18
|
||||
#define ZMQ_BACKLOG 19
|
||||
#define ZMQ_RECONNECT_IVL_MAX 21
|
||||
#define ZMQ_MAXMSGSIZE 22
|
||||
#define ZMQ_SNDHWM 23
|
||||
#define ZMQ_RCVHWM 24
|
||||
#define ZMQ_MULTICAST_HOPS 25
|
||||
#define ZMQ_RCVTIMEO 27
|
||||
#define ZMQ_SNDTIMEO 28
|
||||
#define ZMQ_LAST_ENDPOINT 32
|
||||
#define ZMQ_ROUTER_MANDATORY 33
|
||||
#define ZMQ_TCP_KEEPALIVE 34
|
||||
#define ZMQ_TCP_KEEPALIVE_CNT 35
|
||||
#define ZMQ_TCP_KEEPALIVE_IDLE 36
|
||||
#define ZMQ_TCP_KEEPALIVE_INTVL 37
|
||||
#define ZMQ_IMMEDIATE 39
|
||||
#define ZMQ_XPUB_VERBOSE 40
|
||||
#define ZMQ_ROUTER_RAW 41
|
||||
#define ZMQ_IPV6 42
|
||||
#define ZMQ_MECHANISM 43
|
||||
#define ZMQ_PLAIN_SERVER 44
|
||||
#define ZMQ_PLAIN_USERNAME 45
|
||||
#define ZMQ_PLAIN_PASSWORD 46
|
||||
#define ZMQ_CURVE_SERVER 47
|
||||
#define ZMQ_CURVE_PUBLICKEY 48
|
||||
#define ZMQ_CURVE_SECRETKEY 49
|
||||
#define ZMQ_CURVE_SERVERKEY 50
|
||||
#define ZMQ_PROBE_ROUTER 51
|
||||
#define ZMQ_REQ_CORRELATE 52
|
||||
#define ZMQ_REQ_RELAXED 53
|
||||
#define ZMQ_CONFLATE 54
|
||||
#define ZMQ_ZAP_DOMAIN 55
|
||||
#define ZMQ_ROUTER_HANDOVER 56
|
||||
#define ZMQ_TOS 57
|
||||
#define ZMQ_CONNECT_ROUTING_ID 61
|
||||
#define ZMQ_GSSAPI_SERVER 62
|
||||
#define ZMQ_GSSAPI_PRINCIPAL 63
|
||||
#define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64
|
||||
#define ZMQ_GSSAPI_PLAINTEXT 65
|
||||
#define ZMQ_HANDSHAKE_IVL 66
|
||||
#define ZMQ_SOCKS_PROXY 68
|
||||
#define ZMQ_XPUB_NODROP 69
|
||||
#define ZMQ_BLOCKY 70
|
||||
#define ZMQ_XPUB_MANUAL 71
|
||||
#define ZMQ_XPUB_WELCOME_MSG 72
|
||||
#define ZMQ_STREAM_NOTIFY 73
|
||||
#define ZMQ_INVERT_MATCHING 74
|
||||
#define ZMQ_HEARTBEAT_IVL 75
|
||||
#define ZMQ_HEARTBEAT_TTL 76
|
||||
#define ZMQ_HEARTBEAT_TIMEOUT 77
|
||||
#define ZMQ_XPUB_VERBOSER 78
|
||||
#define ZMQ_CONNECT_TIMEOUT 79
|
||||
#define ZMQ_TCP_MAXRT 80
|
||||
#define ZMQ_THREAD_SAFE 81
|
||||
#define ZMQ_MULTICAST_MAXTPDU 84
|
||||
#define ZMQ_VMCI_BUFFER_SIZE 85
|
||||
#define ZMQ_VMCI_BUFFER_MIN_SIZE 86
|
||||
#define ZMQ_VMCI_BUFFER_MAX_SIZE 87
|
||||
#define ZMQ_VMCI_CONNECT_TIMEOUT 88
|
||||
#define ZMQ_USE_FD 89
|
||||
#define ZMQ_GSSAPI_PRINCIPAL_NAMETYPE 90
|
||||
#define ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE 91
|
||||
#define ZMQ_BINDTODEVICE 92
|
||||
|
||||
/* Message options */
|
||||
#define ZMQ_MORE 1
|
||||
#define ZMQ_SHARED 3
|
||||
|
||||
/* Send/recv options. */
|
||||
#define ZMQ_DONTWAIT 1
|
||||
#define ZMQ_SNDMORE 2
|
||||
|
||||
/* Security mechanisms */
|
||||
#define ZMQ_NULL 0
|
||||
#define ZMQ_PLAIN 1
|
||||
#define ZMQ_CURVE 2
|
||||
#define ZMQ_GSSAPI 3
|
||||
|
||||
/* RADIO-DISH protocol */
|
||||
#define ZMQ_GROUP_MAX_LENGTH 255
|
||||
|
||||
/* Deprecated options and aliases */
|
||||
#define ZMQ_IDENTITY ZMQ_ROUTING_ID
|
||||
#define ZMQ_CONNECT_RID ZMQ_CONNECT_ROUTING_ID
|
||||
#define ZMQ_TCP_ACCEPT_FILTER 38
|
||||
#define ZMQ_IPC_FILTER_PID 58
|
||||
#define ZMQ_IPC_FILTER_UID 59
|
||||
#define ZMQ_IPC_FILTER_GID 60
|
||||
#define ZMQ_IPV4ONLY 31
|
||||
#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE
|
||||
#define ZMQ_NOBLOCK ZMQ_DONTWAIT
|
||||
#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY
|
||||
#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY
|
||||
|
||||
/* Deprecated Message options */
|
||||
#define ZMQ_SRCFD 2
|
||||
|
||||
/******************************************************************************/
|
||||
/* GSSAPI definitions */
|
||||
/******************************************************************************/
|
||||
|
||||
/* GSSAPI principal name types */
|
||||
#define ZMQ_GSSAPI_NT_HOSTBASED 0
|
||||
#define ZMQ_GSSAPI_NT_USER_NAME 1
|
||||
#define ZMQ_GSSAPI_NT_KRB5_PRINCIPAL 2
|
||||
|
||||
/******************************************************************************/
|
||||
/* 0MQ socket events and monitoring */
|
||||
/******************************************************************************/
|
||||
|
||||
/* Socket transport events (TCP, IPC and TIPC only) */
|
||||
|
||||
#define ZMQ_EVENT_CONNECTED 0x0001
|
||||
#define ZMQ_EVENT_CONNECT_DELAYED 0x0002
|
||||
#define ZMQ_EVENT_CONNECT_RETRIED 0x0004
|
||||
#define ZMQ_EVENT_LISTENING 0x0008
|
||||
#define ZMQ_EVENT_BIND_FAILED 0x0010
|
||||
#define ZMQ_EVENT_ACCEPTED 0x0020
|
||||
#define ZMQ_EVENT_ACCEPT_FAILED 0x0040
|
||||
#define ZMQ_EVENT_CLOSED 0x0080
|
||||
#define ZMQ_EVENT_CLOSE_FAILED 0x0100
|
||||
#define ZMQ_EVENT_DISCONNECTED 0x0200
|
||||
#define ZMQ_EVENT_MONITOR_STOPPED 0x0400
|
||||
#define ZMQ_EVENT_ALL 0xFFFF
|
||||
/* Unspecified system errors during handshake. Event value is an errno. */
|
||||
#define ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL 0x0800
|
||||
/* Handshake complete successfully with successful authentication (if *
|
||||
* enabled). Event value is unused. */
|
||||
#define ZMQ_EVENT_HANDSHAKE_SUCCEEDED 0x1000
|
||||
/* Protocol errors between ZMTP peers or between server and ZAP handler. *
|
||||
* Event value is one of ZMQ_PROTOCOL_ERROR_* */
|
||||
#define ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL 0x2000
|
||||
/* Failed authentication requests. Event value is the numeric ZAP status *
|
||||
* code, i.e. 300, 400 or 500. */
|
||||
#define ZMQ_EVENT_HANDSHAKE_FAILED_AUTH 0x4000
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_UNSPECIFIED 0x10000000
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_UNEXPECTED_COMMAND 0x10000001
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_INVALID_SEQUENCE 0x10000002
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_KEY_EXCHANGE 0x10000003
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_UNSPECIFIED 0x10000011
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_MESSAGE 0x10000012
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO 0x10000013
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_INITIATE 0x10000014
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_ERROR 0x10000015
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_READY 0x10000016
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_WELCOME 0x10000017
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_INVALID_METADATA 0x10000018
|
||||
// the following two may be due to erroneous configuration of a peer
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_CRYPTOGRAPHIC 0x11000001
|
||||
#define ZMQ_PROTOCOL_ERROR_ZMTP_MECHANISM_MISMATCH 0x11000002
|
||||
#define ZMQ_PROTOCOL_ERROR_ZAP_UNSPECIFIED 0x20000000
|
||||
#define ZMQ_PROTOCOL_ERROR_ZAP_MALFORMED_REPLY 0x20000001
|
||||
#define ZMQ_PROTOCOL_ERROR_ZAP_BAD_REQUEST_ID 0x20000002
|
||||
#define ZMQ_PROTOCOL_ERROR_ZAP_BAD_VERSION 0x20000003
|
||||
#define ZMQ_PROTOCOL_ERROR_ZAP_INVALID_STATUS_CODE 0x20000004
|
||||
#define ZMQ_PROTOCOL_ERROR_ZAP_INVALID_METADATA 0x20000005
|
||||
#define ZMQ_PROTOCOL_ERROR_WS_UNSPECIFIED 0x30000000
|
||||
|
||||
ZMQ_EXPORT void *zmq_socket (void *, int type_);
|
||||
ZMQ_EXPORT int zmq_close (void *s_);
|
||||
ZMQ_EXPORT int
|
||||
zmq_setsockopt (void *s_, int option_, const void *optval_, size_t optvallen_);
|
||||
ZMQ_EXPORT int
|
||||
zmq_getsockopt (void *s_, int option_, void *optval_, size_t *optvallen_);
|
||||
ZMQ_EXPORT int zmq_bind (void *s_, const char *addr_);
|
||||
ZMQ_EXPORT int zmq_connect (void *s_, const char *addr_);
|
||||
ZMQ_EXPORT int zmq_unbind (void *s_, const char *addr_);
|
||||
ZMQ_EXPORT int zmq_disconnect (void *s_, const char *addr_);
|
||||
ZMQ_EXPORT int zmq_send (void *s_, const void *buf_, size_t len_, int flags_);
|
||||
ZMQ_EXPORT int
|
||||
zmq_send_const (void *s_, const void *buf_, size_t len_, int flags_);
|
||||
ZMQ_EXPORT int zmq_recv (void *s_, void *buf_, size_t len_, int flags_);
|
||||
ZMQ_EXPORT int zmq_socket_monitor (void *s_, const char *addr_, int events_);
|
||||
|
||||
/******************************************************************************/
|
||||
/* Hide socket fd type; this was before zmq_poller_event_t typedef below */
|
||||
/******************************************************************************/
|
||||
|
||||
#if defined _WIN32
|
||||
// Windows uses a pointer-sized unsigned integer to store the socket fd.
|
||||
#if defined _WIN64
|
||||
typedef unsigned __int64 zmq_fd_t;
|
||||
#else
|
||||
typedef unsigned int zmq_fd_t;
|
||||
#endif
|
||||
#else
|
||||
typedef int zmq_fd_t;
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
/* Deprecated I/O multiplexing. Prefer using zmq_poller API */
|
||||
/******************************************************************************/
|
||||
|
||||
#define ZMQ_POLLIN 1
|
||||
#define ZMQ_POLLOUT 2
|
||||
#define ZMQ_POLLERR 4
|
||||
#define ZMQ_POLLPRI 8
|
||||
|
||||
typedef struct zmq_pollitem_t
|
||||
{
|
||||
void *socket;
|
||||
zmq_fd_t fd;
|
||||
short events;
|
||||
short revents;
|
||||
} zmq_pollitem_t;
|
||||
|
||||
#define ZMQ_POLLITEMS_DFLT 16
|
||||
|
||||
ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_);
|
||||
|
||||
/******************************************************************************/
|
||||
/* Message proxying */
|
||||
/******************************************************************************/
|
||||
|
||||
ZMQ_EXPORT int zmq_proxy (void *frontend_, void *backend_, void *capture_);
|
||||
ZMQ_EXPORT int zmq_proxy_steerable (void *frontend_,
|
||||
void *backend_,
|
||||
void *capture_,
|
||||
void *control_);
|
||||
|
||||
/******************************************************************************/
|
||||
/* Probe library capabilities */
|
||||
/******************************************************************************/
|
||||
|
||||
#define ZMQ_HAS_CAPABILITIES 1
|
||||
ZMQ_EXPORT int zmq_has (const char *capability_);
|
||||
|
||||
/* Deprecated aliases */
|
||||
#define ZMQ_STREAMER 1
|
||||
#define ZMQ_FORWARDER 2
|
||||
#define ZMQ_QUEUE 3
|
||||
|
||||
/* Deprecated methods */
|
||||
ZMQ_EXPORT int zmq_device (int type_, void *frontend_, void *backend_);
|
||||
ZMQ_EXPORT int zmq_sendmsg (void *s_, zmq_msg_t *msg_, int flags_);
|
||||
ZMQ_EXPORT int zmq_recvmsg (void *s_, zmq_msg_t *msg_, int flags_);
|
||||
struct iovec;
|
||||
ZMQ_EXPORT int
|
||||
zmq_sendiov (void *s_, struct iovec *iov_, size_t count_, int flags_);
|
||||
ZMQ_EXPORT int
|
||||
zmq_recviov (void *s_, struct iovec *iov_, size_t *count_, int flags_);
|
||||
|
||||
/******************************************************************************/
|
||||
/* Encryption functions */
|
||||
/******************************************************************************/
|
||||
|
||||
/* Encode data with Z85 encoding. Returns encoded data */
|
||||
ZMQ_EXPORT char *
|
||||
zmq_z85_encode (char *dest_, const uint8_t *data_, size_t size_);
|
||||
|
||||
/* Decode data with Z85 encoding. Returns decoded data */
|
||||
ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest_, const char *string_);
|
||||
|
||||
/* Generate z85-encoded public and private keypair with libsodium. */
|
||||
/* Returns 0 on success. */
|
||||
ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key_, char *z85_secret_key_);
|
||||
|
||||
/* Derive the z85-encoded public key from the z85-encoded secret key. */
|
||||
/* Returns 0 on success. */
|
||||
ZMQ_EXPORT int zmq_curve_public (char *z85_public_key_,
|
||||
const char *z85_secret_key_);
|
||||
|
||||
/******************************************************************************/
|
||||
/* Atomic utility methods */
|
||||
/******************************************************************************/
|
||||
|
||||
ZMQ_EXPORT void *zmq_atomic_counter_new (void);
|
||||
ZMQ_EXPORT void zmq_atomic_counter_set (void *counter_, int value_);
|
||||
ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter_);
|
||||
ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter_);
|
||||
ZMQ_EXPORT int zmq_atomic_counter_value (void *counter_);
|
||||
ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p_);
|
||||
|
||||
/******************************************************************************/
|
||||
/* Scheduling timers */
|
||||
/******************************************************************************/
|
||||
|
||||
#define ZMQ_HAVE_TIMERS
|
||||
|
||||
typedef void (zmq_timer_fn) (int timer_id, void *arg);
|
||||
|
||||
ZMQ_EXPORT void *zmq_timers_new (void);
|
||||
ZMQ_EXPORT int zmq_timers_destroy (void **timers_p);
|
||||
ZMQ_EXPORT int
|
||||
zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg);
|
||||
ZMQ_EXPORT int zmq_timers_cancel (void *timers, int timer_id);
|
||||
ZMQ_EXPORT int
|
||||
zmq_timers_set_interval (void *timers, int timer_id, size_t interval);
|
||||
ZMQ_EXPORT int zmq_timers_reset (void *timers, int timer_id);
|
||||
ZMQ_EXPORT long zmq_timers_timeout (void *timers);
|
||||
ZMQ_EXPORT int zmq_timers_execute (void *timers);
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* These functions are not documented by man pages -- use at your own risk. */
|
||||
/* If you need these to be part of the formal ZMQ API, then (a) write a man */
|
||||
/* page, and (b) write a test case in tests. */
|
||||
/******************************************************************************/
|
||||
|
||||
/* Helper functions are used by perf tests so that they don't have to care */
|
||||
/* about minutiae of time-related functions on different OS platforms. */
|
||||
|
||||
/* Starts the stopwatch. Returns the handle to the watch. */
|
||||
ZMQ_EXPORT void *zmq_stopwatch_start (void);
|
||||
|
||||
/* Returns the number of microseconds elapsed since the stopwatch was */
|
||||
/* started, but does not stop or deallocate the stopwatch. */
|
||||
ZMQ_EXPORT unsigned long zmq_stopwatch_intermediate (void *watch_);
|
||||
|
||||
/* Stops the stopwatch. Returns the number of microseconds elapsed since */
|
||||
/* the stopwatch was started, and deallocates that watch. */
|
||||
ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_);
|
||||
|
||||
/* Sleeps for specified number of seconds. */
|
||||
ZMQ_EXPORT void zmq_sleep (int seconds_);
|
||||
|
||||
typedef void (zmq_thread_fn) (void *);
|
||||
|
||||
/* Start a thread. Returns a handle to the thread. */
|
||||
ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn *func_, void *arg_);
|
||||
|
||||
/* Wait for thread to complete then free up resources. */
|
||||
ZMQ_EXPORT void zmq_threadclose (void *thread_);
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* These functions are DRAFT and disabled in stable releases, and subject to */
|
||||
/* change at ANY time until declared stable. */
|
||||
/******************************************************************************/
|
||||
|
||||
#ifdef ZMQ_BUILD_DRAFT_API
|
||||
|
||||
/* DRAFT Socket types. */
|
||||
#define ZMQ_SERVER 12
|
||||
#define ZMQ_CLIENT 13
|
||||
#define ZMQ_RADIO 14
|
||||
#define ZMQ_DISH 15
|
||||
#define ZMQ_GATHER 16
|
||||
#define ZMQ_SCATTER 17
|
||||
#define ZMQ_DGRAM 18
|
||||
#define ZMQ_PEER 19
|
||||
#define ZMQ_CHANNEL 20
|
||||
|
||||
/* DRAFT Socket options. */
|
||||
#define ZMQ_ZAP_ENFORCE_DOMAIN 93
|
||||
#define ZMQ_LOOPBACK_FASTPATH 94
|
||||
#define ZMQ_METADATA 95
|
||||
#define ZMQ_MULTICAST_LOOP 96
|
||||
#define ZMQ_ROUTER_NOTIFY 97
|
||||
#define ZMQ_XPUB_MANUAL_LAST_VALUE 98
|
||||
#define ZMQ_SOCKS_USERNAME 99
|
||||
#define ZMQ_SOCKS_PASSWORD 100
|
||||
#define ZMQ_IN_BATCH_SIZE 101
|
||||
#define ZMQ_OUT_BATCH_SIZE 102
|
||||
#define ZMQ_WSS_KEY_PEM 103
|
||||
#define ZMQ_WSS_CERT_PEM 104
|
||||
#define ZMQ_WSS_TRUST_PEM 105
|
||||
#define ZMQ_WSS_HOSTNAME 106
|
||||
#define ZMQ_WSS_TRUST_SYSTEM 107
|
||||
#define ZMQ_ONLY_FIRST_SUBSCRIBE 108
|
||||
#define ZMQ_RECONNECT_STOP 109
|
||||
#define ZMQ_HELLO_MSG 110
|
||||
#define ZMQ_DISCONNECT_MSG 111
|
||||
#define ZMQ_PRIORITY 112
|
||||
#define ZMQ_BUSY_POLL 113
|
||||
#define ZMQ_HICCUP_MSG 114
|
||||
#define ZMQ_XSUB_VERBOSE_UNSUBSCRIBE 115
|
||||
#define ZMQ_TOPICS_COUNT 116
|
||||
#define ZMQ_NORM_MODE 117
|
||||
#define ZMQ_NORM_UNICAST_NACK 118
|
||||
#define ZMQ_NORM_BUFFER_SIZE 119
|
||||
#define ZMQ_NORM_SEGMENT_SIZE 120
|
||||
#define ZMQ_NORM_BLOCK_SIZE 121
|
||||
#define ZMQ_NORM_NUM_PARITY 122
|
||||
#define ZMQ_NORM_NUM_AUTOPARITY 123
|
||||
#define ZMQ_NORM_PUSH 124
|
||||
|
||||
/* DRAFT ZMQ_NORM_MODE options */
|
||||
#define ZMQ_NORM_FIXED 0
|
||||
#define ZMQ_NORM_CC 1
|
||||
#define ZMQ_NORM_CCL 2
|
||||
#define ZMQ_NORM_CCE 3
|
||||
#define ZMQ_NORM_CCE_ECNONLY 4
|
||||
|
||||
/* DRAFT ZMQ_RECONNECT_STOP options */
|
||||
#define ZMQ_RECONNECT_STOP_CONN_REFUSED 0x1
|
||||
#define ZMQ_RECONNECT_STOP_HANDSHAKE_FAILED 0x2
|
||||
#define ZMQ_RECONNECT_STOP_AFTER_DISCONNECT 0x4
|
||||
|
||||
/* DRAFT Context options */
|
||||
#define ZMQ_ZERO_COPY_RECV 10
|
||||
|
||||
/* DRAFT Context methods. */
|
||||
ZMQ_EXPORT int zmq_ctx_set_ext (void *context_,
|
||||
int option_,
|
||||
const void *optval_,
|
||||
size_t optvallen_);
|
||||
ZMQ_EXPORT int zmq_ctx_get_ext (void *context_,
|
||||
int option_,
|
||||
void *optval_,
|
||||
size_t *optvallen_);
|
||||
|
||||
/* DRAFT Socket methods. */
|
||||
ZMQ_EXPORT int zmq_join (void *s, const char *group);
|
||||
ZMQ_EXPORT int zmq_leave (void *s, const char *group);
|
||||
ZMQ_EXPORT uint32_t zmq_connect_peer (void *s_, const char *addr_);
|
||||
|
||||
/* DRAFT Msg methods. */
|
||||
ZMQ_EXPORT int zmq_msg_set_routing_id (zmq_msg_t *msg, uint32_t routing_id);
|
||||
ZMQ_EXPORT uint32_t zmq_msg_routing_id (zmq_msg_t *msg);
|
||||
ZMQ_EXPORT int zmq_msg_set_group (zmq_msg_t *msg, const char *group);
|
||||
ZMQ_EXPORT const char *zmq_msg_group (zmq_msg_t *msg);
|
||||
ZMQ_EXPORT int
|
||||
zmq_msg_init_buffer (zmq_msg_t *msg_, const void *buf_, size_t size_);
|
||||
|
||||
/* DRAFT Msg property names. */
|
||||
#define ZMQ_MSG_PROPERTY_ROUTING_ID "Routing-Id"
|
||||
#define ZMQ_MSG_PROPERTY_SOCKET_TYPE "Socket-Type"
|
||||
#define ZMQ_MSG_PROPERTY_USER_ID "User-Id"
|
||||
#define ZMQ_MSG_PROPERTY_PEER_ADDRESS "Peer-Address"
|
||||
|
||||
/* Router notify options */
|
||||
#define ZMQ_NOTIFY_CONNECT 1
|
||||
#define ZMQ_NOTIFY_DISCONNECT 2
|
||||
|
||||
/******************************************************************************/
|
||||
/* Poller polling on sockets,fd and thread-safe sockets */
|
||||
/******************************************************************************/
|
||||
|
||||
#define ZMQ_HAVE_POLLER
|
||||
|
||||
typedef struct zmq_poller_event_t
|
||||
{
|
||||
void *socket;
|
||||
zmq_fd_t fd;
|
||||
void *user_data;
|
||||
short events;
|
||||
} zmq_poller_event_t;
|
||||
|
||||
ZMQ_EXPORT void *zmq_poller_new (void);
|
||||
ZMQ_EXPORT int zmq_poller_destroy (void **poller_p);
|
||||
ZMQ_EXPORT int zmq_poller_size (void *poller);
|
||||
ZMQ_EXPORT int
|
||||
zmq_poller_add (void *poller, void *socket, void *user_data, short events);
|
||||
ZMQ_EXPORT int zmq_poller_modify (void *poller, void *socket, short events);
|
||||
ZMQ_EXPORT int zmq_poller_remove (void *poller, void *socket);
|
||||
ZMQ_EXPORT int
|
||||
zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout);
|
||||
ZMQ_EXPORT int zmq_poller_wait_all (void *poller,
|
||||
zmq_poller_event_t *events,
|
||||
int n_events,
|
||||
long timeout);
|
||||
ZMQ_EXPORT int zmq_poller_fd (void *poller, zmq_fd_t *fd);
|
||||
|
||||
ZMQ_EXPORT int
|
||||
zmq_poller_add_fd (void *poller, zmq_fd_t fd, void *user_data, short events);
|
||||
ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, zmq_fd_t fd, short events);
|
||||
ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, zmq_fd_t fd);
|
||||
|
||||
ZMQ_EXPORT int zmq_socket_get_peer_state (void *socket,
|
||||
const void *routing_id,
|
||||
size_t routing_id_size);
|
||||
|
||||
/* DRAFT Socket monitoring events */
|
||||
#define ZMQ_EVENT_PIPES_STATS 0x10000
|
||||
|
||||
#define ZMQ_CURRENT_EVENT_VERSION 1
|
||||
#define ZMQ_CURRENT_EVENT_VERSION_DRAFT 2
|
||||
|
||||
#define ZMQ_EVENT_ALL_V1 ZMQ_EVENT_ALL
|
||||
#define ZMQ_EVENT_ALL_V2 ZMQ_EVENT_ALL_V1 | ZMQ_EVENT_PIPES_STATS
|
||||
|
||||
ZMQ_EXPORT int zmq_socket_monitor_versioned (
|
||||
void *s_, const char *addr_, uint64_t events_, int event_version_, int type_);
|
||||
ZMQ_EXPORT int zmq_socket_monitor_pipes_stats (void *s);
|
||||
|
||||
#if !defined _WIN32
|
||||
ZMQ_EXPORT int zmq_ppoll (zmq_pollitem_t *items_,
|
||||
int nitems_,
|
||||
long timeout_,
|
||||
const sigset_t *sigmask_);
|
||||
#else
|
||||
// Windows has no sigset_t
|
||||
ZMQ_EXPORT int zmq_ppoll (zmq_pollitem_t *items_,
|
||||
int nitems_,
|
||||
long timeout_,
|
||||
const void *sigmask_);
|
||||
#endif
|
||||
|
||||
#endif // ZMQ_BUILD_DRAFT_API
|
||||
|
||||
|
||||
#undef ZMQ_EXPORT
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
23
utils/ZMQLayout/include/zmq_utils.h
Normal file
23
utils/ZMQLayout/include/zmq_utils.h
Normal file
@ -0,0 +1,23 @@
|
||||
/* SPDX-License-Identifier: MPL-2.0 */
|
||||
|
||||
/* This file is deprecated, and all its functionality provided by zmq.h */
|
||||
/* Note that -Wpedantic compilation requires GCC to avoid using its custom
|
||||
extensions such as #warning, hence the trick below. Also, pragmas for
|
||||
warnings or other messages are not standard, not portable, and not all
|
||||
compilers even have an equivalent concept.
|
||||
So in the worst case, this include file is treated as silently empty. */
|
||||
|
||||
#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) \
|
||||
|| defined(_MSC_VER)
|
||||
#if defined(__GNUC__) || defined(__GNUG__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic warning "-Wcpp"
|
||||
#pragma GCC diagnostic ignored "-Werror"
|
||||
#pragma GCC diagnostic ignored "-Wall"
|
||||
#endif
|
||||
#pragma message( \
|
||||
"Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h.")
|
||||
#if defined(__GNUC__) || defined(__GNUG__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif
|
BIN
utils/ZMQLayout/lib/libVSClock.so
Executable file
BIN
utils/ZMQLayout/lib/libVSClock.so
Executable file
Binary file not shown.
162
utils/ZMQLayout/src/ZMQLayout.c
Normal file
162
utils/ZMQLayout/src/ZMQLayout.c
Normal file
@ -0,0 +1,162 @@
|
||||
#include "ZMQLayout.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <VSClock.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
static void *ZMQCTX = NULL;
|
||||
static int ZMQSocketNum = 0;
|
||||
|
||||
void ZMQBufDestroy(pZMQBuf_s psZMQBuf)
|
||||
{
|
||||
if(!psZMQBuf) return ;
|
||||
|
||||
if(psZMQBuf->pcBuf) free(psZMQBuf->pcBuf);
|
||||
free(psZMQBuf);
|
||||
return ;
|
||||
}
|
||||
|
||||
pZMQBuf_s ZMQRecv(void *phZMQSocket, int iWaitTime)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
pZMQBuf_s psZMQBuf = NULL;
|
||||
|
||||
zmq_msg_t tZMQMSG;
|
||||
rv = zmq_msg_init(&tZMQMSG);
|
||||
if(rv) { return NULL; }
|
||||
do
|
||||
{
|
||||
|
||||
if(iWaitTime == -1)
|
||||
{
|
||||
rv = zmq_msg_recv(&tZMQMSG, phZMQSocket, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
VSClock_s sVSClock = { 0 };
|
||||
VSClock(&sVSClock, iWaitTime, 0);
|
||||
while(!VSClockTimeOut(&sVSClock))
|
||||
{
|
||||
rv = zmq_msg_recv(&tZMQMSG, phZMQSocket, ZMQ_DONTWAIT);
|
||||
if(rv < 0) { /* printf("ERROR\n"); */ sleep(0); continue; }
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(rv < 0) break;
|
||||
|
||||
psZMQBuf = calloc(1, sizeof(ZMQBuf_s));
|
||||
psZMQBuf->iBufLen = zmq_msg_size(&tZMQMSG);
|
||||
psZMQBuf->pcBuf = calloc(psZMQBuf->iBufLen + 1, sizeof(char));
|
||||
memcpy(psZMQBuf->pcBuf, zmq_msg_data(&tZMQMSG), psZMQBuf->iBufLen);
|
||||
|
||||
}while(0);
|
||||
zmq_msg_close(&tZMQMSG);
|
||||
|
||||
return psZMQBuf;
|
||||
}
|
||||
|
||||
int ZMQSend(void *phZMQSocket, const char *pcBuf, const int iBufLen)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
zmq_msg_t tZMQMSG;
|
||||
rv = zmq_msg_init_size(&tZMQMSG, iBufLen);
|
||||
if(rv) { return -1; }
|
||||
do
|
||||
{
|
||||
memcpy(zmq_msg_data(&tZMQMSG), pcBuf, iBufLen);
|
||||
// rv = zmq_sendmsg(phZMQSocket, &tZMQMSG, 0);
|
||||
rv = zmq_msg_send(&tZMQMSG, phZMQSocket, ZMQ_DONTWAIT);
|
||||
if(rv < 0) { /* printf("zmq_sendmsg errno = %d\n", errno); */ rv = -1; break; }
|
||||
|
||||
rv = 0;
|
||||
}while(0);
|
||||
zmq_msg_close(&tZMQMSG);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
pZMQ_s ZMQServerInit(const char *pcAddress)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
if(!ZMQCTX) ZMQCTX = zmq_ctx_new();
|
||||
if(!ZMQCTX) return NULL;
|
||||
|
||||
pZMQ_s psZMQSocket = NULL;
|
||||
|
||||
do
|
||||
{
|
||||
void *phZMQSocket = zmq_socket(ZMQCTX, ZMQ_REP);
|
||||
if(!phZMQSocket) { /* printf("zmq_socket fail\n"); */ break; }
|
||||
|
||||
rv = zmq_bind(phZMQSocket, pcAddress);
|
||||
if(rv != 0)
|
||||
{
|
||||
zmq_close(phZMQSocket);
|
||||
/* printf("zmq_bind rv = %d errno = %d fail\n", rv, errno); */
|
||||
break;
|
||||
}
|
||||
|
||||
psZMQSocket = phZMQSocket;
|
||||
|
||||
ZMQSocketNum++;
|
||||
|
||||
}while(0);
|
||||
|
||||
return psZMQSocket;
|
||||
}
|
||||
|
||||
pZMQ_s ZMQClientInit(const char *pcAddress)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
if(!ZMQCTX) ZMQCTX = zmq_ctx_new();
|
||||
if(!ZMQCTX) return NULL;
|
||||
|
||||
pZMQ_s psZMQSocket = NULL;
|
||||
|
||||
do
|
||||
{
|
||||
void *phZMQSocket = zmq_socket(ZMQCTX, ZMQ_REQ);
|
||||
if(!phZMQSocket) { /* printf("zmq_socket fail\n"); */ break; }
|
||||
|
||||
rv = zmq_connect(phZMQSocket, pcAddress);
|
||||
if(rv != 0)
|
||||
{
|
||||
zmq_close(phZMQSocket);
|
||||
// printf("zmq_bind rv = %d errno = %d fail\n", rv, errno);
|
||||
break;
|
||||
}
|
||||
|
||||
psZMQSocket = phZMQSocket;
|
||||
|
||||
ZMQSocketNum++;
|
||||
|
||||
}while(0);
|
||||
|
||||
return psZMQSocket;
|
||||
}
|
||||
|
||||
void ZMQDestroy(pZMQ_s psZMQ)
|
||||
{
|
||||
if(!psZMQ) return ;
|
||||
|
||||
zmq_close(psZMQ);
|
||||
|
||||
ZMQSocketNum--;
|
||||
if(ZMQSocketNum <= 0) {
|
||||
zmq_ctx_destroy(ZMQCTX);
|
||||
ZMQSocketNum = 0;
|
||||
ZMQCTX = NULL;
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user