Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
master
This gist exceeds the recommended number of files (~10). To access all files, please clone this gist.
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/linux_star.iml" filepath="$PROJECT_DIR$/.idea/linux_star.iml" />
</modules>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true">
<generated>
<config projectName="linux_star" targetName="Pro_src" />
</generated>
</component>
<component name="CMakeSettings">
<configurations>
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ChangeListManager">
<list default="true" id="be81aa7c-db46-4eb7-b6eb-e5111320ef19" name="Default Changelist" comment="" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ClangdSettings">
<option name="formatViaClangd" value="false" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
<component name="ProjectId" id="1QrWijMMbCU0F3ZTSpjfgeSdOGU" />
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="linux_star" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="linux_star" RUN_TARGET_NAME="linux_star" EXPLICIT_BUILD_TARGET_NAME="all">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="be81aa7c-db46-4eb7-b6eb-e5111320ef19" name="Default Changelist" comment="" />
<created>1568529324873</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1568529324873</updated>
<workItem from="1568529326461" duration="106000" />
<workItem from="1568529460286" duration="878000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
</project>
#!/bin/sh
word_bit=`getconf WORD_BIT`
long_bit=`getconf LONG_BIT`
#echo " "$word_bit" "$long_bit" "
if [ $1 = "unstall" ];then
echo "unstall"
if [ ! -d "/usr/local/sslvpn/" ];then
echo "dir not delete "
else
echo "dir has delete"
fi
elif [ $1 = "install" ];then
echo "install"
if [ ! -d "/usr/local/sslvpn/" ];then
echo "dir not exit "
else
echo "dir has exit"
fi
else
echo "unknow commd"
fi
if [ "$word_bit" -eq 32 ] && [ "$long_bit" -eq 64 ];
then
echo "x86_64_bit system"
else
echo "x86_i686 bit system"
fi
#***************************************************************************
#
# Copyright (c) 2017 by colin hans.
#
# Name : libclp-test
#
# Purpose :
#
# Additional :
#
#--------------------------------------------------------------------------
#
# Maintenance History:
#
# 2005-09-08-002: colin hans - 增加了对静态库编译的支持static=on;
# 增加了make选项release=on和debug=on分别对应Release和Debug版本的编译;
# 2005-09-08-001: colin hans - 创建
#
#**************************************************************************/
# 目标程序名称
TARGET := Pro_src
# 需要链接的库路径,以空格隔开
LIB_PATHS := ../lib/thirdPartLib
# 需要连接的库名,以空格隔开LIBS :=
LIBS := ssl crypto m rt pthread dl event curl
# 包含头文件所在目录INCLUDES :=
# 头文件所在目录INCLUDE_PATH := ../include/
INCLUDE_PATH := ../inc ../inc/json ../inc/common ../inc/gmssl ../inc/linux_net ../inc/openssl ../inc/datastruct
# 源码所在根目录SRC_PATH := ../src/
SRC_PATH := ../src/
$(warning, $(SRC_PATH) )
$(warning, $(INCLUDE_PATH) )
# 中间文件目录
OBJ_PATH := ../obj
# 输出文件目录
OUT_DIR := ../bin/
CC := gcc
CFLAGS := -g -static -m64 -fPIC -Wall -O2 -MMD -DLINUX_PRG
LDFLAGS :=
CXXFLAGS = $(CFLAGS)
static=off
release=on
debug=off
BASE_TARGET := $(TARGET)
BASE_OBJ_PATH := $(OBJ_PATH)
#默认release 模式编译
ifneq ($(release), on)
ifneq ($(debug), on)
release=on
endif
endif
ifeq ($(release), on)
DEFINES += NDEBUG
OBJ_PATH := $(OBJ_PATH)/release/
ifeq ($(wildcard $(OBJ_PATH)),)
$(shell mkdir $(OBJ_PATH))
endif
else
ifeq ($(debug), on)
DEFINES += DEBUG
CFLAGS += -g
OBJ_PATH := $(OBJ_PATH)/debug/
TARGET := $(TARGET)D
ifeq ($(wildcard $(OBJ_PATH)),)
$(shell mkdir $(OBJ_PATH))
endif
endif
endif
ifeq ($(static), on)
TARGET := $(TARGET).a
endif
RM-F := rm -f -r
SOURCE := $(shell find $(SRC_PATH) -name *.c)
OBJS := $(patsubst %.c,$(OBJ_PATH)%.o,$(notdir $(SOURCE)))
DEPS := $(patsubst %.o,%.d,$(OBJS))
MISSING_DEPS := $(filter-out $(wildcard $(DEPS)),$(DEPS))
MISSING_DEPS_SOURCES := $(wildcard $(patsubst %.d,%.c,$(MISSING_DEPS)))
.PHONY : default clean rebuild
default : $(OUT_DIR)$(TARGET)
deps : $(DEPS)
objs : $(OBJS)
clean :
#$(RM-F) $(OBJ_PATH)/*.d
#$(RM-F) $(OBJ_PATH)/*.o
$(RM-F) $(BASE_OBJ_PATH)/release
$(RM-F) $(BASE_OBJ_PATH)/debug
$(RM-F) $(OUT_DIR)/$(TARGET)
#$(RM-F) $(OUT_DIR)/$(BASE_TARGET)%.a
rebuild: clean all
ifneq ($(MISSING_DEPS),)
$(MISSING_DEPS) :
$(RM-F) $(patsubst %.d,%.o,$@)
endif
-include $(DEPS)
$(OBJ_PATH)%.o:
$(CC) $(addprefix -D, $(DEFINES)) $(addprefix -I,$(INCLUDES) $(INCLUDE_PATH)) -c $(CXXFLAGS) -o $@ $(filter $(subst .o,.c,%/$(notdir $@) ),$(SOURCE))
$(OUT_DIR)$(TARGET) : $(OBJS)
ifneq ($(static), on)
$(CC) $(LDFLAGS) -o $(OUT_DIR)$(TARGET) $(OBJS) $(addprefix -L,$(LIB_PATHS)) $(addprefix -l,$(LIBS))
else
ar rvs $(OUT_DIR)$(TARGET) $(OBJS)
endif
#!/bin/bash
num=`uname -r`
echo "$num"
while [[ 1 ]]
do
pid=$(pgrep $1)
cmd="cat /proc/"$pid"/status"
$cmd
$num
sleep 1
done
#!/bin/bash
KVER=`uname -r`
mkdir -p /lib/modules/"$KVER"/kernel/drivers/riffa
cp riffa.ko /lib/modules/"$KVER"/kernel/drivers/riffa/
if [ -f "/etc/redhat-release" ]; then\
printf "%b\n" "#!/bin/sh\nexec /sbin/modprobe riffa >/dev/null 2>&1" > /etc/sysconfig/modules/riffa.modules;\
chmod 755 /etc/sysconfig/modules/riffa.modules;\
else\
if ! grep -Fxq "riffa" /etc/modules; then echo "riffa" >> /etc/modules; fi;\
fi
printf "%b\n" "KERNEL==\"riffa\", MODE=\"777\", GROUP=\"root\"" > /etc/udev/rules.d/99-riffa.rules
printf "/usr/local/lib\n" > riffa.conf
mv riffa.conf /etc/ld.so.conf.d/
cp riffa_driver.h /usr/local/include/
cp riffa.h /usr/local/include/
mv libriffa.so.1.0 /usr/local/lib
ln -sf /usr/local/lib/libriffa.so.1.0 /usr/local/lib/libriffa.so.1
ln -sf /usr/local/lib/libriffa.so.1.0 /usr/local/lib/libriffa.so
ldconfig
depmod
#!/bin/bash
PWDPATH=`pwd`
SRC_PATH=../src/thirdPart/
INC_PATH=../inc/thirdPart/
TYPE=.tar.gz
CURL_VERSION=curl-7.51.0
echo "###### build third part lib ######"
function build_curl()
{
SRC_FILE=$CURL_VERSION$TYPE
tar -xzvf $SRC_PATH$SRC_FILE
cd $SRC_PATH$CURL_VERSION
./confiure -prefix=$PWDPATH$INC_PATH
make && make install
cd $PWDPATH
echo "Build curl OK"
}
echo "###### build curl start ######"
build_curl
echo "###### build curl end ######"
cmake_minimum_required(VERSION 3.10.2)
project(linux_star C)
#add src file name to value DIRSRCS 实现文件目录需要逐个添加
AUX_SOURCE_DIRECTORY(./src DIRSRCS)
AUX_SOURCE_DIRECTORY(./src/json DIRSRCS)
AUX_SOURCE_DIRECTORY(./src/common DIRSRCS)
AUX_SOURCE_DIRECTORY(./src/websocket_linux DIRSRCS)
AUX_SOURCE_DIRECTORY(./src/gmssl DIRSRCS)
AUX_SOURCE_DIRECTORY(./src/linux_net DIRSRCS)
AUX_SOURCE_DIRECTORY(./src/datastruct DIRSRCS)
#添加头文件目录
INCLUDE_DIRECTORIES( ${catkin_INCLUDE_DIRS} ./inc ./inc/linux_net ./inc/json )
INCLUDE_DIRECTORIES( ${catkin_INCLUDE_DIRS} ./inc ./inc/datastruct ./inc/common ./inc/gmssl)
#添加库目录
LINK_DIRECTORIES(${catkin_LIB_DIRS} ./lib/thirdPartLib )
#添加系统库目录
FIND_LIBRARY(RUNTIME_LIB rt /usr/lib /usr/local/lib NO_DEFAULT_PATH)
set(CMAKE_C_STANDARD 99)
#
set(GNU_FLAGS "-m64 -static -fPIC -Wall -O2 -MMD -DLINUX_PRG")
set(CMAKE_C_FLAGS "${GNU_FLAGS}")
ADD_EXECUTABLE(linux_star ${DIRSRCS} src/gmssl/gmssl_mast_secruty.c)
set(EXECUTABLE_OUTPUT_PATH ../bin/)
TARGET_LINK_LIBRARIES(
linux_star ${catkin_LIBRARIES} curl ssl crypto m dl rt pthread event
)
{
"net_item": {
"reportIP": "127.0.0.1",
"port": 8080,
"local": 6523,
"localSSL": 6522,
"port": 6638
},
"log_item": {
"log_level": 7,
"log_size": 10
}
}
-----BEGIN CERTIFICATE-----
MIICBDCCAaqgAwIBAgIJAPuNNgWsUsI9MAoGCCqBHM9VAYN1MHgxDjAMBgNVBAMM
BWVjY2NhMQswCQYDVQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNVBAcMAlNIMRIw
EAYDVQQKDAlLb2FsIFNvZnQxDDAKBgNVBAsMA1NTTDEdMBsGCSqGSIb3DQEJARYO
ZWNjY2FAa29hbC5jb20wHhcNMTcwMTA4MjIyMDE1WhcNMjcwMTA2MjIyMDE1WjB4
MQ4wDAYDVQQDDAVlY2NjYTELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAlNIMQswCQYD
VQQHDAJTSDESMBAGA1UECgwJS29hbCBTb2Z0MQwwCgYDVQQLDANTU0wxHTAbBgkq
hkiG9w0BCQEWDmVjY2NhQGtvYWwuY29tMFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0D
QgAE7Xayxv9pyv/AeUiSvVC6odH0rupRbSGdygq7yJrgoNrVi2GJfBQSWVrp+sjJ
h0odn84e//BxRvZcWCMxqEZE0qMdMBswDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMC
AuQwCgYIKoEcz1UBg3UDSAAwRQIgAVIn9NfHzfdq/oLvSaZZYIX+/Rv0ePD8S2zh
lnDxFkoCIQDZ9GBYpPH1GJYdSrLdCgZc88IuCg+XaNIW30QwSdwwxg==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICBDCCAaqgAwIBAgIJAPuNNgWsUsI9MAoGCCqBHM9VAYN1MHgxDjAMBgNVBAMM
BWVjY2NhMQswCQYDVQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNVBAcMAlNIMRIw
EAYDVQQKDAlLb2FsIFNvZnQxDDAKBgNVBAsMA1NTTDEdMBsGCSqGSIb3DQEJARYO
ZWNjY2FAa29hbC5jb20wHhcNMTcwMTA4MjIyMDE1WhcNMjcwMTA2MjIyMDE1WjB4
MQ4wDAYDVQQDDAVlY2NjYTELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAlNIMQswCQYD
VQQHDAJTSDESMBAGA1UECgwJS29hbCBTb2Z0MQwwCgYDVQQLDANTU0wxHTAbBgkq
hkiG9w0BCQEWDmVjY2NhQGtvYWwuY29tMFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0D
QgAE7Xayxv9pyv/AeUiSvVC6odH0rupRbSGdygq7yJrgoNrVi2GJfBQSWVrp+sjJ
h0odn84e//BxRvZcWCMxqEZE0qMdMBswDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMC
AuQwCgYIKoEcz1UBg3UDSAAwRQIgAVIn9NfHzfdq/oLvSaZZYIX+/Rv0ePD8S2zh
lnDxFkoCIQDZ9GBYpPH1GJYdSrLdCgZc88IuCg+XaNIW30QwSdwwxg==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICDDCCAbKgAwIBAgIJAJeHv6sBofdbMAoGCCqBHM9VAYN1MHgxDjAMBgNVBAMM
BWVjY2NhMQswCQYDVQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNVBAcMAlNIMRIw
EAYDVQQKDAlLb2FsIFNvZnQxDDAKBgNVBAsMA1NTTDEdMBsGCSqGSIb3DQEJARYO
ZWNjY2FAa29hbC5jb20wHhcNMTcwMTA4MjIyNDU4WhcNMjcwMTA2MjIyNDU4WjCB
gjETMBEGA1UEAwwKZWNjZW5jc2l0ZTELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAlNI
MQswCQYDVQQHDAJTSDESMBAGA1UECgwJS29hbCBTb2Z0MQwwCgYDVQQLDANTU0wx
IjAgBgkqhkiG9w0BCQEWE2VjY2VuY3NpdGVAa29hbC5jb20wWTATBgcqhkjOPQIB
BggqgRzPVQGCLQNCAATdil2meAmPFIAmxbKIdhffwduSaU0S8FHHV+oejHnN+JbG
oRq+jAdFBuObkvvXCnAdHk5aTEHHa1/YFcd7bHrYoxowGDAJBgNVHRMEAjAAMAsG
A1UdDwQEAwIEcDAKBggqgRzPVQGDdQNIADBFAiAXG+dPcucaaLuIz+tmyh2AUjVW
nEA428LEQRHV8Zz1iwIhAMWX4CQ79eI+DhZ3/eLl7mrOF3I/mosBsIWWXGS2bMaJ
-----END CERTIFICATE-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIC08TqHoULuqfTMSj8vdii7yV47mcIt5FEvPf9TSTWEzoAoGCCqBHM9V
AYItoUQDQgAE3YpdpngJjxSAJsWyiHYX38HbkmlNEvBRx1fqHox5zfiWxqEavowH
RQbjm5L71wpwHR5OWkxBx2tf2BXHe2x62A==
-----END EC PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIICDDCCAbKgAwIBAgIJAJeHv6sBofdZMAoGCCqBHM9VAYN1MHgxDjAMBgNVBAMM
BWVjY2NhMQswCQYDVQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNVBAcMAlNIMRIw
EAYDVQQKDAlLb2FsIFNvZnQxDDAKBgNVBAsMA1NTTDEdMBsGCSqGSIb3DQEJARYO
ZWNjY2FAa29hbC5jb20wHhcNMTcwMTA4MjIyMzIzWhcNMjcwMTA2MjIyMzIzWjCB
gjETMBEGA1UEAwwKZWNjZW5jdXNlcjELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAlNI
MQswCQYDVQQHDAJTSDESMBAGA1UECgwJS29hbCBTb2Z0MQwwCgYDVQQLDANTU0wx
IjAgBgkqhkiG9w0BCQEWE2VjY2VuY3VzZXJAa29hbC5jb20wWTATBgcqhkjOPQIB
BggqgRzPVQGCLQNCAARcN072+q8p5z+TBjiQZE0XFlGU4JcjHDJvgL3zgj/Dg786
4C3RvFQiLSQsDirW7+QHmmuo5MYs17acLqpe0FRYoxowGDAJBgNVHRMEAjAAMAsG
A1UdDwQEAwIEcDAKBggqgRzPVQGDdQNIADBFAiEAlbLQ0TJPu7FYn6KOFcZefIc2
LLxj4FGrQE7txXiF29UCIHRsqHzDo7jO+QYTjUPfhlZp5HIg15WdsoMQSVMKkpKW
-----END CERTIFICATE-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIJ1Omp6MPBSRNibagnsSBKl+9SroY/+QRjTKHOARVy0soAoGCCqBHM9V
AYItoUQDQgAEXDdO9vqvKec/kwY4kGRNFxZRlOCXIxwyb4C984I/w4O/OuAt0bxU
Ii0kLA4q1u/kB5prqOTGLNe2nC6qXtBUWA==
-----END EC PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIICDjCCAbSgAwIBAgIJAJeHv6sBofdcMAoGCCqBHM9VAYN1MHgxDjAMBgNVBAMM
BWVjY2NhMQswCQYDVQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNVBAcMAlNIMRIw
EAYDVQQKDAlLb2FsIFNvZnQxDDAKBgNVBAsMA1NTTDEdMBsGCSqGSIb3DQEJARYO
ZWNjY2FAa29hbC5jb20wHhcNMTcwMTA4MjIyNjUxWhcNMjcwMTA2MjIyNjUxWjCB
hDEUMBIGA1UEAwwLZWNjc2lnbnNpdGUxCzAJBgNVBAYTAkNOMQswCQYDVQQIDAJT
SDELMAkGA1UEBwwCU0gxEjAQBgNVBAoMCUtvYWwgU29mdDEMMAoGA1UECwwDU1NM
MSMwIQYJKoZIhvcNAQkBFhRlY2NzaWduc2l0ZUBrb2FsLmNvbTBZMBMGByqGSM49
AgEGCCqBHM9VAYItA0IABOsJJnaViIa3tlpZoYFTX4Pk++u5akqB6C6R235k1OsY
AYYQTICZsSw91ayret53LTe4opTkhdrs0DnuLCaYW++jGjAYMAkGA1UdEwQCMAAw
CwYDVR0PBAQDAgbAMAoGCCqBHM9VAYN1A0gAMEUCIQC1yLw8iJALU3I8gHAoaoVs
5q2MwUPuP3+pegrwaRh9zwIgVRtZ1oZKNb4VYSoP/LSilHjxswsrpnaZfmxUZ9g1
UnA=
-----END CERTIFICATE-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIFUXRQfcVEjJ/y43WJIp8FqQsIRO68GRvFUYkeHRJz6doAoGCCqBHM9V
AYItoUQDQgAE6wkmdpWIhre2WlmhgVNfg+T767lqSoHoLpHbfmTU6xgBhhBMgJmx
LD3VrKt63nctN7iilOSF2uzQOe4sJphb7w==
-----END EC PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIICDjCCAbSgAwIBAgIJAJeHv6sBofdaMAoGCCqBHM9VAYN1MHgxDjAMBgNVBAMM
BWVjY2NhMQswCQYDVQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNVBAcMAlNIMRIw
EAYDVQQKDAlLb2FsIFNvZnQxDDAKBgNVBAsMA1NTTDEdMBsGCSqGSIb3DQEJARYO
ZWNjY2FAa29hbC5jb20wHhcNMTcwMTA4MjIyNDA1WhcNMjcwMTA2MjIyNDA1WjCB
hDEUMBIGA1UEAwwLZWNjc2lnbnVzZXIxCzAJBgNVBAYTAkNOMQswCQYDVQQIDAJT
SDELMAkGA1UEBwwCU0gxEjAQBgNVBAoMCUtvYWwgU29mdDEMMAoGA1UECwwDU1NM
MSMwIQYJKoZIhvcNAQkBFhRlY2NzaWdudXNlckBrb2FsLmNvbTBZMBMGByqGSM49
AgEGCCqBHM9VAYItA0IABABwRzSc9xk5ak1ieE0kIuHjrOo7R9td/ST1N2+729+r
8MWfh7QBlTL4BLr/l7Sy3xyNzEQyoVDgrU3SgmfkT3GjGjAYMAkGA1UdEwQCMAAw
CwYDVR0PBAQDAgbAMAoGCCqBHM9VAYN1A0gAMEUCIQCDnf3NgZ+l51gkNYlJpKvN
+RMJ7aTrj7xJrdG/mPm0ogIgM13gbbg/6q7ApPFLWpJvYYKCgdilcbMrrNaHmDUC
u8w=
-----END CERTIFICATE-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIBGZ0390DYrT8JqVqID3R4mx81/78K9mwlv+8VYRfjKUoAoGCCqBHM9V
AYItoUQDQgAEAHBHNJz3GTlqTWJ4TSQi4eOs6jtH2139JPU3b7vb36vwxZ+HtAGV
MvgEuv+XtLLfHI3MRDKhUOCtTdKCZ+RPcQ==
-----END EC PRIVATE KEY-----
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:28} hello world 1 23d
LOG : FATAL {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:29} hello world 0 23d
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:30} hello world 2 23d
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:28} hello world 1 23d
LOG : FATAL {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:29} hello world 0 23d
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:30} hello world 2 23d
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:28} hello world 1 23d
LOG : FATAL {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:29} hello world 0 23d
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:30} hello world 2 23d
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:27} hello world 1 0
LOG : FATAL {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:28} hello world 0 0
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:29} hello world 2 0
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:27} hello world 1 0
LOG : FATAL {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:28} hello world 0 0
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:29} hello world 2 0
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:27} hello world 1 0
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:73} hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:73} hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:55} hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:55} hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:55} hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:55} hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:55} hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:55} hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:55} hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:55} hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:55} hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:55} log test hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:55} log test hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:55} log test hello 1 32
LOG : INFO {../src/main_test.c:56} log test hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:56} log test hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:56} log test hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:56} log test hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:56} log test hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:58} log test hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:58} log test hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:59} log test hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:63} log test hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:63} log test hello 1 32
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:63} log test hello 1 32
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:77} ECDSA_size 50
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:107} 生成共享密钥失败
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:77} ECDSA_size 50
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:107} 生成共享密钥失败
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:77} ECDSA_size 50
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:107} 生成共享密钥失败
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:77} ECDSA_size 50
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:107} 生成共享密钥失败
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:77} ECDSA_size 50
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:107} 生成共享密钥失败
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:77} ECDSA_size 50
LOG : ERROR {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:107} gentra mask key fail LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:77} ECDSA_size 50
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:107} gentra mask key fail LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:77} ECDSA_size 50
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:107} gentra mask key fail
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:77} ECDSA_size 50
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:107} gentra mask key fail
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:77} ECDSA_size 50
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:107} gentra mask key fail
LOG : DEBUG {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:40} curve_name is 722
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:77} ECDSA_size 50
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:107} gentra mask key fail
LOG : DEBUG {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:40} curve_name is 722
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:77} ECDSA_size 50
LOG : INFO {/home/admire/workspace/Cline_project/Pro_src/src/gmssl/gmssl_mast_secruty.c:107} gentra mask key fail
0-1-8-0-0 LOG : WARN {../src/main_test.c:75} log test hello 1 32
0-1-8-0-0 LOG : WARN {../src/main_test.c:75} log test hello 1 32
00-1-8-6-8 LOG : WARN {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:75} log test hello 1 32
00-01-08-06-08 LOG : WARN {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:75} log test hello 1 32
00-01-08-06-08 LOG : WARN {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:76} log test hello 1 32
00-01-08-06-08 LOG : WARN {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:75} log test hello 1 32
00-01-08-06-08 LOG : WARN {/home/admire/workspace/Cline_project/Pro_src/src/main_test.c:75} log test hello 1 32
linux 设备驱动开发学习
1.了解SRAM,Flash,SDRAM,磁盘的读写方式;UART IIC,USB,设备接口,轮询,中断,DMA原理;
PIC总线的工作方式,CPU的内存管理单元MMU
2. C语言基础,结构体,指针,函数指针,内存动态申请释放;
3. linux 驱动和内核的接口;
4.linux 网络并发连接:当用epoll以后,用select进行检测,数量大于1024则会异常
1.主要从事于公司网络安全方面产品的预演与开发;
1.openvpn相关的开发;基于linux,debian,centos系统的openvpn客户端的开发与优化,主要为openvpn的封装和509证书的处理,以及页面http交互流程控制;
2.openvpn基于商密算法的硬件兼容以及客户端功能的开发,主要开发平台为QT,负责商密加密硬件设备的兼容以及客户端功能的扩展。
3.有关VPN在Mips,arm平台的兼容性开发,主要为路由器以及可移动设备的网络数据加密保护处理,以及加密设备在arm平台的兼容
4.基于商密算法的网络数据加密保护程序开发;此程序由两部分构成,一部分为网关服务端程序,实现应用数据与后台实际应用的交互;一部分为客户端SDK程序,主要实现用户数据的接受处理,以及加密;此程序的初衷主要为实现某些涉及用户私人信息认证的数据,在网络传输的安全保障,通过网关服务与客户端JDK相互配合的模式,保证应用数据在未到达应用端口之前,为严格加密方式。
提供于认证合一校验等处理方案。
lipstick
魅可 ——称子弹头,牌子里最有性价比的口红
迪奥——人手必备一支
阿玛尼——深受人心
香奈儿——不知道,因为她不喜欢这个牌子
圣罗兰——称杨树林,很多人喜欢,最火色号21号色
阿玛尼 500号
萝卜丁 女王的权杖(可以给女朋友每季度送一支,如果条件允许可以频率大一点)
🍃你觉得粉色好看吗?
桃红色呢?
玫红色呢?
紫红色呢?
特别亮的橘色呢?
都丑
湖南省怀化市辰溪县辰阳镇成龙幼儿园
15074579862
一个男人和他的故事,全都记录于此
虽然文学距离我已经遥不可及,但是念及内心的执着,还是要将这一份故事记录下来,不管以后是否可以拿来回忆,或者说作为悔不当初的
证据;此记,可阅览者,为作者个人,或者作者愿意主动拿出来分享的亲人朋友,其余人,请珍惜自己的时间,不要为这一篇荒唐的文字,浪费您宝贵的时
间。
初识人间,不知悲欢
或许这将作为一种持续的怨恨,延续到未知的终点,但是这丝毫不影响,我对于他们的感激;
2019-3-13-12:01 郝亦清 名字讨论了很久,不知道有没有定下来,但是,我还是推荐了这个,希望能用到
2019-03-25 : 今天去医院看了一下自己的口腔相关问题,费用较高,但还是希望能够处理掉,
不管生活给我多少磨难,我都将一一解决,没有退路,从一开始,就没办法后退,如果能,谁愿意这么艰难的活着
月初 2019-04-01
明眸初识人间物,聪耳聆听群芳语;
应是人间好时节,膝下承欢无烦忧。

linux 部分代码个人接口实现 . ├── bin //编译目标文件目录 ├── build //一些示例脚本以及程序makefile文件目录 ├── cmake-build-debug //clion 生成的debug目录 ├── CMakeLists.txt //Cmake 的配置文件 ├── config //程序配置文件以及默认日志存放目录 ├── doc //程序备注文件目录 ├── inc //引用库的头文件以及个人头文件目录 ├── lib //引用库存放目录 ├── obj //编译中间文件目录 └── src //源码文件目录 实现: common中主要实现日志以及线程库,文件排序,位操作示例程序 datastruct 数据结构目录,引用别人的实现 gmssl 基于guanzhi gmssl项目简单调用实现gmssl通信 json 轻量级json库 linux_net 有关linux网络编程的接口封装 websocket_linux websocket 基于tcp的一份代码,个人收集他人的实现 调用测试: 下载以后,可以直接执行build目录下的makefile 得到目标文件测试 函数调用示例文件,main_test.c cd ./build make cd ../bin ./Pro_src --help(或者运行命令查看main_test.c)

//
// Created by root on 19-3-23.
//
#ifndef STATION_JUDGE_NUM_H
#define STATION_JUDGE_NUM_H
#ifdef __cplusplus
extern "C" {
#endif
//判断一个数是不是奇数
int Judge_num_isOdd(int num);
//判断一个数是否为素数 素数f还有一个特点,就是它总是等于 6x-1 或者 6x+1,其中 x 是大于等于1的自然数
int Judge_num_isPrime(int num);
#ifdef __cplusplus
}
#endif
#endif //STATION_JUDGE_NUM_H
#ifndef LOGGER_H
#define LOGGER_H
#include <string.h>
#include <stdio.h>
#include <time.h>
#include "Read_file.h"
#define USE_MYLOG
#define LOG_FILE "../config/test_process.log" //log location
#define LOG_TAG "LOG"
extern unsigned int log_level ;
extern unsigned int log_size ;
#define NO_USE_SYSLOG
#ifndef NO_USE_SYSLOG
#include <sys/syscall.h>
#include <syslog.h>
// syslog level
typedef enum _sysType{
LOG_SYS_INFO,
LOG_SYS_ALERT,
LOG_SYS_EMERG,
LOG_SYS_CRIT,
LOG_SYS_NOTICE,
LOG_SYS_WARNING,
LOG_SYS_ERR,
LOG_SYS_DEBUG,
}Type_syslog;
static const char* TypeToString_syslog(const Type_syslog type)
{
switch (type) {
case LOG_SYS_INFO:
return "LOG_INFO ";
case LOG_SYS_ALERT:
return "LOG_ALERT ";
case LOG_SYS_EMERG:
return "LOG_EMERG ";
case LOG_SYS_CRIT:
return "LOG_CRIT ";
case LOG_SYS_NOTICE:
return "LOG_NOTICE ";
case LOG_SYS_WARNING:
return "LOG_WARNING";
case LOG_SYS_ERR:
return "LOG_ERR ";
case LOG_SYS_DEBUG:
return "LOG_DEBUG ";
default:
break;
}
return "UNKNOWN";
}
#define PRINT_SYSLOG(type,format,...)\
{\
do{\
if(log_level < type){}\
else{\
char msg[256]={0};\
sprintf(msg, " %s {%s:%d} " format,TypeToString_syslog(type),__FILE__,__LINE__,##__VA_ARGS__);\
openlog(LOG_TAG, LOG_CONS | LOG_PID,0);\
syslog(type, msg);\
closelog();\
}\
}while(0);\
}
#endif
// my log file level
typedef enum _Type{
LOG_TYPE_FATAL,
LOG_TYPE_WARN,
LOG_TYPE_INFO,
LOG_TYPE_NOTICE,
LOG_TYPE_ERROR,
LOG_TYPE_DEBUG,
}Type;
static const char* TypeToString_self(const Type type ){
switch( type ) {
case LOG_TYPE_FATAL:
return "FATAL";
case LOG_TYPE_WARN:
return "WARN ";
case LOG_TYPE_INFO:
return "INFO ";
case LOG_TYPE_NOTICE:
return "NOTICE ";
case LOG_TYPE_ERROR:
return "ERROR";
case LOG_TYPE_DEBUG:
return "DEBUG";
default:
break;
}
return "UNKNOWN";
}
#define PRINT_MYLOG(type,format,...)\
{\
do{\
if(log_level < type){;}\
else{\
FILE *fp = NULL;\
char msg[256] = {0};\
if(log_size*1024*1024 > Get_file_size(LOG_FILE)){fp = fopen(LOG_FILE,"a+");}\
else{\
fp = fopen(LOG_FILE,"w");\
}\
struct tm *ptr = NULL;\
time_t ltime;\
ptr = localtime(&ltime);\
sprintf(msg," %02d-%02d-%02d-%02d-%02d %s : %s {%s:%d} "format,ptr->tm_mon,ptr->tm_mday,ptr->tm_hour,ptr->tm_min,ptr->tm_sec,LOG_TAG,TypeToString_self(type),__FILE__,__LINE__,##__VA_ARGS__);\
fwrite(msg,1,strlen(msg),fp);\
fclose(fp);\
}\
}while(0);\
}
/*传入数据未知原因会丢失,所以参数先接收备份,原因待查*/
#define PRINTF_MESSAGE(len,str,flag,message)\
{\
printf(" Information %s %s %s %d \n",message,__FUNCTION__,__FILE__,__LINE__);\
if(flag == 1 && strlen(str) != 0){\
int inlen = len;\
int i = 0;\
for(i =0 ;i < len;i++){\
if( (i+1)%16 == 1 ) printf("%04x ",i);\
printf("%02x%s",str[i],(i+1)%16?((i+1)%16==8?"-":" "):"\n");\
}\
printf("\n");\
}\
}
#define PRINTF_FORMAT(format,...)\
{\
char meg[256] = {0};\
sprintf(meg,"%s %s %d \n" format,__FUNCTION__,__FILE__,__LINE__,##__VA_ARGS__);\
printf(" \n %s \n",meg);\
}
#endif // LOGGER_H
//
// Created by root on 19-4-17.
//
#ifndef PRO_SRC_MAKE_CFG_FILE_H
#define PRO_SRC_MAKE_CFG_FILE_H
#define DEFAULT_CFG_FILE "../config/default_cfg.json"
#ifdef __cplusplus
extern "C" {
#endif
int Make_default_cfg(void);
#ifdef __cplusplus
}
#endif
#endif //PRO_SRC_MAKE_CFG_FILE_H
//
// Created by root on 19-4-18.
//
#ifndef PRO_SRC_PARS_CONF_H
#define PRO_SRC_PARS_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
int Get_log_item(char *, char*);
int get_key_string(char *file, char *key, char *key_val);
#ifdef __cplusplus
}
#endif
#endif //PRO_SRC_PARS_CONF_H
//
// Created by root on 19-4-17.
//
#ifndef PRO_SRC_READ_FILE_H
#define PRO_SRC_READ_FILE_H
#ifdef __cplusplus
extern "C" {
#endif
int Read_file_size(char *, int *,char *);
int Get_file_size(char *);
#ifdef __cplusplus
}
#endif
#endif //PRO_SRC_READ_FILE_H
//
// Created by root on 1/15/19.
//
#ifndef STATION_SORT_FUNC_H
#define STATION_SORT_FUNC_H
/*
* 快速排序
*
* 参数说明:
* a -- 待排序的数组
* left -- 数组的左边界(例如,从起始位置开始排序,则l=0)
* right -- 数组的右边界(例如,排序截至到数组末尾,则r=a.length-1)
*/
void quick_sort_int(int a[],int left,int right);
void quick_sort_str(char *,int, int);
int Bubble_sort_string(char *src);
int Select_sort_string(char *str);
int Insert_sort_string(char *str);
int BucketSort(char *string,int size);
#endif //STATION_SORT_FUNC_H
//
// Created by root on 19-3-6.
//
#ifndef STATION_STRING_H
#define STATION_STRING_H
/*-NO.1-----------------------------
* 功能: 将一个字符串逆序
* 说明 : 这个函数只能将字符串逆序,不能逆序内存单元
*-----------------------------*/
int char_exchange(char *str,int ll);
/* NO.2------------------------------
* 功能:将传入的字符串按照ASCII码进行排序
* 说明:算法部分暂且选用冒泡
/**************************************/
int Sort_string(char *src);
/**************************************/
/*-NO.2-----------------------------
* 功能: 获得一个文件的大小,单位 byte
* 说明 : 传入的字符串为文件的绝对路径
* 不能获得文件夹的大小
*-----------------------------*/
long GetFileSize(char *path);
int A_2_a(char *src);
/*-NO.3-----------------------------
* 功能: 从字符串1中剔除特定字符
* 说明 :
*-----------------------------*/
char *Delect_string_c(char *,char);
#endif //STATION_STRING_H
//
// Created by root on 1/9/19.
//
#ifndef STATION_THREAD_FUNC_H
#define STATION_THREAD_FUNC_H
#include "queue_my.h"
typedef struct _report_thread_info{
long int invalid;
long int valid;
Queue *queue;
}r_thread_info_t,*p_r_thread_info_t;
void *thread_func_example(void *arg);
//add data in buffer head
int build_web_data(char *data, int len, char *buff);
#endif //STATION_THREAD_FUNC_H
#ifndef THREADPOOL
#define THREADPOOL
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
struct job
{
void *(*callbacl_function)(void *arg);
void *arg;
struct job *next;
};
struct threadpool
{
int thread_num;
int queue_max_num;
struct job *head;
struct job *tail;
pthread_t *pthreads; //save every thread tid by array
pthread_mutex_t mutex; //
pthread_cond_t queue_empty;
pthread_cond_t queue_not_empty;
pthread_cond_t queue_not_full;
int queue_cur_num;
int queue_close;
int pool_close;
};
//init thread pool
struct threadpool* threadpool_init(int thread_num,int queue_max);
//add a job to thread pool
int threadpool_add_job(struct threadpool *pool,void* (*callback_function)(void *arg),void *arg);
//destroy thread pool
int threadpool_destroy_it(struct threadpool *pool);
void *threadpool_function(void *arg);
#endif // THREADPOLL
/**********************
* Copyrigth (c) 2013,lonelyc++
* All rights reserved
*
* @file:threadpool.h
* @desc:threadpool definion
* @author:liyuanchi
* @date:2013-10-19
**********************/
#ifndef __THREADPOOL_H_
#define __THREADPOOL_H_
typedef struct threadpool_t threadpool_t;
/**
* @function threadpool_create
* @descCreates a threadpool_t object.
* @param thr_num thread num
* @param max_thr_num max thread size
* @param queue_max_size size of the queue.
* @return a newly created thread pool or NULL
*/
threadpool_t *threadpool_create(int min_thr_num, int max_thr_num, int queue_max_size);
/**
* @function threadpool_add
* @desc add a new task in the queue of a thread pool
* @param pool Thread pool to which add the task.
* @param function Pointer to the function that will perform the task.
* @param argument Argument to be passed to the function.
* @return 0 if all goes well,else -1
*/
int threadpool_add(threadpool_t *pool, void*(*function)(void *arg), void *arg);
/**
* @function threadpool_destroy
* @desc Stops and destroys a thread pool.
* @param pool Thread pool to destroy.
* @return 0 if destory success else -1
*/
int threadpool_destroy(threadpool_t *pool);
/**
* @desc get the thread num
* @pool pool threadpool
* @return # of the thread
*/
int threadpool_all_threadnum(threadpool_t *pool);
/**
* desc get the busy thread num
* @param pool threadpool
* return # of the busy thread
*/
int threadpool_busy_threadnum(threadpool_t *pool);
int test_thread_ex(int , int);
#endif
#ifndef _WEBSOCKET_COMMON_H_
#define _WEBSOCKET_COMMON_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h> // 使用 malloc, calloc等动态分配内存方法
#include <stdbool.h>
#include <time.h> // 获取系统时间
#include <errno.h>
#include <netinet/in.h>
#include <fcntl.h> // socket设置非阻塞模式
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/epoll.h> // epoll管理服务器的连接和接收触发
#include <pthread.h> // 使用多线程
// websocket根据data[0]判别数据包类型 比如0x81 = 0x80 | 0x1 为一个txt类型数据包
typedef enum{
WCT_MINDATA = -20, // 0x0:标识一个中间数据包
WCT_TXTDATA = -19, // 0x1:标识一个txt类型数据包
WCT_BINDATA = -18, // 0x2:标识一个bin类型数据包
WCT_DISCONN = -17, // 0x8:标识一个断开连接类型数据包
WCT_PING = -16, // 0x8:标识一个断开连接类型数据包
WCT_PONG = -15, // 0xA:表示一个pong类型数据包
WCT_ERR = -1,
WCT_NULL = 0
}Websocket_CommunicationType;
int webSocket_clientLinkToServer(char *ip, int port, char *interface_path);
int webSocket_serverLinkToClient(int fd, char *recvBuf, unsigned int bufLen);
int webSocket_send(int fd, unsigned char *data, unsigned int dataLen, bool mod, Websocket_CommunicationType type);
int webSocket_recv(int fd, unsigned char *data, unsigned int dataMaxLen);
void delayms(unsigned int ms);
int web_socket_client(void);
int web_socket_server(void);
#endif
#ifndef __AVLTREE_H_
#define __AVLTREE_H_
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define GET_HEIGHT(T) (T == NULL ? -1 : T->height)
/*
* if use this please in queuue.h add noe line
*
* typedef AVLtree *elementType;
*
*/
typedef int myType;
typedef struct _AVLtreeNode
{
myType element;
struct _AVLtreeNode *lchild;
struct _AVLtreeNode *rchild;
int height;
}AVLtree,*PAVLtree;
//void createTree(AVLtree **T);
void AVL_preOrder(AVLtree *T);
void AVL_inOrder(AVLtree *T);
void AVL_postOrder(AVLtree *T);
void AVL_levelOrder(AVLtree *T);
AVLtree *AVL_find(myType data, AVLtree *T);
AVLtree *AVL_findMin(AVLtree *T);
AVLtree *AVL_findMax(AVLtree *T);
AVLtree *AVL_insert(myType data, AVLtree *T);
AVLtree *AVL_erase(myType data, AVLtree *T);
int AVL_tree_test(void);
#endif //__AVLTREE_H_
#ifndef DOUBLE_LIST
#define DOUBLE_LIST
#include <stdio.h>
#include <malloc.h>
#include <assert.h>
#define swp(x,y) {x = x+y;y = x-y,x = x-y}
//typedef char* ElemType;
typedef int ElemType;
typedef struct _Node{
ElemType data;
struct _Node *pPrio;
struct _Node *pNext;
}Node,*pNode;
typedef struct List{
pNode first;
pNode last;
size_t size;
}List,*pList;
void InitDlist(List *list);//初始化双链表
void Insert_in_tail(List *list, ElemType x);//在双链表的末尾插入元素
void Insert_in_head(List *list, ElemType x);//在双链表的头部插入元素
void Show_list(List *list);//打印双链表
void Delete_tail(List *list);//删除双链表的最后一个元素
void Delete_head(List *list);//删除双链表的第一个元素
void Insert_node(List *list, ElemType x);//将数据元素插入到双链表中(要求此时双链表中的数据元素顺序排列)
Node* Find_value(List *list, ElemType x);//查找双链表中数据值为x的结点
int Get_dlist_length(List *list);//求双链表的长度
void Delete_val(List *list, ElemType x);//按值删除双链表中的某个数据元素
void Sort_list(List *list);//对双链表进行排序
void Reverse_list(List *list);//逆置双链表
void Clear_list(List *list);//清除双链表
void Destory_list(List *list);//摧毁双链表
//优化
pNode Buy_node(ElemType x);//创建结点
void testdlist();
#endif // DOUBLE_LIST
#ifndef _QUEUE_H_
#define _QUEUE_H_
#include "AVLtree.h"
#include "searchtree.h"
//typedef AVLtree *elementType;
//typedef searchTree *elementType;
typedef int* elementType;
#define MinQueueSize 5
//typedef int elementType;
typedef struct queueRecord
{
int capacity;
int front;
int rear;
int size;
elementType array;
}QUEUE;
int queue_test_01(void);
int isEmpty(QUEUE *q);
int isFull(QUEUE *q);
QUEUE *createQueue(int maxElements);
void disposeQueue(QUEUE *q);
void makeEmpty(QUEUE *q);
void enQueue(elementType element, QUEUE *q);
elementType front(QUEUE *q);
void deQueue(QUEUE *q);
elementType frontAndDequeue(QUEUE *q);
#endif
#ifndef QUEUE_MYH
#define QUEUE_MYH
#include <stdio.h>
typedef struct tagNode
{
char *ip;
long int timestamp;
struct tagNode* next;
}QueueNode;
typedef struct queue
{
QueueNode* head;
QueueNode* tail;
}Queue;
void InitQueue(Queue*);
int Search_ip(Queue*, char *);
int LengQueue(Queue*);
void EnQueue(Queue*, char*, long int);
int DeQueue(Queue* queue);
void PrintQueue(Queue* queue);
int IsNull(Queue* queue);
void DelQueue(Queue* queue);
int test_queue(void);
#endif //QUEUE_H
#ifndef _SEARCHTREE_H_
#define _SEARCHTREE_H_
typedef int myType;
/*
* if use this please in queuue.h add noe line
*
* typedef searchTree *elementType;
*
*/
typedef struct _srarchtreeNode
{
myType element;
struct treeNode *lchild;
struct treeNode *rchild;
}searchTree,*psearchTree;
void createTree(searchTree **T);
void preOrder(searchTree *T);
void inOrder(searchTree *T);
void postOrder(searchTree *T);
void levelOrder(searchTree *T);
searchTree *find(myType data, searchTree *T);
searchTree *findMin(searchTree *T);
searchTree *findMax(searchTree *T);
searchTree *insert(myType data, searchTree *T);
searchTree *erase(myType data, searchTree *T);
int searchtree_test(void);
#endif
#ifndef _stack_h_
#define _stack_h_
#define EmptyTOS -1
#define MinStackSize 5
typedef int elementType;
typedef struct _tagSTACK
{
int capacity;//容量
int stackTop;//栈顶
elementType *array;
}STACK,*PSTACK;
int Stack_isEmpty(STACK *s); //判空
int Stack_isFull(STACK *s); //判满
STACK *createStack(int maxElements); //栈的创建
void disposeStack(STACK *s); //栈的释放
void Stack_makeEmpty(STACK *s); //创建空栈
void push(elementType element, STACK *s);//入栈
elementType top(STACK *s); //返回栈顶元素
void pop(STACK *s); //出栈
elementType topAndTop(STACK *s); //出栈并返回栈顶元素
#endif
//
// Created by root on 1/12/19.
//
#ifndef STATION_GMSSL_DEBUG_H
#define STATION_GMSSL_DEBUG_H
int gmssl_client_demo(unsigned short , char * );
int gmssl_server_demo(unsigned short , char * );
int gmssl_mask_secrit(void);
#endif //STATION_GMSSL_DEBUG_H
//
// Created by root on 19-3-5.
//
#ifndef STATION_HAND_PFX_H
#define STATION_HAND_PFX_H
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/pkcs12.h>
#include <curl/curl.h>
//typedef int bool;
#define CONFILE "./config"
//获取crt 证书的内容
int Get_public_key_crt(char *);
int PraseP12Cert(char *p12Cert,char *p12pass,
char *pubCertFile,char *priCertFile,int format_pem);
int mite_string_2_base64_block(char *input,int input_len,char **base64);
char *Test_Encode(char *source,int len);
int PEM_cert_get_user_info(char *filename,char* out_data,int iteam);
int DER_cert_get_user_info(char *filename,char *out_data,char* iteam);
#endif //STATION_HAND_PFX_H
/*
Copyright (c) 2009 Dave Gamble
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
#include <stddef.h>
#include <math.h>
#define cJSON__h
#ifdef __cplusplus
extern "C"
{
#endif
/* cJSON Types: */
#define cJSON_False 0
#define cJSON_True 1
#define cJSON_NULL 2
#define cJSON_Number 3
#define cJSON_String 4
#define cJSON_Array 5
#define cJSON_Object 6
#define cJSON_IsReference 256
#define cJSON_StringIsConst 512
/* The cJSON structure: */
typedef struct cJSON {
struct cJSON *next,*prev; /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
struct cJSON *child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
int type; /* The type of the item, as above. */
char *valuestring; /* The item's string, if type==cJSON_String */
int valueint; /* The item's number, if type==cJSON_Number */
double valuedouble; /* The item's number, if type==cJSON_Number */
char *string; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
} cJSON;
typedef struct cJSON_Hooks {
void *(*malloc_fn)(size_t sz);
void (*free_fn)(void *ptr);
} cJSON_Hooks;
/* Supply malloc, realloc and free functions to cJSON */
extern void cJSON_InitHooks(cJSON_Hooks* hooks);
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */
extern cJSON *cJSON_Parse(const char *value);
/* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */
extern char *cJSON_Print(cJSON *item);
/* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */
extern char *cJSON_PrintUnformatted(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 */
extern char *cJSON_PrintBuffered(cJSON *item,int prebuffer,int fmt);
/* Delete a cJSON entity and all subentities. */
extern void cJSON_Delete(cJSON *c);
/* Returns the number of items in an array (or object). */
extern int cJSON_GetArraySize(cJSON *array);
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
extern cJSON *cJSON_GetArrayItem(cJSON *array,int item);
/* Get item "string" from object. Case insensitive. */
extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string);
extern int cJSON_HasObjectItem(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. */
extern const char *cJSON_GetErrorPtr(void);
/* These calls create a cJSON item of the appropriate type. */
extern cJSON *cJSON_CreateNull(void);
extern cJSON *cJSON_CreateTrue(void);
extern cJSON *cJSON_CreateFalse(void);
extern cJSON *cJSON_CreateBool(int b);
extern cJSON *cJSON_CreateNumber(double num);
extern cJSON *cJSON_CreateString(const char *string);
extern cJSON *cJSON_CreateArray(void);
extern cJSON *cJSON_CreateObject(void);
/* These utilities create an Array of count items. */
extern cJSON *cJSON_CreateIntArray(const int *numbers,int count);
extern cJSON *cJSON_CreateFloatArray(const float *numbers,int count);
extern cJSON *cJSON_CreateDoubleArray(const double *numbers,int count);
extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
/* Append item to the specified array/object. */
extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
extern void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item);
extern void cJSON_AddItemToObjectCS(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 */
/* 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. */
extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
extern void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item);
/* Remove/Detatch items from Arrays/Objects. */
extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which);
extern void cJSON_DeleteItemFromArray(cJSON *array,int which);
extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string);
extern void cJSON_DeleteItemFromObject(cJSON *object,const char *string);
/* Update array items. */
extern void cJSON_InsertItemInArray(cJSON *array,int which,cJSON *newitem); /* Shifts pre-existing items to the right. */
extern void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
/* Duplicate a cJSON item */
extern cJSON *cJSON_Duplicate(cJSON *item,int 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. */
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
extern cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated);
extern void cJSON_Minify(char *json);
/* Macros for creating things quickly. */
#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
#define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
#define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
#define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b))
#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
#define cJSON_SetIntValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val))
#define cJSON_SetNumberValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val))
/* Macro for iterating over an array */
#define cJSON_ArrayForEach(pos, head) for(pos = (head)->child; pos != NULL; pos = pos->next)
#ifdef __cplusplus
}
#endif
#endif
#include "cJSON.h"
/* Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec. */
cJSON *cJSONUtils_GetPointer(cJSON *object,const char *pointer);
/* Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. */
cJSON* cJSONUtils_GeneratePatches(cJSON *from,cJSON *to);
void cJSONUtils_AddPatchToArray(cJSON *array,const char *op,const char *path,cJSON *val); /* Utility for generating patch array entries. */
int cJSONUtils_ApplyPatches(cJSON *object,cJSON *patches); /* Returns 0 for success. */
/*
// 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.
*/
char *cJSONUtils_FindPointerFromObjectTo(cJSON *object,cJSON *target); /* Given a root object and a target object, construct a pointer from one to the other. */
void cJSONUtils_SortObject(cJSON *object); /* Sorts the members of the object into alphabetical order. */
//
// Created by root on 19-2-19.
//
#ifndef STATION_EPOLL_FUNC_H
#define STATION_EPOLL_FUNC_H
int main_epoll( unsigned short );
//设置socket为非阻塞
int set_sock_noblock(int sockfd);
#endif //STATION_EPOLL_FUNC_H
#ifndef LINUX_RAW_SOCKET_H
#define LINUX_RAW_SOCKET_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <poll.h>
#include <linux/types.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <linux/filter.h>
#include <net/ethernet.h>
#include <fcntl.h>
#include <linux/ip.h>
#include <netdb.h>
#include <netinet/in.h>
#include <net/if.h>
#include <pthread.h>
#include <linux/tcp.h>
#include <linux/udp.h>
#include <linux/icmp.h>
#include "logger.h"
#define ETH_HDR_LEN 14
#define IP_HDR_LEN 20
#define UDP_HDR_LEN 8
#define TCP_HDR_LEN 20
#define NETDEV_NAME "ens33"
#define NETDEV_SEND "ens33"
#endif // LINUX_RAW_SOCKET_H
//
// Created by root on 1/5/19.
//
#ifndef STATION_SOCKET_TCP_FUNC_H
#define STATION_SOCKET_TCP_FUNC_H
#ifdef WIN32 // windows system
#include <io.h>
#include <Winsock2.h>
#pragma comment(lib,"Ws2_32.lib")
#define MSG_NOSIGNAL 0
#define socklen_t int
#define CALLBACK __stdcall
#define pthread_t HANDLE
#else // linux system
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <net/if.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/tcp.h>
#define ioctlsocket ioctl
#define closesocket close
//#define O_BINARY 0
#define INVALID_SOCKET (-1)
#endif
int m_iListenRunning;
int m_iConTimeout;
int m_iRecvTimeout;
int m_iThreadNum;
int m_iQueueNum;
void SetTimeout(int connectimeout, int recvtimeout, int sendtimeout);
int AddListen(char * ip, unsigned short port);
int CreateConnect(char *IP,unsigned short port); //创建连接
int RecvData(int sock, void * pdata, int len);
int SendData(int sock, void * pdata, int len);
int create_listen(char *IP,unsigned short port);
int SetKeepAlive(int sock);
int File_write(char *,char *,char *);
int Recode_port_test(int ,int ,int ,char *);
//int initlistensocket(int ,int);
int SetSockNoblock(int sockfd);
int Analysis_DNS(char *);
#endif //STATION_SOCKET_TCP_FUNC_H
/*
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
/*
* This file is only used by HP C on VMS, and is included automatically
* after each header file from this directory
*/
/* restore state. Must correspond to the save in __decc_include_prologue.h */
#pragma names restore
/*
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
/*
* This file is only used by HP C on VMS, and is included automatically
* after each header file from this directory
*/
/* save state */
#pragma names save
/* have the compiler shorten symbols larger than 31 chars to 23 chars
* followed by a 8 hex char CRC
*/
#pragma names as_is,shortened
/*
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#ifndef HEADER_AES_H
# define HEADER_AES_H
# include <openssl/opensslconf.h>
# include <stddef.h>
# ifdef __cplusplus
extern "C" {
# endif
# define AES_ENCRYPT 1
# define AES_DECRYPT 0
/*
* Because array size can't be a const in C, the following two are macros.
* Both sizes are in bytes.
*/
# define AES_MAXNR 14
# define AES_BLOCK_SIZE 16
/* This should be a hidden type, but EVP requires that the size be known */
struct aes_key_st {
# ifdef AES_LONG
unsigned long rd_key[4 * (AES_MAXNR + 1)];
# else
unsigned int rd_key[4 * (AES_MAXNR + 1)];
# endif
int rounds;
};
typedef struct aes_key_st AES_KEY;
const char *AES_options(void);
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
AES_KEY *key);
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
AES_KEY *key);
void AES_encrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key);
void AES_decrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key);
void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key, const int enc);
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, const int enc);
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc);
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc);
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc);
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num);
/* NB: the IV is _two_ blocks long */
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, const int enc);
/* NB: the IV is _four_ blocks long */
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
const AES_KEY *key2, const unsigned char *ivec,
const int enc);
int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
unsigned char *out,
const unsigned char *in, unsigned int inlen);
int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
unsigned char *out,
const unsigned char *in, unsigned int inlen);
# ifdef __cplusplus
}
# endif
#endif
/*
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#ifndef HEADER_ASN1_H
# define HEADER_ASN1_H
# include <time.h>
# include <openssl/e_os2.h>
# include <openssl/opensslconf.h>
# include <openssl/bio.h>
# include <openssl/stack.h>
# include <openssl/safestack.h>
# include <openssl/symhacks.h>
# include <openssl/ossl_typ.h>
# if OPENSSL_API_COMPAT < 0x10100000L
# include <openssl/bn.h>
# endif
# ifdef OPENSSL_BUILD_SHLIBCRYPTO
# undef OPENSSL_EXTERN
# define OPENSSL_EXTERN OPENSSL_EXPORT
# endif
#ifdef __cplusplus
extern "C" {
#endif
# define V_ASN1_UNIVERSAL 0x00
# define V_ASN1_APPLICATION 0x40
# define V_ASN1_CONTEXT_SPECIFIC 0x80
# define V_ASN1_PRIVATE 0xc0
# define V_ASN1_CONSTRUCTED 0x20
# define V_ASN1_PRIMITIVE_TAG 0x1f
# define V_ASN1_PRIMATIVE_TAG 0x1f
# define V_ASN1_APP_CHOOSE -2/* let the recipient choose */
# define V_ASN1_OTHER -3/* used in ASN1_TYPE */
# define V_ASN1_ANY -4/* used in ASN1 template code */
# define V_ASN1_UNDEF -1
/* ASN.1 tag values */
# define V_ASN1_EOC 0
# define V_ASN1_BOOLEAN 1 /**/
# define V_ASN1_INTEGER 2
# define V_ASN1_BIT_STRING 3
# define V_ASN1_OCTET_STRING 4
# define V_ASN1_NULL 5
# define V_ASN1_OBJECT 6
# define V_ASN1_OBJECT_DESCRIPTOR 7
# define V_ASN1_EXTERNAL 8
# define V_ASN1_REAL 9
# define V_ASN1_ENUMERATED 10
# define V_ASN1_UTF8STRING 12
# define V_ASN1_SEQUENCE 16
# define V_ASN1_SET 17
# define V_ASN1_NUMERICSTRING 18 /**/
# define V_ASN1_PRINTABLESTRING 19
# define V_ASN1_T61STRING 20
# define V_ASN1_TELETEXSTRING 20/* alias */
# define V_ASN1_VIDEOTEXSTRING 21 /**/
# define V_ASN1_IA5STRING 22
# define V_ASN1_UTCTIME 23
# define V_ASN1_GENERALIZEDTIME 24 /**/
# define V_ASN1_GRAPHICSTRING 25 /**/
# define V_ASN1_ISO64STRING 26 /**/
# define V_ASN1_VISIBLESTRING 26/* alias */
# define V_ASN1_GENERALSTRING 27 /**/
# define V_ASN1_UNIVERSALSTRING 28 /**/
# define V_ASN1_BMPSTRING 30
/*
* NB the constants below are used internally by ASN1_INTEGER
* and ASN1_ENUMERATED to indicate the sign. They are *not* on
* the wire tag values.
*/
# define V_ASN1_NEG 0x100
# define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG)
# define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG)
/* For use with d2i_ASN1_type_bytes() */
# define B_ASN1_NUMERICSTRING 0x0001
# define B_ASN1_PRINTABLESTRING 0x0002
# define B_ASN1_T61STRING 0x0004
# define B_ASN1_TELETEXSTRING 0x0004
# define B_ASN1_VIDEOTEXSTRING 0x0008
# define B_ASN1_IA5STRING 0x0010
# define B_ASN1_GRAPHICSTRING 0x0020
# define B_ASN1_ISO64STRING 0x0040
# define B_ASN1_VISIBLESTRING 0x0040
# define B_ASN1_GENERALSTRING 0x0080
# define B_ASN1_UNIVERSALSTRING 0x0100
# define B_ASN1_OCTET_STRING 0x0200
# define B_ASN1_BIT_STRING 0x0400
# define B_ASN1_BMPSTRING 0x0800
# define B_ASN1_UNKNOWN 0x1000
# define B_ASN1_UTF8STRING 0x2000
# define B_ASN1_UTCTIME 0x4000
# define B_ASN1_GENERALIZEDTIME 0x8000
# define B_ASN1_SEQUENCE 0x10000
/* For use with ASN1_mbstring_copy() */
# define MBSTRING_FLAG 0x1000
# define MBSTRING_UTF8 (MBSTRING_FLAG)
# define MBSTRING_ASC (MBSTRING_FLAG|1)
# define MBSTRING_BMP (MBSTRING_FLAG|2)
# define MBSTRING_UNIV (MBSTRING_FLAG|4)
# define SMIME_OLDMIME 0x400
# define SMIME_CRLFEOL 0x800
# define SMIME_STREAM 0x1000
struct X509_algor_st;
DEFINE_STACK_OF(X509_ALGOR)
# define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */
/*
* This indicates that the ASN1_STRING is not a real value but just a place
* holder for the location where indefinite length constructed data should be
* inserted in the memory buffer
*/
# define ASN1_STRING_FLAG_NDEF 0x010
/*
* This flag is used by the CMS code to indicate that a string is not
* complete and is a place holder for content when it had all been accessed.
* The flag will be reset when content has been written to it.
*/
# define ASN1_STRING_FLAG_CONT 0x020
/*
* This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING
* type.
*/
# define ASN1_STRING_FLAG_MSTRING 0x040
/* String is embedded and only content should be freed */
# define ASN1_STRING_FLAG_EMBED 0x080
/* This is the base type that holds just about everything :-) */
struct asn1_string_st {
int length;
int type;
unsigned char *data;
/*
* The value of the following field depends on the type being held. It
* is mostly being used for BIT_STRING so if the input data has a
* non-zero 'unused bits' value, it will be handled correctly
*/
long flags;
};
/*
* ASN1_ENCODING structure: this is used to save the received encoding of an
* ASN1 type. This is useful to get round problems with invalid encodings
* which can break signatures.
*/
typedef struct ASN1_ENCODING_st {
unsigned char *enc; /* DER encoding */
long len; /* Length of encoding */
int modified; /* set to 1 if 'enc' is invalid */
} ASN1_ENCODING;
/* Used with ASN1 LONG type: if a long is set to this it is omitted */
# define ASN1_LONG_UNDEF 0x7fffffffL
# define STABLE_FLAGS_MALLOC 0x01
/*
* A zero passed to ASN1_STRING_TABLE_new_add for the flags is interpreted
* as "don't change" and STABLE_FLAGS_MALLOC is always set. By setting
* STABLE_FLAGS_MALLOC only we can clear the existing value. Use the alias
* STABLE_FLAGS_CLEAR to reflect this.
*/
# define STABLE_FLAGS_CLEAR STABLE_FLAGS_MALLOC
# define STABLE_NO_MASK 0x02
# define DIRSTRING_TYPE \
(B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
# define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING)
typedef struct asn1_string_table_st {
int nid;
long minsize;
long maxsize;
unsigned long mask;
unsigned long flags;
} ASN1_STRING_TABLE;
DEFINE_STACK_OF(ASN1_STRING_TABLE)
/* size limits: this stuff is taken straight from RFC2459 */
# define ub_name 32768
# define ub_common_name 64
# define ub_locality_name 128
# define ub_state_name 128
# define ub_organization_name 64
# define ub_organization_unit_name 64
# define ub_title 64
# define ub_email_address 128
/*
* Declarations for template structures: for full definitions see asn1t.h
*/
typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE;
typedef struct ASN1_TLC_st ASN1_TLC;
/* This is just an opaque pointer */
typedef struct ASN1_VALUE_st ASN1_VALUE;
/* Declare ASN1 functions: the implement macro in in asn1t.h */
# define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)
# define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \
DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)
# define DECLARE_ASN1_FUNCTIONS_name(type, name) \
DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)
# define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \
DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
# define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
type *d2i_##name(type **a, const unsigned char **in, long len); \
int i2d_##name(type *a, unsigned char **out); \
DECLARE_ASN1_ITEM(itname)
# define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \
type *d2i_##name(type **a, const unsigned char **in, long len); \
int i2d_##name(const type *a, unsigned char **out); \
DECLARE_ASN1_ITEM(name)
# define DECLARE_ASN1_NDEF_FUNCTION(name) \
int i2d_##name##_NDEF(name *a, unsigned char **out);
# define DECLARE_ASN1_FUNCTIONS_const(name) \
DECLARE_ASN1_ALLOC_FUNCTIONS(name) \
DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name)
# define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
type *name##_new(void); \
void name##_free(type *a);
# define DECLARE_ASN1_PRINT_FUNCTION(stname) \
DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname)
# define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \
int fname##_print_ctx(BIO *out, stname *x, int indent, \
const ASN1_PCTX *pctx);
# define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
# define I2D_OF(type) int (*)(type *,unsigned char **)
# define I2D_OF_const(type) int (*)(const type *,unsigned char **)
# define CHECKED_D2I_OF(type, d2i) \
((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0)))
# define CHECKED_I2D_OF(type, i2d) \
((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0)))
# define CHECKED_NEW_OF(type, xnew) \
((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0)))
# define CHECKED_PTR_OF(type, p) \
((void*) (1 ? p : (type*)0))
# define CHECKED_PPTR_OF(type, p) \
((void**) (1 ? p : (type**)0))
# define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
# define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
# define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
TYPEDEF_D2I2D_OF(void);
/*-
* The following macros and typedefs allow an ASN1_ITEM
* to be embedded in a structure and referenced. Since
* the ASN1_ITEM pointers need to be globally accessible
* (possibly from shared libraries) they may exist in
* different forms. On platforms that support it the
* ASN1_ITEM structure itself will be globally exported.
* Other platforms will export a function that returns
* an ASN1_ITEM pointer.
*
* To handle both cases transparently the macros below
* should be used instead of hard coding an ASN1_ITEM
* pointer in a structure.
*
* The structure will look like this:
*
* typedef struct SOMETHING_st {
* ...
* ASN1_ITEM_EXP *iptr;
* ...
* } SOMETHING;
*
* It would be initialised as e.g.:
*
* SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...};
*
* and the actual pointer extracted with:
*
* const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr);
*
* Finally an ASN1_ITEM pointer can be extracted from an
* appropriate reference with: ASN1_ITEM_rptr(X509). This
* would be used when a function takes an ASN1_ITEM * argument.
*
*/
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
/* ASN1_ITEM pointer exported type */
typedef const ASN1_ITEM ASN1_ITEM_EXP;
/* Macro to obtain ASN1_ITEM pointer from exported type */
# define ASN1_ITEM_ptr(iptr) (iptr)
/* Macro to include ASN1_ITEM pointer from base type */
# define ASN1_ITEM_ref(iptr) (&(iptr##_it))
# define ASN1_ITEM_rptr(ref) (&(ref##_it))
# define DECLARE_ASN1_ITEM(name) \
OPENSSL_EXTERN const ASN1_ITEM name##_it;
# else
/*
* Platforms that can't easily handle shared global variables are declared as
* functions returning ASN1_ITEM pointers.
*/
/* ASN1_ITEM pointer exported type */
typedef const ASN1_ITEM *ASN1_ITEM_EXP (void);
/* Macro to obtain ASN1_ITEM pointer from exported type */
# define ASN1_ITEM_ptr(iptr) (iptr())
/* Macro to include ASN1_ITEM pointer from base type */
# define ASN1_ITEM_ref(iptr) (iptr##_it)
# define ASN1_ITEM_rptr(ref) (ref##_it())
# define DECLARE_ASN1_ITEM(name) \
const ASN1_ITEM * name##_it(void);
# endif
/* Parameters used by ASN1_STRING_print_ex() */
/*
* These determine which characters to escape: RFC2253 special characters,
* control characters and MSB set characters
*/
# define ASN1_STRFLGS_ESC_2253 1
# define ASN1_STRFLGS_ESC_CTRL 2
# define ASN1_STRFLGS_ESC_MSB 4
/*
* This flag determines how we do escaping: normally RC2253 backslash only,
* set this to use backslash and quote.
*/
# define ASN1_STRFLGS_ESC_QUOTE 8
/* These three flags are internal use only. */
/* Character is a valid PrintableString character */
# define CHARTYPE_PRINTABLESTRING 0x10
/* Character needs escaping if it is the first character */
# define CHARTYPE_FIRST_ESC_2253 0x20
/* Character needs escaping if it is the last character */
# define CHARTYPE_LAST_ESC_2253 0x40
/*
* NB the internal flags are safely reused below by flags handled at the top
* level.
*/
/*
* If this is set we convert all character strings to UTF8 first
*/
# define ASN1_STRFLGS_UTF8_CONVERT 0x10
/*
* If this is set we don't attempt to interpret content: just assume all
* strings are 1 byte per character. This will produce some pretty odd
* looking output!
*/
# define ASN1_STRFLGS_IGNORE_TYPE 0x20
/* If this is set we include the string type in the output */
# define ASN1_STRFLGS_SHOW_TYPE 0x40
/*
* This determines which strings to display and which to 'dump' (hex dump of
* content octets or DER encoding). We can only dump non character strings or
* everything. If we don't dump 'unknown' they are interpreted as character
* strings with 1 octet per character and are subject to the usual escaping
* options.
*/
# define ASN1_STRFLGS_DUMP_ALL 0x80
# define ASN1_STRFLGS_DUMP_UNKNOWN 0x100
/*
* These determine what 'dumping' does, we can dump the content octets or the
* DER encoding: both use the RFC2253 #XXXXX notation.
*/
# define ASN1_STRFLGS_DUMP_DER 0x200
/*
* This flag specifies that RC2254 escaping shall be performed.
*/
#define ASN1_STRFLGS_ESC_2254 0x400
/*
* All the string flags consistent with RFC2253, escaping control characters
* isn't essential in RFC2253 but it is advisable anyway.
*/
# define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \
ASN1_STRFLGS_ESC_CTRL | \
ASN1_STRFLGS_ESC_MSB | \
ASN1_STRFLGS_UTF8_CONVERT | \
ASN1_STRFLGS_DUMP_UNKNOWN | \
ASN1_STRFLGS_DUMP_DER)
DEFINE_STACK_OF(ASN1_INTEGER)
DEFINE_STACK_OF(ASN1_GENERALSTRING)
DEFINE_STACK_OF(ASN1_UTF8STRING)
typedef struct asn1_type_st {
int type;
union {
char *ptr;
ASN1_BOOLEAN boolean;
ASN1_STRING *asn1_string;
ASN1_OBJECT *object;
ASN1_INTEGER *integer;
ASN1_ENUMERATED *enumerated;
ASN1_BIT_STRING *bit_string;
ASN1_OCTET_STRING *octet_string;
ASN1_PRINTABLESTRING *printablestring;
ASN1_T61STRING *t61string;
ASN1_IA5STRING *ia5string;
ASN1_GENERALSTRING *generalstring;
ASN1_BMPSTRING *bmpstring;
ASN1_UNIVERSALSTRING *universalstring;
ASN1_UTCTIME *utctime;
ASN1_GENERALIZEDTIME *generalizedtime;
ASN1_VISIBLESTRING *visiblestring;
ASN1_UTF8STRING *utf8string;
/*
* set and sequence are left complete and still contain the set or
* sequence bytes
*/
ASN1_STRING *set;
ASN1_STRING *sequence;
ASN1_VALUE *asn1_value;
} value;
} ASN1_TYPE;
DEFINE_STACK_OF(ASN1_TYPE)
typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)
/* This is used to contain a list of bit names */
typedef struct BIT_STRING_BITNAME_st {
int bitnum;
const char *lname;
const char *sname;
} BIT_STRING_BITNAME;
# define B_ASN1_TIME \
B_ASN1_UTCTIME | \
B_ASN1_GENERALIZEDTIME
# define B_ASN1_PRINTABLE \
B_ASN1_NUMERICSTRING| \
B_ASN1_PRINTABLESTRING| \
B_ASN1_T61STRING| \
B_ASN1_IA5STRING| \
B_ASN1_BIT_STRING| \
B_ASN1_UNIVERSALSTRING|\
B_ASN1_BMPSTRING|\
B_ASN1_UTF8STRING|\
B_ASN1_SEQUENCE|\
B_ASN1_UNKNOWN
# define B_ASN1_DIRECTORYSTRING \
B_ASN1_PRINTABLESTRING| \
B_ASN1_TELETEXSTRING|\
B_ASN1_BMPSTRING|\
B_ASN1_UNIVERSALSTRING|\
B_ASN1_UTF8STRING
# define B_ASN1_DISPLAYTEXT \
B_ASN1_IA5STRING| \
B_ASN1_VISIBLESTRING| \
B_ASN1_BMPSTRING|\
B_ASN1_UTF8STRING
DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
int ASN1_TYPE_get(const ASN1_TYPE *a);
void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);
ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t);
void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t);
ASN1_OBJECT *ASN1_OBJECT_new(void);
void ASN1_OBJECT_free(ASN1_OBJECT *a);
int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp);
ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
long length);
DECLARE_ASN1_ITEM(ASN1_OBJECT)
DEFINE_STACK_OF(ASN1_OBJECT)
ASN1_STRING *ASN1_STRING_new(void);
void ASN1_STRING_free(ASN1_STRING *a);
void ASN1_STRING_clear_free(ASN1_STRING *a);
int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);
ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a);
ASN1_STRING *ASN1_STRING_type_new(int type);
int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
/*
* Since this is used to store all sorts of things, via macros, for now,
* make its data void *
*/
int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
int ASN1_STRING_length(const ASN1_STRING *x);
void ASN1_STRING_length_set(ASN1_STRING *x, int n);
int ASN1_STRING_type(const ASN1_STRING *x);
DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x);
DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length);
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n);
int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a,
const unsigned char *flags, int flags_len);
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
BIT_STRING_BITNAME *tbl, int indent);
int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl);
int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value,
BIT_STRING_BITNAME *tbl);
DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
long length);
ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x);
int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
int ASN1_UTCTIME_check(const ASN1_UTCTIME *a);
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t);
ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
int offset_day, long offset_sec);
int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a);
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
time_t t);
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
time_t t, int offset_day,
long offset_sec);
int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
int ASN1_TIME_diff(int *pday, int *psec,
const ASN1_TIME *from, const ASN1_TIME *to);
DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a,
const ASN1_OCTET_STRING *b);
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data,
int len);
#ifndef OPENSSL_NO_SM2
int ASN1_OCTET_STRING_is_zero(const ASN1_OCTET_STRING *a);
#endif
DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING)
DECLARE_ASN1_FUNCTIONS(ASN1_NULL)
DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING)
int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
int UTF8_putc(unsigned char *str, int len, unsigned long value);
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)
DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING)
DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING)
DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING)
DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING)
DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)
DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t,
int offset_day, long offset_sec);
int ASN1_TIME_check(const ASN1_TIME *t);
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME
**out);
int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a);
int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size);
int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a);
int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size);
int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a);
int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size);
int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type);
int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a);
int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num);
ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
const char *sn, const char *ln);
int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a);
int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r);
int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a);
int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r);
int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
long ASN1_INTEGER_get(const ASN1_INTEGER *a);
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);
int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a);
int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r);
int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a);
ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai);
BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn);
/* General */
/* given a string, return the correct type, max is the maximum length */
int ASN1_PRINTABLE_type(const unsigned char *s, int max);
unsigned long ASN1_tag2bit(int tag);
/* SPECIALS */
int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
int *pclass, long omax);
int ASN1_check_infinite_end(unsigned char **p, long len);
int ASN1_const_check_infinite_end(const unsigned char **p, long len);
void ASN1_put_object(unsigned char **pp, int constructed, int length,
int tag, int xclass);
int ASN1_put_eoc(unsigned char **pp);
int ASN1_object_size(int constructed, int length, int tag);
/* Used to implement other functions */
void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x);
# define ASN1_dup_of(type,i2d,d2i,x) \
((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
CHECKED_D2I_OF(type, d2i), \
CHECKED_PTR_OF(type, x)))
# define ASN1_dup_of_const(type,i2d,d2i,x) \
((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \
CHECKED_D2I_OF(type, d2i), \
CHECKED_PTR_OF(const type, x)))
void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
/* ASN1 alloc/free macros for when a type is only used internally */
# define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type))
# define M_ASN1_free_of(x, type) \
ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))
# ifndef OPENSSL_NO_STDIO
void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x);
# define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \
CHECKED_D2I_OF(type, d2i), \
in, \
CHECKED_PPTR_OF(type, x)))
void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x);
# define ASN1_i2d_fp_of(type,i2d,out,x) \
(ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \
out, \
CHECKED_PTR_OF(type, x)))
# define ASN1_i2d_fp_of_const(type,i2d,out,x) \
(ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \
out, \
CHECKED_PTR_OF(const type, x)))
int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags);
# endif
int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in);
void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x);
# define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \
CHECKED_D2I_OF(type, d2i), \
in, \
CHECKED_PPTR_OF(type, x)))
void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x);
# define ASN1_i2d_bio_of(type,i2d,out,x) \
(ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \
out, \
CHECKED_PTR_OF(type, x)))
# define ASN1_i2d_bio_of_const(type,i2d,out,x) \
(ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \
out, \
CHECKED_PTR_OF(const type, x)))
int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);
int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);
int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags);
int ASN1_buf_print(BIO *bp, const unsigned char *buf, size_t buflen, int off);
int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
unsigned char *buf, int off);
int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent);
int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent,
int dump);
const char *ASN1_tag2str(int tag);
/* Used to load and write Netscape format cert */
int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len);
int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len);
int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
unsigned char *data, int len);
int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num,
unsigned char *data, int max_len);
void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it);
ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it,
ASN1_OCTET_STRING **oct);
void ASN1_STRING_set_default_mask(unsigned long mask);
int ASN1_STRING_set_default_mask_asc(const char *p);
unsigned long ASN1_STRING_get_default_mask(void);
int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
int inform, unsigned long mask);
int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
int inform, unsigned long mask,
long minsize, long maxsize);
ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
const unsigned char *in, int inlen,
int inform, int nid);
ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
void ASN1_STRING_TABLE_cleanup(void);
/* ASN1 template functions */
/* Old API compatible functions */
ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in,
long len, const ASN1_ITEM *it);
int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out,
const ASN1_ITEM *it);
void ASN1_add_oid_module(void);
void ASN1_add_stable_module(void);
ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf);
ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf);
int ASN1_str2mask(const char *str, unsigned long *pmask);
/* ASN1 Print flags */
/* Indicate missing OPTIONAL fields */
# define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001
/* Mark start and end of SEQUENCE */
# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002
/* Mark start and end of SEQUENCE/SET OF */
# define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004
/* Show the ASN1 type of primitives */
# define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008
/* Don't show ASN1 type of ANY */
# define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010
/* Don't show ASN1 type of MSTRINGs */
# define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020
/* Don't show field names in SEQUENCE */
# define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040
/* Show structure names of each SEQUENCE field */
# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080
/* Don't show structure name even at top level */
# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100
int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
const ASN1_ITEM *it, const ASN1_PCTX *pctx);
ASN1_PCTX *ASN1_PCTX_new(void);
void ASN1_PCTX_free(ASN1_PCTX *p);
unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p);
void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags);
unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p);
void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags);
unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p);
void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags);
unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p);
void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags);
unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p);
void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags);
ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb) (ASN1_SCTX *ctx));
void ASN1_SCTX_free(ASN1_SCTX *p);
const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p);
const ASN1_TEMPLATE *ASN1_SCTX_get_template(ASN1_SCTX *p);
unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p);
void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data);
void *ASN1_SCTX_get_app_data(ASN1_SCTX *p);
const BIO_METHOD *BIO_f_asn1(void);
BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);
int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
const ASN1_ITEM *it);
int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
const char *hdr, const ASN1_ITEM *it);
int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
int ctype_nid, int econt_nid,
STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it);
ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
int SMIME_text(BIO *in, BIO *out);
/* BEGIN ERROR CODES */
/*
* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
int ERR_load_ASN1_strings(void);
/* Error codes for the ASN1 functions. */
/* Function codes. */
# define ASN1_F_A2D_ASN1_OBJECT 100
# define ASN1_F_A2I_ASN1_INTEGER 102
# define ASN1_F_A2I_ASN1_STRING 103
# define ASN1_F_APPEND_EXP 176
# define ASN1_F_ASN1_BIT_STRING_SET_BIT 183
# define ASN1_F_ASN1_CB 177
# define ASN1_F_ASN1_CHECK_TLEN 104
# define ASN1_F_ASN1_COLLECT 106
# define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108
# define ASN1_F_ASN1_D2I_FP 109
# define ASN1_F_ASN1_D2I_READ_BIO 107
# define ASN1_F_ASN1_DIGEST 184
# define ASN1_F_ASN1_DO_ADB 110
# define ASN1_F_ASN1_DO_LOCK 233
# define ASN1_F_ASN1_DUP 111
# define ASN1_F_ASN1_EX_C2I 204
# define ASN1_F_ASN1_FIND_END 190
# define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216
# define ASN1_F_ASN1_GENERATE_V3 178
# define ASN1_F_ASN1_GET_INT64 224
# define ASN1_F_ASN1_GET_OBJECT 114
# define ASN1_F_ASN1_GET_UINT64 225
# define ASN1_F_ASN1_I2D_BIO 116
# define ASN1_F_ASN1_I2D_FP 117
# define ASN1_F_ASN1_ITEM_D2I_FP 206
# define ASN1_F_ASN1_ITEM_DUP 191
# define ASN1_F_ASN1_ITEM_EMBED_D2I 120
# define ASN1_F_ASN1_ITEM_EMBED_NEW 121
# define ASN1_F_ASN1_ITEM_I2D_BIO 192
# define ASN1_F_ASN1_ITEM_I2D_FP 193
# define ASN1_F_ASN1_ITEM_PACK 198
# define ASN1_F_ASN1_ITEM_SIGN 195
# define ASN1_F_ASN1_ITEM_SIGN_CTX 220
# define ASN1_F_ASN1_ITEM_UNPACK 199
# define ASN1_F_ASN1_ITEM_VERIFY 197
# define ASN1_F_ASN1_MBSTRING_NCOPY 122
# define ASN1_F_ASN1_OBJECT_NEW 123
# define ASN1_F_ASN1_OUTPUT_DATA 214
# define ASN1_F_ASN1_PCTX_NEW 205
# define ASN1_F_ASN1_SCTX_NEW 221
# define ASN1_F_ASN1_SIGN 128
# define ASN1_F_ASN1_STR2TYPE 179
# define ASN1_F_ASN1_STRING_GET_INT64 227
# define ASN1_F_ASN1_STRING_GET_UINT64 230
# define ASN1_F_ASN1_STRING_SET 186
# define ASN1_F_ASN1_STRING_TABLE_ADD 129
# define ASN1_F_ASN1_STRING_TO_BN 228
# define ASN1_F_ASN1_STRING_TYPE_NEW 130
# define ASN1_F_ASN1_TEMPLATE_EX_D2I 132
# define ASN1_F_ASN1_TEMPLATE_NEW 133
# define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131
# define ASN1_F_ASN1_TIME_ADJ 217
# define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134
# define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135
# define ASN1_F_ASN1_UTCTIME_ADJ 218
# define ASN1_F_ASN1_VERIFY 137
# define ASN1_F_B64_READ_ASN1 209
# define ASN1_F_B64_WRITE_ASN1 210
# define ASN1_F_BIO_NEW_NDEF 208
# define ASN1_F_BITSTR_CB 180
# define ASN1_F_BN_TO_ASN1_STRING 229
# define ASN1_F_C2I_ASN1_BIT_STRING 189
# define ASN1_F_C2I_ASN1_INTEGER 194
# define ASN1_F_C2I_ASN1_OBJECT 196
# define ASN1_F_C2I_IBUF 226
# define ASN1_F_COLLECT_DATA 140
# define ASN1_F_D2I_ASN1_OBJECT 147
# define ASN1_F_D2I_ASN1_UINTEGER 150
# define ASN1_F_D2I_AUTOPRIVATEKEY 207
# define ASN1_F_D2I_PRIVATEKEY 154
# define ASN1_F_D2I_PUBLICKEY 155
# define ASN1_F_DO_TCREATE 222
# define ASN1_F_I2D_ASN1_BIO_STREAM 211
# define ASN1_F_I2D_DSA_PUBKEY 161
# define ASN1_F_I2D_EC_PUBKEY 181
# define ASN1_F_I2D_PAILLIER_PUBKEY 101
# define ASN1_F_I2D_PRIVATEKEY 163
# define ASN1_F_I2D_PUBLICKEY 164
# define ASN1_F_I2D_RSA_PUBKEY 165
# define ASN1_F_LONG_C2I 166
# define ASN1_F_OID_MODULE_INIT 174
# define ASN1_F_PARSE_TAGGING 182
# define ASN1_F_PKCS5_PBE2_SET_IV 167
# define ASN1_F_PKCS5_PBE2_SET_SCRYPT 231
# define ASN1_F_PKCS5_PBE_SET 202
# define ASN1_F_PKCS5_PBE_SET0_ALGOR 215
# define ASN1_F_PKCS5_PBKDF2_SET 219
# define ASN1_F_PKCS5_SCRYPT_SET 232
# define ASN1_F_SMIME_READ_ASN1 212
# define ASN1_F_SMIME_TEXT 213
# define ASN1_F_STBL_MODULE_INIT 223
# define ASN1_F_X509_CRL_ADD0_REVOKED 169
# define ASN1_F_X509_INFO_NEW 170
# define ASN1_F_X509_NAME_ENCODE 203
# define ASN1_F_X509_NAME_EX_D2I 158
# define ASN1_F_X509_NAME_EX_NEW 171
# define ASN1_F_X509_PKEY_NEW 173
/* Reason codes. */
# define ASN1_R_ADDING_OBJECT 171
# define ASN1_R_ASN1_PARSE_ERROR 203
# define ASN1_R_ASN1_SIG_PARSE_ERROR 204
# define ASN1_R_AUX_ERROR 100
# define ASN1_R_BAD_OBJECT_HEADER 102
# define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214
# define ASN1_R_BN_LIB 105
# define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106
# define ASN1_R_BUFFER_TOO_SMALL 107
# define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108
# define ASN1_R_CONTEXT_NOT_INITIALISED 217
# define ASN1_R_DATA_IS_WRONG 109
# define ASN1_R_DECODE_ERROR 110
# define ASN1_R_DEPTH_EXCEEDED 174
# define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198
# define ASN1_R_ENCODE_ERROR 112
# define ASN1_R_ERROR_GETTING_TIME 173
# define ASN1_R_ERROR_LOADING_SECTION 172
# define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114
# define ASN1_R_EXPECTING_AN_INTEGER 115
# define ASN1_R_EXPECTING_AN_OBJECT 116
# define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119
# define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120
# define ASN1_R_FIELD_MISSING 121
# define ASN1_R_FIRST_NUM_TOO_LARGE 122
# define ASN1_R_HEADER_TOO_LONG 123
# define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175
# define ASN1_R_ILLEGAL_BOOLEAN 176
# define ASN1_R_ILLEGAL_CHARACTERS 124
# define ASN1_R_ILLEGAL_FORMAT 177
# define ASN1_R_ILLEGAL_HEX 178
# define ASN1_R_ILLEGAL_IMPLICIT_TAG 179
# define ASN1_R_ILLEGAL_INTEGER 180
# define ASN1_R_ILLEGAL_NEGATIVE_VALUE 226
# define ASN1_R_ILLEGAL_NESTED_TAGGING 181
# define ASN1_R_ILLEGAL_NULL 125
# define ASN1_R_ILLEGAL_NULL_VALUE 182
# define ASN1_R_ILLEGAL_OBJECT 183
# define ASN1_R_ILLEGAL_OPTIONAL_ANY 126
# define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170
# define ASN1_R_ILLEGAL_PADDING 221
# define ASN1_R_ILLEGAL_TAGGED_ANY 127
# define ASN1_R_ILLEGAL_TIME_VALUE 184
# define ASN1_R_ILLEGAL_ZERO_CONTENT 222
# define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185
# define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
# define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220
# define ASN1_R_INVALID_BMPSTRING_LENGTH 129
# define ASN1_R_INVALID_DIGIT 130
# define ASN1_R_INVALID_MIME_TYPE 205
# define ASN1_R_INVALID_MODIFIER 186
# define ASN1_R_INVALID_NUMBER 187
# define ASN1_R_INVALID_OBJECT_ENCODING 216
# define ASN1_R_INVALID_SCRYPT_PARAMETERS 227
# define ASN1_R_INVALID_SEPARATOR 131
# define ASN1_R_INVALID_STRING_TABLE_VALUE 218
# define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
# define ASN1_R_INVALID_UTF8STRING 134
# define ASN1_R_INVALID_VALUE 219
# define ASN1_R_LIST_ERROR 188
# define ASN1_R_MIME_NO_CONTENT_TYPE 206
# define ASN1_R_MIME_PARSE_ERROR 207
# define ASN1_R_MIME_SIG_PARSE_ERROR 208
# define ASN1_R_MISSING_EOC 137
# define ASN1_R_MISSING_SECOND_NUMBER 138
# define ASN1_R_MISSING_VALUE