change
parent
967811164f
commit
efbf147319
@ -1,5 +1,5 @@
|
|||||||
APP_OPTIM := release
|
APP_OPTIM := release
|
||||||
APP_ABI := armeabi-v7a x86 arm64-v8a
|
APP_ABI := armeabi-v7a x86 arm64-v8a
|
||||||
APP_STL := c++_static
|
APP_STL := c++_static
|
||||||
APP_PLATFORM := android-21
|
APP_PLATFORM := android-23
|
||||||
APP_PIE := false
|
APP_PIE := false
|
@ -0,0 +1,331 @@
|
|||||||
|
#include <RespJson.h>
|
||||||
|
|
||||||
|
bool RespJson::RespManage(char* str, string jsonStr)
|
||||||
|
{
|
||||||
|
Json::Reader reader;
|
||||||
|
Json::Value root;
|
||||||
|
string serviceId;
|
||||||
|
if (reader.parse(str, root))
|
||||||
|
{
|
||||||
|
serviceId = root["serviceId"].asString();
|
||||||
|
}
|
||||||
|
if(serviceId == "platformupgradeDevices" || serviceId == "platformLsuueConfigureFile" || serviceId == "getDeviceLogFile"
|
||||||
|
|| serviceId == "getDeviceData" || serviceId == "setDeviceTime" || serviceId == "setTransOnlineMonitConfig"
|
||||||
|
|| serviceId == "setFunctionConfiguration" || serviceId == "setIcingOnlineAlarmMonitConfig" || serviceId == "setPhotoParams"
|
||||||
|
|| serviceId == "SetAcceptCameraPhoto" || serviceId == "setCaptureTimesTaskParameter" || serviceId == "actionRestart"
|
||||||
|
|| serviceId == "cameraRemoteControl" || serviceId == "manualCapturePicture" || serviceId == "setMicroMeteorologicalAlarm")
|
||||||
|
{
|
||||||
|
jsonStr = CommonResp(str);
|
||||||
|
}else if(serviceId == "getDeviceLogList")
|
||||||
|
{
|
||||||
|
// getDeviceLogListResp
|
||||||
|
}
|
||||||
|
// else if...
|
||||||
|
}
|
||||||
|
|
||||||
|
string RespJson::CommonResp(char* str)
|
||||||
|
{
|
||||||
|
Json::Reader reader;
|
||||||
|
Json::Value root;
|
||||||
|
int mid;
|
||||||
|
if (reader.parse(str, root))
|
||||||
|
{
|
||||||
|
mid = root["mid"].asInt();
|
||||||
|
}
|
||||||
|
string jsonStr;
|
||||||
|
CommonJSON(jsonStr, 0, 0, mid);
|
||||||
|
return jsonStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RespJson::CommonJSON(string jsonStr, int resultCode, int errcode, int mid)
|
||||||
|
{
|
||||||
|
/*通用响应JSON*/
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value body;
|
||||||
|
body["resultCode"] = resultCode;
|
||||||
|
root["body"] = body;
|
||||||
|
root["errcode"] = errcode;
|
||||||
|
root["mid"] = mid;
|
||||||
|
root["msgType"] = "deviceRsp";
|
||||||
|
|
||||||
|
Json::StyledWriter writer;
|
||||||
|
jsonStr = writer.write(root);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RespJson::getDeviceLogListJSON(string jsonStr,DeviceLogList_JSON bodyData, int errcode, int mid)
|
||||||
|
{
|
||||||
|
/*查询终端设备日志列表*/
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value body;
|
||||||
|
body["resultCode"] = bodyData.resultCode;
|
||||||
|
body["fileCount"] = bodyData.fileCount;
|
||||||
|
Json::Value List;
|
||||||
|
for(int i = 0; i < bodyData.fileCount; i++)
|
||||||
|
{
|
||||||
|
Json::Value ListData;
|
||||||
|
ListData["fileType"] = bodyData.fileList[i].fileType;
|
||||||
|
ListData["fileName"] = bodyData.fileList[i].fileName;
|
||||||
|
ListData["time"] = static_cast<Json::Int64>(bodyData.fileList[i].time);
|
||||||
|
ListData["fileSize"] = bodyData.fileList[i].fileSize;
|
||||||
|
List.append(ListData);
|
||||||
|
}
|
||||||
|
body["fileList"] = List;
|
||||||
|
root["body"] = body;
|
||||||
|
root["errcode"] = errcode;
|
||||||
|
root["mid"] = mid;
|
||||||
|
root["msgType"] = "deviceRsp";
|
||||||
|
|
||||||
|
Json::StyledWriter writer;
|
||||||
|
jsonStr = writer.write(root);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RespJson::getDeviceTimeJSON(string jsonStr,DeviceTime_JSON bodyData, int errcode, int mid)
|
||||||
|
{
|
||||||
|
/*平台端查询终端设备的系统时间*/
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value body;
|
||||||
|
body["timingType"] = bodyData.timingType;
|
||||||
|
body["currentTime"] = static_cast<Json::Int64>(bodyData.currentTime);
|
||||||
|
root["body"] = body;
|
||||||
|
root["errcode"] = errcode;
|
||||||
|
root["mid"] = mid;
|
||||||
|
root["msgType"] = "deviceRsp";
|
||||||
|
|
||||||
|
Json::StyledWriter writer;
|
||||||
|
jsonStr = writer.write(root);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RespJson::getTransOnlineMonitConfigJSON(string jsonStr,TransOnlineMonitConfig_JSON bodyData, int errcode, int mid)
|
||||||
|
{
|
||||||
|
/*获取输电在线监测终端的运行状态参数*/
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value body;
|
||||||
|
body["heartbeatInterval"] = bodyData.heartbeatInterval;
|
||||||
|
body["sampleInterval"] = bodyData.sampleInterval;
|
||||||
|
body["sleepDuration"] = bodyData.sleepDuration;
|
||||||
|
body["onlineInterval"] = bodyData.onlineInterval;
|
||||||
|
Json::Value List;
|
||||||
|
for(int i = 0; i < 29; i++)
|
||||||
|
{
|
||||||
|
Json::Value ListData;
|
||||||
|
ListData["day"] = bodyData.restartTime[i].day;
|
||||||
|
ListData["hour"] = bodyData.restartTime[i].hour;
|
||||||
|
ListData["minute"] = bodyData.restartTime[i].minute;
|
||||||
|
List.append(ListData);
|
||||||
|
}
|
||||||
|
body["restartTime"] = List;
|
||||||
|
body["ipAddr"] = bodyData.ipAddr;
|
||||||
|
body["port"] = bodyData.port;
|
||||||
|
body["httpIp"] = bodyData.httpIp;
|
||||||
|
body["httpPort"] = bodyData.httpPort;
|
||||||
|
body["PwrMode"] = bodyData.PwrMode;
|
||||||
|
root["body"] = body;
|
||||||
|
root["errcode"] = errcode;
|
||||||
|
root["mid"] = mid;
|
||||||
|
root["msgType"] = "deviceRsp";
|
||||||
|
|
||||||
|
Json::StyledWriter writer;
|
||||||
|
jsonStr = writer.write(root);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RespJson::getFunctionConfigurationJSON(string jsonStr,FunctionConfiguration_JSON bodyData, int errcode, int mid)
|
||||||
|
{
|
||||||
|
/*获取装置功能配置*/
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value body;
|
||||||
|
Json::Value List;
|
||||||
|
Json::Value ListData;
|
||||||
|
ListData["function"] = bodyData.function;
|
||||||
|
ListData["mode"] = bodyData.mode;
|
||||||
|
List.append(ListData);
|
||||||
|
body["configure"] = List;
|
||||||
|
root["body"] = body;
|
||||||
|
root["errcode"] = errcode;
|
||||||
|
root["mid"] = mid;
|
||||||
|
root["msgType"] = "deviceRsp";
|
||||||
|
|
||||||
|
Json::StyledWriter writer;
|
||||||
|
jsonStr = writer.write(root);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RespJson::getIcingOnlineAlarmMonitConfigJSON(string jsonStr,IcingOnlineAlarmMonitConfig_JSON bodyData, int errcode, int mid)
|
||||||
|
{
|
||||||
|
/*获取设置覆冰在线监测终端的告警阈*/
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value body;
|
||||||
|
body["resultCode"] = bodyData.resultCode;
|
||||||
|
body["fileCount"] = bodyData.interval;
|
||||||
|
body["PullAAlarmThreshold"] = bodyData.PullAAlarmThreshold;
|
||||||
|
body["windAlarmThreshold"] = bodyData.windAlarmThreshold;
|
||||||
|
body["rainAlarmThreshold"] = bodyData.rainAlarmThreshold;
|
||||||
|
root["body"] = body;
|
||||||
|
root["errcode"] = errcode;
|
||||||
|
root["mid"] = mid;
|
||||||
|
root["msgType"] = "deviceRsp";
|
||||||
|
|
||||||
|
Json::StyledWriter writer;
|
||||||
|
jsonStr = writer.write(root);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RespJson::getPhotoParamsJSON(string jsonStr,PhotoParams_JSON bodyData, int errcode, int mid)
|
||||||
|
{
|
||||||
|
/*平台端查询终端设备图片配置信息*/
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value body;
|
||||||
|
body["channel"] = bodyData.channel;
|
||||||
|
body["color"] = bodyData.color;
|
||||||
|
body["brightness"] = bodyData.brightness;
|
||||||
|
body["contrast"] = bodyData.contrast;
|
||||||
|
body["saturation"] = bodyData.saturation;
|
||||||
|
root["body"] = body;
|
||||||
|
root["errcode"] = errcode;
|
||||||
|
root["mid"] = mid;
|
||||||
|
root["msgType"] = "deviceRsp";
|
||||||
|
|
||||||
|
Json::StyledWriter writer;
|
||||||
|
jsonStr = writer.write(root);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RespJson::getCaptureTimesTaskInformationJSON(string jsonStr,CaptureTimesTask_JSON bodyData, int errcode, int mid)
|
||||||
|
{
|
||||||
|
/*平台端查询终端设备定时抓拍任务信息*/
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value body;
|
||||||
|
body["channel"] = bodyData.channel;
|
||||||
|
body["color"] = bodyData.groupNumber;
|
||||||
|
Json::Value array;
|
||||||
|
body["paramArray"] = array;
|
||||||
|
root["body"] = body;
|
||||||
|
root["errcode"] = errcode;
|
||||||
|
root["mid"] = mid;
|
||||||
|
root["msgType"] = "deviceRsp";
|
||||||
|
|
||||||
|
Json::StyledWriter writer;
|
||||||
|
jsonStr = writer.write(root);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RespJson::getDeviceSolarPowerPropertiesJSON(string jsonStr,DeviceSolarPower_JSON bodyData, int errcode, int mid)
|
||||||
|
{
|
||||||
|
/*查询设备太阳能电池板状态数据*/
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value body;
|
||||||
|
body["batteryNumber"] = bodyData.batteryNumber;
|
||||||
|
body["time"] = static_cast<Json::Int64>(bodyData.time);
|
||||||
|
body["solarPanelVoltage"] = bodyData.solarPanelVoltage;
|
||||||
|
body["solarPanelCurrent"] = bodyData.solarPanelCurrent;
|
||||||
|
body["batteryVoltage"] = bodyData.batteryVoltage;
|
||||||
|
body["batteryCurrent"] = bodyData.batteryCurrent;
|
||||||
|
body["loadVoltage"] = bodyData.loadVoltage;
|
||||||
|
body["loadCurrent"] = bodyData.loadCurrent;
|
||||||
|
body["remainingBatteryPower"] = bodyData.remainingBatteryPower;
|
||||||
|
body["batteryTemperature"] = bodyData.batteryTemperature;
|
||||||
|
body["batteryChargeStatus"] = bodyData.batteryChargeStatus;
|
||||||
|
root["body"] = body;
|
||||||
|
root["errcode"] = errcode;
|
||||||
|
root["mid"] = mid;
|
||||||
|
root["msgType"] = "deviceRsp";
|
||||||
|
|
||||||
|
Json::StyledWriter writer;
|
||||||
|
jsonStr = writer.write(root);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RespJson::getWeatherMonitoringJSON(string jsonStr,Weather_JSON bodyData, int errcode, int mid)
|
||||||
|
{
|
||||||
|
/*查询终端微气象数据*/
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value body;
|
||||||
|
body["resultCode"] = bodyData.resultCode;
|
||||||
|
body["fileCount"] = bodyData.packageNum;
|
||||||
|
Json::Value List;
|
||||||
|
for(int i = 0; i < bodyData.packageNum; i++)
|
||||||
|
{
|
||||||
|
Json::Value ListData;
|
||||||
|
ListData["time"] = static_cast<Json::Int64>(bodyData.fileList[i].time);
|
||||||
|
ListData["Temperature"] = bodyData.fileList[i].Temperature;
|
||||||
|
ListData["humidity"] = bodyData.fileList[i].humidity;
|
||||||
|
ListData["airPressure"] = bodyData.fileList[i].airPressure;
|
||||||
|
ListData["instanWindSpeed"] = bodyData.fileList[i].instanWindSpeed;
|
||||||
|
ListData["aveWindSspeed1"] = bodyData.fileList[i].aveWindSspeed1;
|
||||||
|
ListData["aveWindSspeed10"] = bodyData.fileList[i].aveWindSspeed10;
|
||||||
|
ListData["maxWindSpeed10"] = bodyData.fileList[i].maxWindSpeed10;
|
||||||
|
ListData["aveMaxWindSpeed10"] = bodyData.fileList[i].aveMaxWindSpeed10;
|
||||||
|
ListData["extremeWindSpeed"] = bodyData.fileList[i].extremeWindSpeed;
|
||||||
|
ListData["instanWindDirection"] = bodyData.fileList[i].instanWindDirection;
|
||||||
|
ListData["aveWindDirection1"] = bodyData.fileList[i].aveWindDirection1;
|
||||||
|
ListData["aveWindDirection10"] = bodyData.fileList[i].aveWindDirection10;
|
||||||
|
ListData["extremeWindDirection"] = bodyData.fileList[i].extremeWindDirection;
|
||||||
|
ListData["radiationIntensity"] = bodyData.fileList[i].radiationIntensity;
|
||||||
|
ListData["precipitation1"] = bodyData.fileList[i].precipitation1;
|
||||||
|
ListData["precipitation6"] = bodyData.fileList[i].precipitation6;
|
||||||
|
ListData["precipitation12"] = bodyData.fileList[i].precipitation12;
|
||||||
|
ListData["precipitation24"] = bodyData.fileList[i].precipitation24;
|
||||||
|
List.append(ListData);
|
||||||
|
}
|
||||||
|
body["dataList"] = List;
|
||||||
|
root["body"] = body;
|
||||||
|
root["errcode"] = errcode;
|
||||||
|
root["mid"] = mid;
|
||||||
|
root["msgType"] = "deviceRsp";
|
||||||
|
|
||||||
|
Json::StyledWriter writer;
|
||||||
|
jsonStr = writer.write(root);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RespJson::getPullAndAngleMonitoringJSON(string jsonStr,PullAndAngle_JSON bodyData, int errcode, int mid)
|
||||||
|
{
|
||||||
|
/*查询终端拉力倾角监测*/
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value body;
|
||||||
|
body["resultCode"] = bodyData.resultCode;
|
||||||
|
body["type"] = bodyData.type;
|
||||||
|
body["number"] = bodyData.number;
|
||||||
|
Json::Value List;
|
||||||
|
for(int i = 0; i < bodyData.number; i++)
|
||||||
|
{
|
||||||
|
Json::Value ListData;
|
||||||
|
ListData["time"] = static_cast<Json::Int64>(bodyData.fileList[i].time);
|
||||||
|
ListData["maxPull"] = bodyData.fileList[i].maxPull;
|
||||||
|
ListData["fileName"] = bodyData.fileList[i].maxPullOblique;
|
||||||
|
ListData["maxPullOblique"] = bodyData.fileList[i].maxPullWind;
|
||||||
|
ListData["equalIceThickness"] = bodyData.fileList[i].equalIceThickness;
|
||||||
|
List.append(ListData);
|
||||||
|
}
|
||||||
|
body["dataList"] = List;
|
||||||
|
root["body"] = body;
|
||||||
|
root["errcode"] = errcode;
|
||||||
|
root["mid"] = mid;
|
||||||
|
root["msgType"] = "deviceRsp";
|
||||||
|
|
||||||
|
Json::StyledWriter writer;
|
||||||
|
jsonStr = writer.write(root);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RespJson::getMicroMeteorologicalAlarmJSON(string jsonStr,Alarm_JSON bodyData, int errcode, int mid)
|
||||||
|
{
|
||||||
|
/*查询终端设备的微气象告警阈值*/
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value body;
|
||||||
|
body["level"] = bodyData.level;
|
||||||
|
body["interval"] = bodyData.interval;
|
||||||
|
body["windSpeedAlarm"] = bodyData.windSpeedAlarm;
|
||||||
|
body["precipitationAlarm"] = bodyData.precipitationAlarm;
|
||||||
|
root["body"] = body;
|
||||||
|
root["errcode"] = errcode;
|
||||||
|
root["mid"] = mid;
|
||||||
|
root["msgType"] = "deviceRsp";
|
||||||
|
|
||||||
|
Json::StyledWriter writer;
|
||||||
|
jsonStr = writer.write(root);
|
||||||
|
return true;
|
||||||
|
}
|
@ -0,0 +1,153 @@
|
|||||||
|
#ifndef MQTT_CLIENT_ANDROID_RESPJSON_H
|
||||||
|
#define MQTT_CLIENT_ANDROID_RESPJSON_H
|
||||||
|
#include <json/json.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
typedef struct DeviceLogList_JSON
|
||||||
|
{
|
||||||
|
int resultCode;
|
||||||
|
int fileCount;
|
||||||
|
struct file_List
|
||||||
|
{
|
||||||
|
int fileType;
|
||||||
|
string fileName;
|
||||||
|
time_t time;
|
||||||
|
int fileSize;
|
||||||
|
}fileList[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct DeviceTime_JSON
|
||||||
|
{
|
||||||
|
int timingType;
|
||||||
|
time_t currentTime;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct TransOnlineMonitConfig_JSON
|
||||||
|
{
|
||||||
|
int heartbeatInterval;
|
||||||
|
int sampleInterval;
|
||||||
|
int sleepDuration;
|
||||||
|
int onlineInterval;
|
||||||
|
struct restart_Time
|
||||||
|
{
|
||||||
|
int day;
|
||||||
|
int hour;
|
||||||
|
int minute;
|
||||||
|
}restartTime[29];
|
||||||
|
string ipAddr;
|
||||||
|
int port;
|
||||||
|
string httpIp;
|
||||||
|
int httpPort;
|
||||||
|
int PwrMode;
|
||||||
|
};
|
||||||
|
typedef struct FunctionConfiguration_JSON
|
||||||
|
{
|
||||||
|
string function;
|
||||||
|
int mode;
|
||||||
|
};
|
||||||
|
typedef struct IcingOnlineAlarmMonitConfig_JSON
|
||||||
|
{
|
||||||
|
int resultCode;
|
||||||
|
int interval;
|
||||||
|
float PullAAlarmThreshold;
|
||||||
|
float windAlarmThreshold;
|
||||||
|
float rainAlarmThreshold;
|
||||||
|
};
|
||||||
|
typedef struct PhotoParams_JSON
|
||||||
|
{
|
||||||
|
int channel;
|
||||||
|
int color;
|
||||||
|
int brightness;
|
||||||
|
int contrast;
|
||||||
|
int saturation;
|
||||||
|
};
|
||||||
|
typedef struct CaptureTimesTask_JSON
|
||||||
|
{
|
||||||
|
int channel;
|
||||||
|
int groupNumber;
|
||||||
|
};
|
||||||
|
typedef struct DeviceSolarPower_JSON
|
||||||
|
{
|
||||||
|
int batteryNumber;
|
||||||
|
time_t time;
|
||||||
|
float solarPanelVoltage;
|
||||||
|
float solarPanelCurrent;
|
||||||
|
float batteryVoltage;
|
||||||
|
float batteryCurrent;
|
||||||
|
float loadVoltage;
|
||||||
|
float loadCurrent;
|
||||||
|
int remainingBatteryPower;
|
||||||
|
float batteryTemperature;
|
||||||
|
int batteryChargeStatus;
|
||||||
|
};
|
||||||
|
typedef struct Weather_JSON
|
||||||
|
{
|
||||||
|
int resultCode;
|
||||||
|
int packageNum;
|
||||||
|
struct file_List
|
||||||
|
{
|
||||||
|
time_t time;
|
||||||
|
float Temperature;
|
||||||
|
float humidity;
|
||||||
|
float airPressure;
|
||||||
|
float instanWindSpeed;
|
||||||
|
float aveWindSspeed1;
|
||||||
|
float aveWindSspeed10;
|
||||||
|
float maxWindSpeed10;
|
||||||
|
float aveMaxWindSpeed10;
|
||||||
|
float extremeWindSpeed;
|
||||||
|
float instanWindDirection;
|
||||||
|
float aveWindDirection1;
|
||||||
|
float aveWindDirection10;
|
||||||
|
float extremeWindDirection;
|
||||||
|
float radiationIntensity;
|
||||||
|
float precipitation1;
|
||||||
|
float precipitation6;
|
||||||
|
float precipitation12;
|
||||||
|
float precipitation24;
|
||||||
|
}fileList[1];
|
||||||
|
};
|
||||||
|
typedef struct PullAndAngle_JSON
|
||||||
|
{
|
||||||
|
int resultCode;
|
||||||
|
int type;
|
||||||
|
int number;
|
||||||
|
struct file_List
|
||||||
|
{
|
||||||
|
time_t time;
|
||||||
|
float maxPull;
|
||||||
|
float maxPullOblique;
|
||||||
|
float maxPullWind;
|
||||||
|
float equalIceThickness;
|
||||||
|
}fileList[1];
|
||||||
|
};
|
||||||
|
typedef struct Alarm_JSON
|
||||||
|
{
|
||||||
|
int level;
|
||||||
|
int interval;
|
||||||
|
float windSpeedAlarm;
|
||||||
|
float precipitationAlarm;
|
||||||
|
};
|
||||||
|
|
||||||
|
class RespJson {
|
||||||
|
bool RespManage(char* str, string jsonStr);
|
||||||
|
string CommonResp(char* str);
|
||||||
|
|
||||||
|
|
||||||
|
bool CommonJSON(string jsonStr, int resultCode, int errcode, int mid);
|
||||||
|
bool getDeviceLogListJSON(string jsonStr,DeviceLogList_JSON bodyData, int errcode, int mid);
|
||||||
|
bool getDeviceTimeJSON(string jsonStr,DeviceTime_JSON bodyData, int errcode, int mid);
|
||||||
|
bool getTransOnlineMonitConfigJSON(string jsonStr,TransOnlineMonitConfig_JSON bodyData, int errcode, int mid);
|
||||||
|
bool getFunctionConfigurationJSON(string jsonStr,FunctionConfiguration_JSON bodyData, int errcode, int mid);
|
||||||
|
bool getIcingOnlineAlarmMonitConfigJSON(string jsonStr,IcingOnlineAlarmMonitConfig_JSON bodyData, int errcode, int mid);
|
||||||
|
bool getPhotoParamsJSON(string jsonStr,PhotoParams_JSON bodyData, int errcode, int mid);
|
||||||
|
bool getCaptureTimesTaskInformationJSON(string jsonStr,CaptureTimesTask_JSON bodyData, int errcode, int mid);
|
||||||
|
bool getDeviceSolarPowerPropertiesJSON(string jsonStr,DeviceSolarPower_JSON bodyData, int errcode, int mid);
|
||||||
|
bool getWeatherMonitoringJSON(string jsonStr,Weather_JSON bodyData, int errcode, int mid);
|
||||||
|
bool getPullAndAngleMonitoringJSON(string jsonStr,PullAndAngle_JSON bodyData, int errcode, int mid);
|
||||||
|
bool getMicroMeteorologicalAlarmJSON(string jsonStr,Alarm_JSON bodyData, int errcode, int mid);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //MQTT_CLIENT_ANDROID_RESPJSON_H
|
@ -0,0 +1,89 @@
|
|||||||
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
// Distributed under MIT license, or public domain if desired and
|
||||||
|
// recognized in your jurisdiction.
|
||||||
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
#ifndef JSON_ALLOCATOR_H_INCLUDED
|
||||||
|
#define JSON_ALLOCATOR_H_INCLUDED
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
namespace Json {
|
||||||
|
template <typename T> class SecureAllocator {
|
||||||
|
public:
|
||||||
|
// Type definitions
|
||||||
|
using value_type = T;
|
||||||
|
using pointer = T*;
|
||||||
|
using const_pointer = const T*;
|
||||||
|
using reference = T&;
|
||||||
|
using const_reference = const T&;
|
||||||
|
using size_type = std::size_t;
|
||||||
|
using difference_type = std::ptrdiff_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate memory for N items using the standard allocator.
|
||||||
|
*/
|
||||||
|
pointer allocate(size_type n) {
|
||||||
|
// allocate using "global operator new"
|
||||||
|
return static_cast<pointer>(::operator new(n * sizeof(T)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release memory which was allocated for N items at pointer P.
|
||||||
|
*
|
||||||
|
* The memory block is filled with zeroes before being released.
|
||||||
|
*/
|
||||||
|
void deallocate(pointer p, size_type n) {
|
||||||
|
// memset_s is used because memset may be optimized away by the compiler
|
||||||
|
memset_s(p, n * sizeof(T), 0, n * sizeof(T));
|
||||||
|
// free using "global operator delete"
|
||||||
|
::operator delete(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct an item in-place at pointer P.
|
||||||
|
*/
|
||||||
|
template <typename... Args> void construct(pointer p, Args&&... args) {
|
||||||
|
// construct using "placement new" and "perfect forwarding"
|
||||||
|
::new (static_cast<void*>(p)) T(std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_type max_size() const { return size_t(-1) / sizeof(T); }
|
||||||
|
|
||||||
|
pointer address(reference x) const { return std::addressof(x); }
|
||||||
|
|
||||||
|
const_pointer address(const_reference x) const { return std::addressof(x); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy an item in-place at pointer P.
|
||||||
|
*/
|
||||||
|
void destroy(pointer p) {
|
||||||
|
// destroy using "explicit destructor"
|
||||||
|
p->~T();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Boilerplate
|
||||||
|
SecureAllocator() {}
|
||||||
|
template <typename U> SecureAllocator(const SecureAllocator<U>&) {}
|
||||||
|
template <typename U> struct rebind { using other = SecureAllocator<U>; };
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
bool operator==(const SecureAllocator<T>&, const SecureAllocator<U>&) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Json
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
#endif // JSON_ALLOCATOR_H_INCLUDED
|
@ -0,0 +1,61 @@
|
|||||||
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
// Distributed under MIT license, or public domain if desired and
|
||||||
|
// recognized in your jurisdiction.
|
||||||
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
#ifndef JSON_ASSERTIONS_H_INCLUDED
|
||||||
|
#define JSON_ASSERTIONS_H_INCLUDED
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
#include "config.h"
|
||||||
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
|
||||||
|
/** It should not be possible for a maliciously designed file to
|
||||||
|
* cause an abort() or seg-fault, so these macros are used only
|
||||||
|
* for pre-condition violations and internal logic errors.
|
||||||
|
*/
|
||||||
|
#if JSON_USE_EXCEPTION
|
||||||
|
|
||||||
|
// @todo <= add detail about condition in exception
|
||||||
|
#define JSON_ASSERT(condition) \
|
||||||
|
do { \
|
||||||
|
if (!(condition)) { \
|
||||||
|
Json::throwLogicError("assert json failed"); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define JSON_FAIL_MESSAGE(message) \
|
||||||
|
do { \
|
||||||
|
OStringStream oss; \
|
||||||
|
oss << message; \
|
||||||
|
Json::throwLogicError(oss.str()); \
|
||||||
|
abort(); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#else // JSON_USE_EXCEPTION
|
||||||
|
|
||||||
|
#define JSON_ASSERT(condition) assert(condition)
|
||||||
|
|
||||||
|
// The call to assert() will show the failure message in debug builds. In
|
||||||
|
// release builds we abort, for a core-dump or debugger.
|
||||||
|
#define JSON_FAIL_MESSAGE(message) \
|
||||||
|
{ \
|
||||||
|
OStringStream oss; \
|
||||||
|
oss << message; \
|
||||||
|
assert(false && oss.str().c_str()); \
|
||||||
|
abort(); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define JSON_ASSERT_MESSAGE(condition, message) \
|
||||||
|
do { \
|
||||||
|
if (!(condition)) { \
|
||||||
|
JSON_FAIL_MESSAGE(message); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#endif // JSON_ASSERTIONS_H_INCLUDED
|
@ -0,0 +1,150 @@
|
|||||||
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
// Distributed under MIT license, or public domain if desired and
|
||||||
|
// recognized in your jurisdiction.
|
||||||
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
#ifndef JSON_CONFIG_H_INCLUDED
|
||||||
|
#define JSON_CONFIG_H_INCLUDED
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <istream>
|
||||||
|
#include <memory>
|
||||||
|
#include <ostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
// If non-zero, the library uses exceptions to report bad input instead of C
|
||||||
|
// assertion macros. The default is to use exceptions.
|
||||||
|
#ifndef JSON_USE_EXCEPTION
|
||||||
|
#define JSON_USE_EXCEPTION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Temporary, tracked for removal with issue #982.
|
||||||
|
#ifndef JSON_USE_NULLREF
|
||||||
|
#define JSON_USE_NULLREF 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// If defined, indicates that the source file is amalgamated
|
||||||
|
/// to prevent private header inclusion.
|
||||||
|
/// Remarks: it is automatically defined in the generated amalgamated header.
|
||||||
|
// #define JSON_IS_AMALGAMATION
|
||||||
|
|
||||||
|
// Export macros for DLL visibility
|
||||||
|
#if defined(JSON_DLL_BUILD)
|
||||||
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
|
#define JSON_API __declspec(dllexport)
|
||||||
|
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
|
||||||
|
#elif defined(__GNUC__) || defined(__clang__)
|
||||||
|
#define JSON_API __attribute__((visibility("default")))
|
||||||
|
#endif // if defined(_MSC_VER)
|
||||||
|
|
||||||
|
#elif defined(JSON_DLL)
|
||||||
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
|
#define JSON_API __declspec(dllimport)
|
||||||
|
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
|
||||||
|
#endif // if defined(_MSC_VER)
|
||||||
|
#endif // ifdef JSON_DLL_BUILD
|
||||||
|
|
||||||
|
#if !defined(JSON_API)
|
||||||
|
#define JSON_API
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER < 1800
|
||||||
|
#error \
|
||||||
|
"ERROR: Visual Studio 12 (2013) with _MSC_VER=1800 is the oldest supported compiler with sufficient C++11 capabilities"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||||
|
// As recommended at
|
||||||
|
// https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
|
||||||
|
extern JSON_API int msvc_pre1900_c99_snprintf(char* outBuf, size_t size,
|
||||||
|
const char* format, ...);
|
||||||
|
#define jsoncpp_snprintf msvc_pre1900_c99_snprintf
|
||||||
|
#else
|
||||||
|
#define jsoncpp_snprintf std::snprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
|
||||||
|
// integer
|
||||||
|
// Storages, and 64 bits integer support is disabled.
|
||||||
|
// #define JSON_NO_INT64 1
|
||||||
|
|
||||||
|
// JSONCPP_OVERRIDE is maintained for backwards compatibility of external tools.
|
||||||
|
// C++11 should be used directly in JSONCPP.
|
||||||
|
#define JSONCPP_OVERRIDE override
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#if __has_extension(attribute_deprecated_with_message)
|
||||||
|
#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
|
||||||
|
#endif
|
||||||
|
#elif defined(__GNUC__) // not clang (gcc comes later since clang emulates gcc)
|
||||||
|
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
|
||||||
|
#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
|
||||||
|
#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
||||||
|
#define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
|
||||||
|
#endif // GNUC version
|
||||||
|
#elif defined(_MSC_VER) // MSVC (after clang because clang on Windows emulates
|
||||||
|
// MSVC)
|
||||||
|
#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
|
||||||
|
#endif // __clang__ || __GNUC__ || _MSC_VER
|
||||||
|
|
||||||
|
#if !defined(JSONCPP_DEPRECATED)
|
||||||
|
#define JSONCPP_DEPRECATED(message)
|
||||||
|
#endif // if !defined(JSONCPP_DEPRECATED)
|
||||||
|
|
||||||
|
#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6))
|
||||||
|
#define JSON_USE_INT64_DOUBLE_CONVERSION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
|
||||||
|
#include "allocator.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
|
||||||
|
namespace Json {
|
||||||
|
using Int = int;
|
||||||
|
using UInt = unsigned int;
|
||||||
|
#if defined(JSON_NO_INT64)
|
||||||
|
using LargestInt = int;
|
||||||
|
using LargestUInt = unsigned int;
|
||||||
|
#undef JSON_HAS_INT64
|
||||||
|
#else // if defined(JSON_NO_INT64)
|
||||||
|
// For Microsoft Visual use specific types as long long is not supported
|
||||||
|
#if defined(_MSC_VER) // Microsoft Visual Studio
|
||||||
|
using Int64 = __int64;
|
||||||
|
using UInt64 = unsigned __int64;
|
||||||
|
#else // if defined(_MSC_VER) // Other platforms, use long long
|
||||||
|
using Int64 = int64_t;
|
||||||
|
using UInt64 = uint64_t;
|
||||||
|
#endif // if defined(_MSC_VER)
|
||||||
|
using LargestInt = Int64;
|
||||||
|
using LargestUInt = UInt64;
|
||||||
|
#define JSON_HAS_INT64
|
||||||
|
#endif // if defined(JSON_NO_INT64)
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
using Allocator =
|
||||||
|
typename std::conditional<JSONCPP_USING_SECURE_MEMORY, SecureAllocator<T>,
|
||||||
|
std::allocator<T>>::type;
|
||||||
|
using String = std::basic_string<char, std::char_traits<char>, Allocator<char>>;
|
||||||
|
using IStringStream =
|
||||||
|
std::basic_istringstream<String::value_type, String::traits_type,
|
||||||
|
String::allocator_type>;
|
||||||
|
using OStringStream =
|
||||||
|
std::basic_ostringstream<String::value_type, String::traits_type,
|
||||||
|
String::allocator_type>;
|
||||||
|
using IStream = std::istream;
|
||||||
|
using OStream = std::ostream;
|
||||||
|
} // namespace Json
|
||||||
|
|
||||||
|
// Legacy names (formerly macros).
|
||||||
|
using JSONCPP_STRING = Json::String;
|
||||||
|
using JSONCPP_ISTRINGSTREAM = Json::IStringStream;
|
||||||
|
using JSONCPP_OSTRINGSTREAM = Json::OStringStream;
|
||||||
|
using JSONCPP_ISTREAM = Json::IStream;
|
||||||
|
using JSONCPP_OSTREAM = Json::OStream;
|
||||||
|
|
||||||
|
#endif // JSON_CONFIG_H_INCLUDED
|
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
// Distributed under MIT license, or public domain if desired and
|
||||||
|
// recognized in your jurisdiction.
|
||||||
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
#ifndef JSON_FORWARDS_H_INCLUDED
|
||||||
|
#define JSON_FORWARDS_H_INCLUDED
|
||||||
|
|
||||||
|
#if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
#include "config.h"
|
||||||
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
|
||||||
|
namespace Json {
|
||||||
|
|
||||||
|
// writer.h
|
||||||
|
class StreamWriter;
|
||||||
|
class StreamWriterBuilder;
|
||||||
|
class Writer;
|
||||||
|
class FastWriter;
|
||||||
|
class StyledWriter;
|
||||||
|
class StyledStreamWriter;
|
||||||
|
|
||||||
|
// reader.h
|
||||||
|
class Reader;
|
||||||
|
class CharReader;
|
||||||
|
class CharReaderBuilder;
|
||||||
|
|
||||||
|
// json_features.h
|
||||||
|
class Features;
|
||||||
|
|
||||||
|
// value.h
|
||||||
|
using ArrayIndex = unsigned int;
|
||||||
|
class StaticString;
|
||||||
|
class Path;
|
||||||
|
class PathArgument;
|
||||||
|
class Value;
|
||||||
|
class ValueIteratorBase;
|
||||||
|
class ValueIterator;
|
||||||
|
class ValueConstIterator;
|
||||||
|
|
||||||
|
} // namespace Json
|
||||||
|
|
||||||
|
#endif // JSON_FORWARDS_H_INCLUDED
|
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
// Distributed under MIT license, or public domain if desired and
|
||||||
|
// recognized in your jurisdiction.
|
||||||
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
#ifndef JSON_JSON_H_INCLUDED
|
||||||
|
#define JSON_JSON_H_INCLUDED
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "json_features.h"
|
||||||
|
#include "reader.h"
|
||||||
|
#include "value.h"
|
||||||
|
#include "writer.h"
|
||||||
|
|
||||||
|
#endif // JSON_JSON_H_INCLUDED
|
@ -0,0 +1,62 @@
|
|||||||
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
// Distributed under MIT license, or public domain if desired and
|
||||||
|
// recognized in your jurisdiction.
|
||||||
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
#ifndef JSON_FEATURES_H_INCLUDED
|
||||||
|
#define JSON_FEATURES_H_INCLUDED
|
||||||
|
|
||||||
|
#if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
#include "forwards.h"
|
||||||
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
namespace Json {
|
||||||
|
|
||||||
|
/** \brief Configuration passed to reader and writer.
|
||||||
|
* This configuration object can be used to force the Reader or Writer
|
||||||
|
* to behave in a standard conforming way.
|
||||||
|
*/
|
||||||
|
class JSON_API Features {
|
||||||
|
public:
|
||||||
|
/** \brief A configuration that allows all features and assumes all strings
|
||||||
|
* are UTF-8.
|
||||||
|
* - C & C++ comments are allowed
|
||||||
|
* - Root object can be any JSON value
|
||||||
|
* - Assumes Value strings are encoded in UTF-8
|
||||||
|
*/
|
||||||
|
static Features all();
|
||||||
|
|
||||||
|
/** \brief A configuration that is strictly compatible with the JSON
|
||||||
|
* specification.
|
||||||
|
* - Comments are forbidden.
|
||||||
|
* - Root object must be either an array or an object value.
|
||||||
|
* - Assumes Value strings are encoded in UTF-8
|
||||||
|
*/
|
||||||
|
static Features strictMode();
|
||||||
|
|
||||||
|
/** \brief Initialize the configuration like JsonConfig::allFeatures;
|
||||||
|
*/
|
||||||
|
Features();
|
||||||
|
|
||||||
|
/// \c true if comments are allowed. Default: \c true.
|
||||||
|
bool allowComments_{true};
|
||||||
|
|
||||||
|
/// \c true if root must be either an array or an object value. Default: \c
|
||||||
|
/// false.
|
||||||
|
bool strictRoot_{false};
|
||||||
|
|
||||||
|
/// \c true if dropped null placeholders are allowed. Default: \c false.
|
||||||
|
bool allowDroppedNullPlaceholders_{false};
|
||||||
|
|
||||||
|
/// \c true if numeric object key are allowed. Default: \c false.
|
||||||
|
bool allowNumericKeys_{false};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Json
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
#endif // JSON_FEATURES_H_INCLUDED
|
@ -0,0 +1,406 @@
|
|||||||
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
// Distributed under MIT license, or public domain if desired and
|
||||||
|
// recognized in your jurisdiction.
|
||||||
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
#ifndef JSON_READER_H_INCLUDED
|
||||||
|
#define JSON_READER_H_INCLUDED
|
||||||
|
|
||||||
|
#if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
#include "json_features.h"
|
||||||
|
#include "value.h"
|
||||||
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
#include <deque>
|
||||||
|
#include <iosfwd>
|
||||||
|
#include <istream>
|
||||||
|
#include <stack>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
|
||||||
|
// be used by...
|
||||||
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4251)
|
||||||
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
namespace Json {
|
||||||
|
|
||||||
|
/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a
|
||||||
|
* Value.
|
||||||
|
*
|
||||||
|
* \deprecated Use CharReader and CharReaderBuilder.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class JSON_API Reader {
|
||||||
|
public:
|
||||||
|
using Char = char;
|
||||||
|
using Location = const Char*;
|
||||||
|
|
||||||
|
/** \brief An error tagged with where in the JSON text it was encountered.
|
||||||
|
*
|
||||||
|
* The offsets give the [start, limit) range of bytes within the text. Note
|
||||||
|
* that this is bytes, not codepoints.
|
||||||
|
*/
|
||||||
|
struct StructuredError {
|
||||||
|
ptrdiff_t offset_start;
|
||||||
|
ptrdiff_t offset_limit;
|
||||||
|
String message;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Constructs a Reader allowing all features for parsing.
|
||||||
|
* \deprecated Use CharReader and CharReaderBuilder.
|
||||||
|
*/
|
||||||
|
Reader();
|
||||||
|
|
||||||
|
/** \brief Constructs a Reader allowing the specified feature set for parsing.
|
||||||
|
* \deprecated Use CharReader and CharReaderBuilder.
|
||||||
|
*/
|
||||||
|
Reader(const Features& features);
|
||||||
|
|
||||||
|
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
|
||||||
|
* document.
|
||||||
|
*
|
||||||
|
* \param document UTF-8 encoded string containing the document
|
||||||
|
* to read.
|
||||||
|
* \param[out] root Contains the root value of the document if it
|
||||||
|
* was successfully parsed.
|
||||||
|
* \param collectComments \c true to collect comment and allow writing
|
||||||
|
* them back during serialization, \c false to
|
||||||
|
* discard comments. This parameter is ignored
|
||||||
|
* if Features::allowComments_ is \c false.
|
||||||
|
* \return \c true if the document was successfully parsed, \c false if an
|
||||||
|
* error occurred.
|
||||||
|
*/
|
||||||
|
bool parse(const std::string& document, Value& root,
|
||||||
|
bool collectComments = true);
|
||||||
|
|
||||||
|
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
|
||||||
|
* document.
|
||||||
|
*
|
||||||
|
* \param beginDoc Pointer on the beginning of the UTF-8 encoded
|
||||||
|
* string of the document to read.
|
||||||
|
* \param endDoc Pointer on the end of the UTF-8 encoded string
|
||||||
|
* of the document to read. Must be >= beginDoc.
|
||||||
|
* \param[out] root Contains the root value of the document if it
|
||||||
|
* was successfully parsed.
|
||||||
|
* \param collectComments \c true to collect comment and allow writing
|
||||||
|
* them back during serialization, \c false to
|
||||||
|
* discard comments. This parameter is ignored
|
||||||
|
* if Features::allowComments_ is \c false.
|
||||||
|
* \return \c true if the document was successfully parsed, \c false if an
|
||||||
|
* error occurred.
|
||||||
|
*/
|
||||||
|
bool parse(const char* beginDoc, const char* endDoc, Value& root,
|
||||||
|
bool collectComments = true);
|
||||||
|
|
||||||
|
/// \brief Parse from input stream.
|
||||||
|
/// \see Json::operator>>(std::istream&, Json::Value&).
|
||||||
|
bool parse(IStream& is, Value& root, bool collectComments = true);
|
||||||
|
|
||||||
|
/** \brief Returns a user friendly string that list errors in the parsed
|
||||||
|
* document.
|
||||||
|
*
|
||||||
|
* \return Formatted error message with the list of errors with their
|
||||||
|
* location in the parsed document. An empty string is returned if no error
|
||||||
|
* occurred during parsing.
|
||||||
|
* \deprecated Use getFormattedErrorMessages() instead (typo fix).
|
||||||
|
*/
|
||||||
|
JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.")
|
||||||
|
String getFormatedErrorMessages() const;
|
||||||
|
|
||||||
|
/** \brief Returns a user friendly string that list errors in the parsed
|
||||||
|
* document.
|
||||||
|
*
|
||||||
|
* \return Formatted error message with the list of errors with their
|
||||||
|
* location in the parsed document. An empty string is returned if no error
|
||||||
|
* occurred during parsing.
|
||||||
|
*/
|
||||||
|
String getFormattedErrorMessages() const;
|
||||||
|
|
||||||
|
/** \brief Returns a vector of structured errors encountered while parsing.
|
||||||
|
*
|
||||||
|
* \return A (possibly empty) vector of StructuredError objects. Currently
|
||||||
|
* only one error can be returned, but the caller should tolerate multiple
|
||||||
|
* errors. This can occur if the parser recovers from a non-fatal parse
|
||||||
|
* error and then encounters additional errors.
|
||||||
|
*/
|
||||||
|
std::vector<StructuredError> getStructuredErrors() const;
|
||||||
|
|
||||||
|
/** \brief Add a semantic error message.
|
||||||
|
*
|
||||||
|
* \param value JSON Value location associated with the error
|
||||||
|
* \param message The error message.
|
||||||
|
* \return \c true if the error was successfully added, \c false if the Value
|
||||||
|
* offset exceeds the document size.
|
||||||
|
*/
|
||||||
|
bool pushError(const Value& value, const String& message);
|
||||||
|
|
||||||
|
/** \brief Add a semantic error message with extra context.
|
||||||
|
*
|
||||||
|
* \param value JSON Value location associated with the error
|
||||||
|
* \param message The error message.
|
||||||
|
* \param extra Additional JSON Value location to contextualize the error
|
||||||
|
* \return \c true if the error was successfully added, \c false if either
|
||||||
|
* Value offset exceeds the document size.
|
||||||
|
*/
|
||||||
|
bool pushError(const Value& value, const String& message, const Value& extra);
|
||||||
|
|
||||||
|
/** \brief Return whether there are any errors.
|
||||||
|
*
|
||||||
|
* \return \c true if there are no errors to report \c false if errors have
|
||||||
|
* occurred.
|
||||||
|
*/
|
||||||
|
bool good() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum TokenType {
|
||||||
|
tokenEndOfStream = 0,
|
||||||
|
tokenObjectBegin,
|
||||||
|
tokenObjectEnd,
|
||||||
|
tokenArrayBegin,
|
||||||
|
tokenArrayEnd,
|
||||||
|
tokenString,
|
||||||
|
tokenNumber,
|
||||||
|
tokenTrue,
|
||||||
|
tokenFalse,
|
||||||
|
tokenNull,
|
||||||
|
tokenArraySeparator,
|
||||||
|
tokenMemberSeparator,
|
||||||
|
tokenComment,
|
||||||
|
tokenError
|
||||||
|
};
|
||||||
|
|
||||||
|
class Token {
|
||||||
|
public:
|
||||||
|
TokenType type_;
|
||||||
|
Location start_;
|
||||||
|
Location end_;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ErrorInfo {
|
||||||
|
public:
|
||||||
|
Token token_;
|
||||||
|
String message_;
|
||||||
|
Location extra_;
|
||||||
|
};
|
||||||
|
|
||||||
|
using Errors = std::deque<ErrorInfo>;
|
||||||
|
|
||||||
|
bool readToken(Token& token);
|
||||||
|
void skipSpaces();
|
||||||
|
bool match(const Char* pattern, int patternLength);
|
||||||
|
bool readComment();
|
||||||
|
bool readCStyleComment();
|
||||||
|
bool readCppStyleComment();
|
||||||
|
bool readString();
|
||||||
|
void readNumber();
|
||||||
|
bool readValue();
|
||||||
|
bool readObject(Token& token);
|
||||||
|
bool readArray(Token& token);
|
||||||
|
bool decodeNumber(Token& token);
|
||||||
|
bool decodeNumber(Token& token, Value& decoded);
|
||||||
|
bool decodeString(Token& token);
|
||||||
|
bool decodeString(Token& token, String& decoded);
|
||||||
|
bool decodeDouble(Token& token);
|
||||||
|
bool decodeDouble(Token& token, Value& decoded);
|
||||||
|
bool decodeUnicodeCodePoint(Token& token, Location& current, Location end,
|
||||||
|
unsigned int& unicode);
|
||||||
|
bool decodeUnicodeEscapeSequence(Token& token, Location& current,
|
||||||
|
Location end, unsigned int& unicode);
|
||||||
|
bool addError(const String& message, Token& token, Location extra = nullptr);
|
||||||
|
bool recoverFromError(TokenType skipUntilToken);
|
||||||
|
bool addErrorAndRecover(const String& message, Token& token,
|
||||||
|
TokenType skipUntilToken);
|
||||||
|
void skipUntilSpace();
|
||||||
|
Value& currentValue();
|
||||||
|
Char getNextChar();
|
||||||
|
void getLocationLineAndColumn(Location location, int& line,
|
||||||
|
int& column) const;
|
||||||
|
String getLocationLineAndColumn(Location location) const;
|
||||||
|
void addComment(Location begin, Location end, CommentPlacement placement);
|
||||||
|
void skipCommentTokens(Token& token);
|
||||||
|
|
||||||
|
static bool containsNewLine(Location begin, Location end);
|
||||||
|
static String normalizeEOL(Location begin, Location end);
|
||||||
|
|
||||||
|
using Nodes = std::stack<Value*>;
|
||||||
|
Nodes nodes_;
|
||||||
|
Errors errors_;
|
||||||
|
String document_;
|
||||||
|
Location begin_{};
|
||||||
|
Location end_{};
|
||||||
|
Location current_{};
|
||||||
|
Location lastValueEnd_{};
|
||||||
|
Value* lastValue_{};
|
||||||
|
String commentsBefore_;
|
||||||
|
Features features_;
|
||||||
|
bool collectComments_{};
|
||||||
|
}; // Reader
|
||||||
|
|
||||||
|
/** Interface for reading JSON from a char array.
|
||||||
|
*/
|
||||||
|
class JSON_API CharReader {
|
||||||
|
public:
|
||||||
|
virtual ~CharReader() = default;
|
||||||
|
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
|
||||||
|
* document. The document must be a UTF-8 encoded string containing the
|
||||||
|
* document to read.
|
||||||
|
*
|
||||||
|
* \param beginDoc Pointer on the beginning of the UTF-8 encoded string
|
||||||
|
* of the document to read.
|
||||||
|
* \param endDoc Pointer on the end of the UTF-8 encoded string of the
|
||||||
|
* document to read. Must be >= beginDoc.
|
||||||
|
* \param[out] root Contains the root value of the document if it was
|
||||||
|
* successfully parsed.
|
||||||
|
* \param[out] errs Formatted error messages (if not NULL) a user
|
||||||
|
* friendly string that lists errors in the parsed
|
||||||
|
* document.
|
||||||
|
* \return \c true if the document was successfully parsed, \c false if an
|
||||||
|
* error occurred.
|
||||||
|
*/
|
||||||
|
virtual bool parse(char const* beginDoc, char const* endDoc, Value* root,
|
||||||
|
String* errs) = 0;
|
||||||
|
|
||||||
|
class JSON_API Factory {
|
||||||
|
public:
|
||||||
|
virtual ~Factory() = default;
|
||||||
|
/** \brief Allocate a CharReader via operator new().
|
||||||
|
* \throw std::exception if something goes wrong (e.g. invalid settings)
|
||||||
|
*/
|
||||||
|
virtual CharReader* newCharReader() const = 0;
|
||||||
|
}; // Factory
|
||||||
|
}; // CharReader
|
||||||
|
|
||||||
|
/** \brief Build a CharReader implementation.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* \code
|
||||||
|
* using namespace Json;
|
||||||
|
* CharReaderBuilder builder;
|
||||||
|
* builder["collectComments"] = false;
|
||||||
|
* Value value;
|
||||||
|
* String errs;
|
||||||
|
* bool ok = parseFromStream(builder, std::cin, &value, &errs);
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
class JSON_API CharReaderBuilder : public CharReader::Factory {
|
||||||
|
public:
|
||||||
|
// Note: We use a Json::Value so that we can add data-members to this class
|
||||||
|
// without a major version bump.
|
||||||
|
/** Configuration of this builder.
|
||||||
|
* These are case-sensitive.
|
||||||
|
* Available settings (case-sensitive):
|
||||||
|
* - `"collectComments": false or true`
|
||||||
|
* - true to collect comment and allow writing them back during
|
||||||
|
* serialization, false to discard comments. This parameter is ignored
|
||||||
|
* if allowComments is false.
|
||||||
|
* - `"allowComments": false or true`
|
||||||
|
* - true if comments are allowed.
|
||||||
|
* - `"allowTrailingCommas": false or true`
|
||||||
|
* - true if trailing commas in objects and arrays are allowed.
|
||||||
|
* - `"strictRoot": false or true`
|
||||||
|
* - true if root must be either an array or an object value
|
||||||
|
* - `"allowDroppedNullPlaceholders": false or true`
|
||||||
|
* - true if dropped null placeholders are allowed. (See
|
||||||
|
* StreamWriterBuilder.)
|
||||||
|
* - `"allowNumericKeys": false or true`
|
||||||
|
* - true if numeric object keys are allowed.
|
||||||
|
* - `"allowSingleQuotes": false or true`
|
||||||
|
* - true if '' are allowed for strings (both keys and values)
|
||||||
|
* - `"stackLimit": integer`
|
||||||
|
* - Exceeding stackLimit (recursive depth of `readValue()`) will cause an
|
||||||
|
* exception.
|
||||||
|
* - This is a security issue (seg-faults caused by deeply nested JSON), so
|
||||||
|
* the default is low.
|
||||||
|
* - `"failIfExtra": false or true`
|
||||||
|
* - If true, `parse()` returns false when extra non-whitespace trails the
|
||||||
|
* JSON value in the input string.
|
||||||
|
* - `"rejectDupKeys": false or true`
|
||||||
|
* - If true, `parse()` returns false when a key is duplicated within an
|
||||||
|
* object.
|
||||||
|
* - `"allowSpecialFloats": false or true`
|
||||||
|
* - If true, special float values (NaNs and infinities) are allowed and
|
||||||
|
* their values are lossfree restorable.
|
||||||
|
* - `"skipBom": false or true`
|
||||||
|
* - If true, if the input starts with the Unicode byte order mark (BOM),
|
||||||
|
* it is skipped.
|
||||||
|
*
|
||||||
|
* You can examine 'settings_` yourself to see the defaults. You can also
|
||||||
|
* write and read them just like any JSON Value.
|
||||||
|
* \sa setDefaults()
|
||||||
|
*/
|
||||||
|
Json::Value settings_;
|
||||||
|
|
||||||
|
CharReaderBuilder();
|
||||||
|
~CharReaderBuilder() override;
|
||||||
|
|
||||||
|
CharReader* newCharReader() const override;
|
||||||
|
|
||||||
|
/** \return true if 'settings' are legal and consistent;
|
||||||
|
* otherwise, indicate bad settings via 'invalid'.
|
||||||
|
*/
|
||||||
|
bool validate(Json::Value* invalid) const;
|
||||||
|
|
||||||
|
/** A simple way to update a specific setting.
|
||||||
|
*/
|
||||||
|
Value& operator[](const String& key);
|
||||||
|
|
||||||
|
/** Called by ctor, but you can use this to reset settings_.
|
||||||
|
* \pre 'settings' != NULL (but Json::null is fine)
|
||||||
|
* \remark Defaults:
|
||||||
|
* \snippet src/lib_json/json_reader.cpp CharReaderBuilderDefaults
|
||||||
|
*/
|
||||||
|
static void setDefaults(Json::Value* settings);
|
||||||
|
/** Same as old Features::strictMode().
|
||||||
|
* \pre 'settings' != NULL (but Json::null is fine)
|
||||||
|
* \remark Defaults:
|
||||||
|
* \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode
|
||||||
|
*/
|
||||||
|
static void strictMode(Json::Value* settings);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Consume entire stream and use its begin/end.
|
||||||
|
* Someday we might have a real StreamReader, but for now this
|
||||||
|
* is convenient.
|
||||||
|
*/
|
||||||
|
bool JSON_API parseFromStream(CharReader::Factory const&, IStream&, Value* root,
|
||||||
|
String* errs);
|
||||||
|
|
||||||
|
/** \brief Read from 'sin' into 'root'.
|
||||||
|
*
|
||||||
|
* Always keep comments from the input JSON.
|
||||||
|
*
|
||||||
|
* This can be used to read a file into a particular sub-object.
|
||||||
|
* For example:
|
||||||
|
* \code
|
||||||
|
* Json::Value root;
|
||||||
|
* cin >> root["dir"]["file"];
|
||||||
|
* cout << root;
|
||||||
|
* \endcode
|
||||||
|
* Result:
|
||||||
|
* \verbatim
|
||||||
|
* {
|
||||||
|
* "dir": {
|
||||||
|
* "file": {
|
||||||
|
* // The input stream JSON would be nested here.
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* \endverbatim
|
||||||
|
* \throw std::exception on parse error.
|
||||||
|
* \see Json::operator<<()
|
||||||
|
*/
|
||||||
|
JSON_API IStream& operator>>(IStream&, Value&);
|
||||||
|
|
||||||
|
} // namespace Json
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
|
||||||
|
#endif // JSON_READER_H_INCLUDED
|
@ -0,0 +1,936 @@
|
|||||||
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
// Distributed under MIT license, or public domain if desired and
|
||||||
|
// recognized in your jurisdiction.
|
||||||
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
#ifndef JSON_H_INCLUDED
|
||||||
|
#define JSON_H_INCLUDED
|
||||||
|
|
||||||
|
#if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
#include "forwards.h"
|
||||||
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
|
||||||
|
// Conditional NORETURN attribute on the throw functions would:
|
||||||
|
// a) suppress false positives from static code analysis
|
||||||
|
// b) possibly improve optimization opportunities.
|
||||||
|
#if !defined(JSONCPP_NORETURN)
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER == 1800
|
||||||
|
#define JSONCPP_NORETURN __declspec(noreturn)
|
||||||
|
#else
|
||||||
|
#define JSONCPP_NORETURN [[noreturn]]
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Support for '= delete' with template declarations was a late addition
|
||||||
|
// to the c++11 standard and is rejected by clang 3.8 and Apple clang 8.2
|
||||||
|
// even though these declare themselves to be c++11 compilers.
|
||||||
|
#if !defined(JSONCPP_TEMPLATE_DELETE)
|
||||||
|
#if defined(__clang__) && defined(__apple_build_version__)
|
||||||
|
#if __apple_build_version__ <= 8000042
|
||||||
|
#define JSONCPP_TEMPLATE_DELETE
|
||||||
|
#endif
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#if __clang_major__ == 3 && __clang_minor__ <= 8
|
||||||
|
#define JSONCPP_TEMPLATE_DELETE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !defined(JSONCPP_TEMPLATE_DELETE)
|
||||||
|
#define JSONCPP_TEMPLATE_DELETE = delete
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <exception>
|
||||||
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
|
||||||
|
// be used by...
|
||||||
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4251 4275)
|
||||||
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
/** \brief JSON (JavaScript Object Notation).
|
||||||
|
*/
|
||||||
|
namespace Json {
|
||||||
|
|
||||||
|
#if JSON_USE_EXCEPTION
|
||||||
|
/** Base class for all exceptions we throw.
|
||||||
|
*
|
||||||
|
* We use nothing but these internally. Of course, STL can throw others.
|
||||||
|
*/
|
||||||
|
class JSON_API Exception : public std::exception {
|
||||||
|
public:
|
||||||
|
Exception(String msg);
|
||||||
|
~Exception() noexcept override;
|
||||||
|
char const* what() const noexcept override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
String msg_;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Exceptions which the user cannot easily avoid.
|
||||||
|
*
|
||||||
|
* E.g. out-of-memory (when we use malloc), stack-overflow, malicious input
|
||||||
|
*
|
||||||
|
* \remark derived from Json::Exception
|
||||||
|
*/
|
||||||
|
class JSON_API RuntimeError : public Exception {
|
||||||
|
public:
|
||||||
|
RuntimeError(String const& msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
|
||||||
|
*
|
||||||
|
* These are precondition-violations (user bugs) and internal errors (our bugs).
|
||||||
|
*
|
||||||
|
* \remark derived from Json::Exception
|
||||||
|
*/
|
||||||
|
class JSON_API LogicError : public Exception {
|
||||||
|
public:
|
||||||
|
LogicError(String const& msg);
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// used internally
|
||||||
|
JSONCPP_NORETURN void throwRuntimeError(String const& msg);
|
||||||
|
/// used internally
|
||||||
|
JSONCPP_NORETURN void throwLogicError(String const& msg);
|
||||||
|
|
||||||
|
/** \brief Type of the value held by a Value object.
|
||||||
|
*/
|
||||||
|
enum ValueType {
|
||||||
|
nullValue = 0, ///< 'null' value
|
||||||
|
intValue, ///< signed integer value
|
||||||
|
uintValue, ///< unsigned integer value
|
||||||
|
realValue, ///< double value
|
||||||
|
stringValue, ///< UTF-8 string value
|
||||||
|
booleanValue, ///< bool value
|
||||||
|
arrayValue, ///< array value (ordered list)
|
||||||
|
objectValue ///< object value (collection of name/value pairs).
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CommentPlacement {
|
||||||
|
commentBefore = 0, ///< a comment placed on the line before a value
|
||||||
|
commentAfterOnSameLine, ///< a comment just after a value on the same line
|
||||||
|
commentAfter, ///< a comment on the line after a value (only make sense for
|
||||||
|
/// root value)
|
||||||
|
numberOfCommentPlacement
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Type of precision for formatting of real values.
|
||||||
|
*/
|
||||||
|
enum PrecisionType {
|
||||||
|
significantDigits = 0, ///< we set max number of significant digits in string
|
||||||
|
decimalPlaces ///< we set max number of digits after "." in string
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Lightweight wrapper to tag static string.
|
||||||
|
*
|
||||||
|
* Value constructor and objectValue member assignment takes advantage of the
|
||||||
|
* StaticString and avoid the cost of string duplication when storing the
|
||||||
|
* string or the member name.
|
||||||
|
*
|
||||||
|
* Example of usage:
|
||||||
|
* \code
|
||||||
|
* Json::Value aValue( StaticString("some text") );
|
||||||
|
* Json::Value object;
|
||||||
|
* static const StaticString code("code");
|
||||||
|
* object[code] = 1234;
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
class JSON_API StaticString {
|
||||||
|
public:
|
||||||
|
explicit StaticString(const char* czstring) : c_str_(czstring) {}
|
||||||
|
|
||||||
|
operator const char*() const { return c_str_; }
|
||||||
|
|
||||||
|
const char* c_str() const { return c_str_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
const char* c_str_;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Represents a <a HREF="http://www.json.org">JSON</a> value.
|
||||||
|
*
|
||||||
|
* This class is a discriminated union wrapper that can represents a:
|
||||||
|
* - signed integer [range: Value::minInt - Value::maxInt]
|
||||||
|
* - unsigned integer (range: 0 - Value::maxUInt)
|
||||||
|
* - double
|
||||||
|
* - UTF-8 string
|
||||||
|
* - boolean
|
||||||
|
* - 'null'
|
||||||
|
* - an ordered list of Value
|
||||||
|
* - collection of name/value pairs (javascript object)
|
||||||
|
*
|
||||||
|
* The type of the held value is represented by a #ValueType and
|
||||||
|
* can be obtained using type().
|
||||||
|
*
|
||||||
|
* Values of an #objectValue or #arrayValue can be accessed using operator[]()
|
||||||
|
* methods.
|
||||||
|
* Non-const methods will automatically create the a #nullValue element
|
||||||
|
* if it does not exist.
|
||||||
|
* The sequence of an #arrayValue will be automatically resized and initialized
|
||||||
|
* with #nullValue. resize() can be used to enlarge or truncate an #arrayValue.
|
||||||
|
*
|
||||||
|
* The get() methods can be used to obtain default value in the case the
|
||||||
|
* required element does not exist.
|
||||||
|
*
|
||||||
|
* It is possible to iterate over the list of member keys of an object using
|
||||||
|
* the getMemberNames() method.
|
||||||
|
*
|
||||||
|
* \note #Value string-length fit in size_t, but keys must be < 2^30.
|
||||||
|
* (The reason is an implementation detail.) A #CharReader will raise an
|
||||||
|
* exception if a bound is exceeded to avoid security holes in your app,
|
||||||
|
* but the Value API does *not* check bounds. That is the responsibility
|
||||||
|
* of the caller.
|
||||||
|
*/
|
||||||
|
class JSON_API Value {
|
||||||
|
friend class ValueIteratorBase;
|
||||||
|
|
||||||
|
public:
|
||||||
|
using Members = std::vector<String>;
|
||||||
|
using iterator = ValueIterator;
|
||||||
|
using const_iterator = ValueConstIterator;
|
||||||
|
using UInt = Json::UInt;
|
||||||
|
using Int = Json::Int;
|
||||||
|
#if defined(JSON_HAS_INT64)
|
||||||
|
using UInt64 = Json::UInt64;
|
||||||
|
using Int64 = Json::Int64;
|
||||||
|
#endif // defined(JSON_HAS_INT64)
|
||||||
|
using LargestInt = Json::LargestInt;
|
||||||
|
using LargestUInt = Json::LargestUInt;
|
||||||
|
using ArrayIndex = Json::ArrayIndex;
|
||||||
|
|
||||||
|
// Required for boost integration, e. g. BOOST_TEST
|
||||||
|
using value_type = std::string;
|
||||||
|
|
||||||
|
#if JSON_USE_NULLREF
|
||||||
|
// Binary compatibility kludges, do not use.
|
||||||
|
static const Value& null;
|
||||||
|
static const Value& nullRef;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// null and nullRef are deprecated, use this instead.
|
||||||
|
static Value const& nullSingleton();
|
||||||
|
|
||||||
|
/// Minimum signed integer value that can be stored in a Json::Value.
|
||||||
|
static constexpr LargestInt minLargestInt =
|
||||||
|
LargestInt(~(LargestUInt(-1) / 2));
|
||||||
|
/// Maximum signed integer value that can be stored in a Json::Value.
|
||||||
|
static constexpr LargestInt maxLargestInt = LargestInt(LargestUInt(-1) / 2);
|
||||||
|
/// Maximum unsigned integer value that can be stored in a Json::Value.
|
||||||
|
static constexpr LargestUInt maxLargestUInt = LargestUInt(-1);
|
||||||
|
|
||||||
|
/// Minimum signed int value that can be stored in a Json::Value.
|
||||||
|
static constexpr Int minInt = Int(~(UInt(-1) / 2));
|
||||||
|
/// Maximum signed int value that can be stored in a Json::Value.
|
||||||
|
static constexpr Int maxInt = Int(UInt(-1) / 2);
|
||||||
|
/// Maximum unsigned int value that can be stored in a Json::Value.
|
||||||
|
static constexpr UInt maxUInt = UInt(-1);
|
||||||
|
|
||||||
|
#if defined(JSON_HAS_INT64)
|
||||||
|
/// Minimum signed 64 bits int value that can be stored in a Json::Value.
|
||||||
|
static constexpr Int64 minInt64 = Int64(~(UInt64(-1) / 2));
|
||||||
|
/// Maximum signed 64 bits int value that can be stored in a Json::Value.
|
||||||
|
static constexpr Int64 maxInt64 = Int64(UInt64(-1) / 2);
|
||||||
|
/// Maximum unsigned 64 bits int value that can be stored in a Json::Value.
|
||||||
|
static constexpr UInt64 maxUInt64 = UInt64(-1);
|
||||||
|
#endif // defined(JSON_HAS_INT64)
|
||||||
|
/// Default precision for real value for string representation.
|
||||||
|
static constexpr UInt defaultRealPrecision = 17;
|
||||||
|
// The constant is hard-coded because some compiler have trouble
|
||||||
|
// converting Value::maxUInt64 to a double correctly (AIX/xlC).
|
||||||
|
// Assumes that UInt64 is a 64 bits integer.
|
||||||
|
static constexpr double maxUInt64AsDouble = 18446744073709551615.0;
|
||||||
|
// Workaround for bug in the NVIDIAs CUDA 9.1 nvcc compiler
|
||||||
|
// when using gcc and clang backend compilers. CZString
|
||||||
|
// cannot be defined as private. See issue #486
|
||||||
|
#ifdef __NVCC__
|
||||||
|
public:
|
||||||
|
#else
|
||||||
|
private:
|
||||||
|
#endif
|
||||||
|
#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
|
||||||
|
class CZString {
|
||||||
|
public:
|
||||||
|
enum DuplicationPolicy { noDuplication = 0, duplicate, duplicateOnCopy };
|
||||||
|
CZString(ArrayIndex index);
|
||||||
|
CZString(char const* str, unsigned length, DuplicationPolicy allocate);
|
||||||
|
CZString(CZString const& other);
|
||||||
|
CZString(CZString&& other) noexcept;
|
||||||
|
~CZString();
|
||||||
|
CZString& operator=(const CZString& other);
|
||||||
|
CZString& operator=(CZString&& other) noexcept;
|
||||||
|
|
||||||
|
bool operator<(CZString const& other) const;
|
||||||
|
bool operator==(CZString const& other) const;
|
||||||
|
ArrayIndex index() const;
|
||||||
|
// const char* c_str() const; ///< \deprecated
|
||||||
|
char const* data() const;
|
||||||
|
unsigned length() const;
|
||||||
|
bool isStaticString() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void swap(CZString& other);
|
||||||
|
|
||||||
|
struct StringStorage {
|
||||||
|
unsigned policy_ : 2;
|
||||||
|
unsigned length_ : 30; // 1GB max
|
||||||
|
};
|
||||||
|
|
||||||
|
char const* cstr_; // actually, a prefixed string, unless policy is noDup
|
||||||
|
union {
|
||||||
|
ArrayIndex index_;
|
||||||
|
StringStorage storage_;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef std::map<CZString, Value> ObjectValues;
|
||||||
|
#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* \brief Create a default Value of the given type.
|
||||||
|
*
|
||||||
|
* This is a very useful constructor.
|
||||||
|
* To create an empty array, pass arrayValue.
|
||||||
|
* To create an empty object, pass objectValue.
|
||||||
|
* Another Value can then be set to this one by assignment.
|
||||||
|
* This is useful since clear() and resize() will not alter types.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
* \code
|
||||||
|
* Json::Value null_value; // null
|
||||||
|
* Json::Value arr_value(Json::arrayValue); // []
|
||||||
|
* Json::Value obj_value(Json::objectValue); // {}
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
Value(ValueType type = nullValue);
|
||||||
|
Value(Int value);
|
||||||
|
Value(UInt value);
|
||||||
|
#if defined(JSON_HAS_INT64)
|
||||||
|
Value(Int64 value);
|
||||||
|
Value(UInt64 value);
|
||||||
|
#endif // if defined(JSON_HAS_INT64)
|
||||||
|
Value(double value);
|
||||||
|
Value(const char* value); ///< Copy til first 0. (NULL causes to seg-fault.)
|
||||||
|
Value(const char* begin, const char* end); ///< Copy all, incl zeroes.
|
||||||
|
/**
|
||||||
|
* \brief Constructs a value from a static string.
|
||||||
|
*
|
||||||
|
* Like other value string constructor but do not duplicate the string for
|
||||||
|
* internal storage. The given string must remain alive after the call to
|
||||||
|
* this constructor.
|
||||||
|
*
|
||||||
|
* \note This works only for null-terminated strings. (We cannot change the
|
||||||
|
* size of this class, so we have nowhere to store the length, which might be
|
||||||
|
* computed later for various operations.)
|
||||||
|
*
|
||||||
|
* Example of usage:
|
||||||
|
* \code
|
||||||
|
* static StaticString foo("some text");
|
||||||
|
* Json::Value aValue(foo);
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
Value(const StaticString& value);
|
||||||
|
Value(const String& value);
|
||||||
|
Value(bool value);
|
||||||
|
Value(std::nullptr_t ptr) = delete;
|
||||||
|
Value(const Value& other);
|
||||||
|
Value(Value&& other) noexcept;
|
||||||
|
~Value();
|
||||||
|
|
||||||
|
/// \note Overwrite existing comments. To preserve comments, use
|
||||||
|
/// #swapPayload().
|
||||||
|
Value& operator=(const Value& other);
|
||||||
|
Value& operator=(Value&& other) noexcept;
|
||||||
|
|
||||||
|
/// Swap everything.
|
||||||
|
void swap(Value& other);
|
||||||
|
/// Swap values but leave comments and source offsets in place.
|
||||||
|
void swapPayload(Value& other);
|
||||||
|
|
||||||
|
/// copy everything.
|
||||||
|
void copy(const Value& other);
|
||||||
|
/// copy values but leave comments and source offsets in place.
|
||||||
|
void copyPayload(const Value& other);
|
||||||
|
|
||||||
|
ValueType type() const;
|
||||||
|
|
||||||
|
/// Compare payload only, not comments etc.
|
||||||
|
bool operator<(const Value& other) const;
|
||||||
|
bool operator<=(const Value& other) const;
|
||||||
|
bool operator>=(const Value& other) const;
|
||||||
|
bool operator>(const Value& other) const;
|
||||||
|
bool operator==(const Value& other) const;
|
||||||
|
bool operator!=(const Value& other) const;
|
||||||
|
int compare(const Value& other) const;
|
||||||
|
|
||||||
|
const char* asCString() const; ///< Embedded zeroes could cause you trouble!
|
||||||
|
#if JSONCPP_USING_SECURE_MEMORY
|
||||||
|
unsigned getCStringLength() const; // Allows you to understand the length of
|
||||||
|
// the CString
|
||||||
|
#endif
|
||||||
|
String asString() const; ///< Embedded zeroes are possible.
|
||||||
|
/** Get raw char* of string-value.
|
||||||
|
* \return false if !string. (Seg-fault if str or end are NULL.)
|
||||||
|
*/
|
||||||
|
bool getString(char const** begin, char const** end) const;
|
||||||
|
Int asInt() const;
|
||||||
|
UInt asUInt() const;
|
||||||
|
#if defined(JSON_HAS_INT64)
|
||||||
|
Int64 asInt64() const;
|
||||||
|
UInt64 asUInt64() const;
|
||||||
|
#endif // if defined(JSON_HAS_INT64)
|
||||||
|
LargestInt asLargestInt() const;
|
||||||
|
LargestUInt asLargestUInt() const;
|
||||||
|
float asFloat() const;
|
||||||
|
double asDouble() const;
|
||||||
|
bool asBool() const;
|
||||||
|
|
||||||
|
bool isNull() const;
|
||||||
|
bool isBool() const;
|
||||||
|
bool isInt() const;
|
||||||
|
bool isInt64() const;
|
||||||
|
bool isUInt() const;
|
||||||
|
bool isUInt64() const;
|
||||||
|
bool isIntegral() const;
|
||||||
|
bool isDouble() const;
|
||||||
|
bool isNumeric() const;
|
||||||
|
bool isString() const;
|
||||||
|
bool isArray() const;
|
||||||
|
bool isObject() const;
|
||||||
|
|
||||||
|
/// The `as<T>` and `is<T>` member function templates and specializations.
|
||||||
|
template <typename T> T as() const JSONCPP_TEMPLATE_DELETE;
|
||||||
|
template <typename T> bool is() const JSONCPP_TEMPLATE_DELETE;
|
||||||
|
|
||||||
|
bool isConvertibleTo(ValueType other) const;
|
||||||
|
|
||||||
|
/// Number of values in array or object
|
||||||
|
ArrayIndex size() const;
|
||||||
|
|
||||||
|
/// \brief Return true if empty array, empty object, or null;
|
||||||
|
/// otherwise, false.
|
||||||
|
bool empty() const;
|
||||||
|
|
||||||
|
/// Return !isNull()
|
||||||
|
explicit operator bool() const;
|
||||||
|
|
||||||
|
/// Remove all object members and array elements.
|
||||||
|
/// \pre type() is arrayValue, objectValue, or nullValue
|
||||||
|
/// \post type() is unchanged
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
/// Resize the array to newSize elements.
|
||||||
|
/// New elements are initialized to null.
|
||||||
|
/// May only be called on nullValue or arrayValue.
|
||||||
|
/// \pre type() is arrayValue or nullValue
|
||||||
|
/// \post type() is arrayValue
|
||||||
|
void resize(ArrayIndex newSize);
|
||||||
|
|
||||||
|
///@{
|
||||||
|
/// Access an array element (zero based index). If the array contains less
|
||||||
|
/// than index element, then null value are inserted in the array so that
|
||||||
|
/// its size is index+1.
|
||||||
|
/// (You may need to say 'value[0u]' to get your compiler to distinguish
|
||||||
|
/// this from the operator[] which takes a string.)
|
||||||
|
Value& operator[](ArrayIndex index);
|
||||||
|
Value& operator[](int index);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
///@{
|
||||||
|
/// Access an array element (zero based index).
|
||||||
|
/// (You may need to say 'value[0u]' to get your compiler to distinguish
|
||||||
|
/// this from the operator[] which takes a string.)
|
||||||
|
const Value& operator[](ArrayIndex index) const;
|
||||||
|
const Value& operator[](int index) const;
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/// If the array contains at least index+1 elements, returns the element
|
||||||
|
/// value, otherwise returns defaultValue.
|
||||||
|
Value get(ArrayIndex index, const Value& defaultValue) const;
|
||||||
|
/// Return true if index < size().
|
||||||
|
bool isValidIndex(ArrayIndex index) const;
|
||||||
|
/// \brief Append value to array at the end.
|
||||||
|
///
|
||||||
|
/// Equivalent to jsonvalue[jsonvalue.size()] = value;
|
||||||
|
Value& append(const Value& value);
|
||||||
|
Value& append(Value&& value);
|
||||||
|
|
||||||
|
/// \brief Insert value in array at specific index
|
||||||
|
bool insert(ArrayIndex index, const Value& newValue);
|
||||||
|
bool insert(ArrayIndex index, Value&& newValue);
|
||||||
|
|
||||||
|
/// Access an object value by name, create a null member if it does not exist.
|
||||||
|
/// \note Because of our implementation, keys are limited to 2^30 -1 chars.
|
||||||
|
/// Exceeding that will cause an exception.
|
||||||
|
Value& operator[](const char* key);
|
||||||
|
/// Access an object value by name, returns null if there is no member with
|
||||||
|
/// that name.
|
||||||
|
const Value& operator[](const char* key) const;
|
||||||
|
/// Access an object value by name, create a null member if it does not exist.
|
||||||
|
/// \param key may contain embedded nulls.
|
||||||
|
Value& operator[](const String& key);
|
||||||
|
/// Access an object value by name, returns null if there is no member with
|
||||||
|
/// that name.
|
||||||
|
/// \param key may contain embedded nulls.
|
||||||
|
const Value& operator[](const String& key) const;
|
||||||
|
/** \brief Access an object value by name, create a null member if it does not
|
||||||
|
* exist.
|
||||||
|
*
|
||||||
|
* If the object has no entry for that name, then the member name used to
|
||||||
|
* store the new entry is not duplicated.
|
||||||
|
* Example of use:
|
||||||
|
* \code
|
||||||
|
* Json::Value object;
|
||||||
|
* static const StaticString code("code");
|
||||||
|
* object[code] = 1234;
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
Value& operator[](const StaticString& key);
|
||||||
|
/// Return the member named key if it exist, defaultValue otherwise.
|
||||||
|
/// \note deep copy
|
||||||
|
Value get(const char* key, const Value& defaultValue) const;
|
||||||
|
/// Return the member named key if it exist, defaultValue otherwise.
|
||||||
|
/// \note deep copy
|
||||||
|
/// \note key may contain embedded nulls.
|
||||||
|
Value get(const char* begin, const char* end,
|
||||||
|
const Value& defaultValue) const;
|
||||||
|
/// Return the member named key if it exist, defaultValue otherwise.
|
||||||
|
/// \note deep copy
|
||||||
|
/// \param key may contain embedded nulls.
|
||||||
|
Value get(const String& key, const Value& defaultValue) const;
|
||||||
|
/// Most general and efficient version of isMember()const, get()const,
|
||||||
|
/// and operator[]const
|
||||||
|
/// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
|
||||||
|
Value const* find(char const* begin, char const* end) const;
|
||||||
|
/// Most general and efficient version of object-mutators.
|
||||||
|
/// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
|
||||||
|
/// \return non-zero, but JSON_ASSERT if this is neither object nor nullValue.
|
||||||
|
Value* demand(char const* begin, char const* end);
|
||||||
|
/// \brief Remove and return the named member.
|
||||||
|
///
|
||||||
|
/// Do nothing if it did not exist.
|
||||||
|
/// \pre type() is objectValue or nullValue
|
||||||
|
/// \post type() is unchanged
|
||||||
|
void removeMember(const char* key);
|
||||||
|
/// Same as removeMember(const char*)
|
||||||
|
/// \param key may contain embedded nulls.
|
||||||
|
void removeMember(const String& key);
|
||||||
|
/// Same as removeMember(const char* begin, const char* end, Value* removed),
|
||||||
|
/// but 'key' is null-terminated.
|
||||||
|
bool removeMember(const char* key, Value* removed);
|
||||||
|
/** \brief Remove the named map member.
|
||||||
|
*
|
||||||
|
* Update 'removed' iff removed.
|
||||||
|
* \param key may contain embedded nulls.
|
||||||
|
* \return true iff removed (no exceptions)
|
||||||
|
*/
|
||||||
|
bool removeMember(String const& key, Value* removed);
|
||||||
|
/// Same as removeMember(String const& key, Value* removed)
|
||||||
|
bool removeMember(const char* begin, const char* end, Value* removed);
|
||||||
|
/** \brief Remove the indexed array element.
|
||||||
|
*
|
||||||
|
* O(n) expensive operations.
|
||||||
|
* Update 'removed' iff removed.
|
||||||
|
* \return true if removed (no exceptions)
|
||||||
|
*/
|
||||||
|
bool removeIndex(ArrayIndex index, Value* removed);
|
||||||
|
|
||||||
|
/// Return true if the object has a member named key.
|
||||||
|
/// \note 'key' must be null-terminated.
|
||||||
|
bool isMember(const char* key) const;
|
||||||
|
/// Return true if the object has a member named key.
|
||||||
|
/// \param key may contain embedded nulls.
|
||||||
|
bool isMember(const String& key) const;
|
||||||
|
/// Same as isMember(String const& key)const
|
||||||
|
bool isMember(const char* begin, const char* end) const;
|
||||||
|
|
||||||
|
/// \brief Return a list of the member names.
|
||||||
|
///
|
||||||
|
/// If null, return an empty list.
|
||||||
|
/// \pre type() is objectValue or nullValue
|
||||||
|
/// \post if type() was nullValue, it remains nullValue
|
||||||
|
Members getMemberNames() const;
|
||||||
|
|
||||||
|
/// \deprecated Always pass len.
|
||||||
|
JSONCPP_DEPRECATED("Use setComment(String const&) instead.")
|
||||||
|
void setComment(const char* comment, CommentPlacement placement) {
|
||||||
|
setComment(String(comment, strlen(comment)), placement);
|
||||||
|
}
|
||||||
|
/// Comments must be //... or /* ... */
|
||||||
|
void setComment(const char* comment, size_t len, CommentPlacement placement) {
|
||||||
|
setComment(String(comment, len), placement);
|
||||||
|
}
|
||||||
|
/// Comments must be //... or /* ... */
|
||||||
|
void setComment(String comment, CommentPlacement placement);
|
||||||
|
bool hasComment(CommentPlacement placement) const;
|
||||||
|
/// Include delimiters and embedded newlines.
|
||||||
|
String getComment(CommentPlacement placement) const;
|
||||||
|
|
||||||
|
String toStyledString() const;
|
||||||
|
|
||||||
|
const_iterator begin() const;
|
||||||
|
const_iterator end() const;
|
||||||
|
|
||||||
|
iterator begin();
|
||||||
|
iterator end();
|
||||||
|
|
||||||
|
// Accessors for the [start, limit) range of bytes within the JSON text from
|
||||||
|
// which this value was parsed, if any.
|
||||||
|
void setOffsetStart(ptrdiff_t start);
|
||||||
|
void setOffsetLimit(ptrdiff_t limit);
|
||||||
|
ptrdiff_t getOffsetStart() const;
|
||||||
|
ptrdiff_t getOffsetLimit() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setType(ValueType v) {
|
||||||
|
bits_.value_type_ = static_cast<unsigned char>(v);
|
||||||
|
}
|
||||||
|
bool isAllocated() const { return bits_.allocated_; }
|
||||||
|
void setIsAllocated(bool v) { bits_.allocated_ = v; }
|
||||||
|
|
||||||
|
void initBasic(ValueType type, bool allocated = false);
|
||||||
|
void dupPayload(const Value& other);
|
||||||
|
void releasePayload();
|
||||||
|
void dupMeta(const Value& other);
|
||||||
|
|
||||||
|
Value& resolveReference(const char* key);
|
||||||
|
Value& resolveReference(const char* key, const char* end);
|
||||||
|
|
||||||
|
// struct MemberNamesTransform
|
||||||
|
//{
|
||||||
|
// typedef const char *result_type;
|
||||||
|
// const char *operator()( const CZString &name ) const
|
||||||
|
// {
|
||||||
|
// return name.c_str();
|
||||||
|
// }
|
||||||
|
//};
|
||||||
|
|
||||||
|
union ValueHolder {
|
||||||
|
LargestInt int_;
|
||||||
|
LargestUInt uint_;
|
||||||
|
double real_;
|
||||||
|
bool bool_;
|
||||||
|
char* string_; // if allocated_, ptr to { unsigned, char[] }.
|
||||||
|
ObjectValues* map_;
|
||||||
|
} value_;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
// Really a ValueType, but types should agree for bitfield packing.
|
||||||
|
unsigned int value_type_ : 8;
|
||||||
|
// Unless allocated_, string_ must be null-terminated.
|
||||||
|
unsigned int allocated_ : 1;
|
||||||
|
} bits_;
|
||||||
|
|
||||||
|
class Comments {
|
||||||
|
public:
|
||||||
|
Comments() = default;
|
||||||
|
Comments(const Comments& that);
|
||||||
|
Comments(Comments&& that) noexcept;
|
||||||
|
Comments& operator=(const Comments& that);
|
||||||
|
Comments& operator=(Comments&& that) noexcept;
|
||||||
|
bool has(CommentPlacement slot) const;
|
||||||
|
String get(CommentPlacement slot) const;
|
||||||
|
void set(CommentPlacement slot, String comment);
|
||||||
|
|
||||||
|
private:
|
||||||
|
using Array = std::array<String, numberOfCommentPlacement>;
|
||||||
|
std::unique_ptr<Array> ptr_;
|
||||||
|
};
|
||||||
|
Comments comments_;
|
||||||
|
|
||||||
|
// [start, limit) byte offsets in the source JSON text from which this Value
|
||||||
|
// was extracted.
|
||||||
|
ptrdiff_t start_;
|
||||||
|
ptrdiff_t limit_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> inline bool Value::as<bool>() const { return asBool(); }
|
||||||
|
template <> inline bool Value::is<bool>() const { return isBool(); }
|
||||||
|
|
||||||
|
template <> inline Int Value::as<Int>() const { return asInt(); }
|
||||||
|
template <> inline bool Value::is<Int>() const { return isInt(); }
|
||||||
|
|
||||||
|
template <> inline UInt Value::as<UInt>() const { return asUInt(); }
|
||||||
|
template <> inline bool Value::is<UInt>() const { return isUInt(); }
|
||||||
|
|
||||||
|
#if defined(JSON_HAS_INT64)
|
||||||
|
template <> inline Int64 Value::as<Int64>() const { return asInt64(); }
|
||||||
|
template <> inline bool Value::is<Int64>() const { return isInt64(); }
|
||||||
|
|
||||||
|
template <> inline UInt64 Value::as<UInt64>() const { return asUInt64(); }
|
||||||
|
template <> inline bool Value::is<UInt64>() const { return isUInt64(); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <> inline double Value::as<double>() const { return asDouble(); }
|
||||||
|
template <> inline bool Value::is<double>() const { return isDouble(); }
|
||||||
|
|
||||||
|
template <> inline String Value::as<String>() const { return asString(); }
|
||||||
|
template <> inline bool Value::is<String>() const { return isString(); }
|
||||||
|
|
||||||
|
/// These `as` specializations are type conversions, and do not have a
|
||||||
|
/// corresponding `is`.
|
||||||
|
template <> inline float Value::as<float>() const { return asFloat(); }
|
||||||
|
template <> inline const char* Value::as<const char*>() const {
|
||||||
|
return asCString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Experimental and untested: represents an element of the "path" to
|
||||||
|
* access a node.
|
||||||
|
*/
|
||||||
|
class JSON_API PathArgument {
|
||||||
|
public:
|
||||||
|
friend class Path;
|
||||||
|
|
||||||
|
PathArgument();
|
||||||
|
PathArgument(ArrayIndex index);
|
||||||
|
PathArgument(const char* key);
|
||||||
|
PathArgument(String key);
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum Kind { kindNone = 0, kindIndex, kindKey };
|
||||||
|
String key_;
|
||||||
|
ArrayIndex index_{};
|
||||||
|
Kind kind_{kindNone};
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Experimental and untested: represents a "path" to access a node.
|
||||||
|
*
|
||||||
|
* Syntax:
|
||||||
|
* - "." => root node
|
||||||
|
* - ".[n]" => elements at index 'n' of root node (an array value)
|
||||||
|
* - ".name" => member named 'name' of root node (an object value)
|
||||||
|
* - ".name1.name2.name3"
|
||||||
|
* - ".[0][1][2].name1[3]"
|
||||||
|
* - ".%" => member name is provided as parameter
|
||||||
|
* - ".[%]" => index is provided as parameter
|
||||||
|
*/
|
||||||
|
class JSON_API Path {
|
||||||
|
public:
|
||||||
|
Path(const String& path, const PathArgument& a1 = PathArgument(),
|
||||||
|
const PathArgument& a2 = PathArgument(),
|
||||||
|
const PathArgument& a3 = PathArgument(),
|
||||||
|
const PathArgument& a4 = PathArgument(),
|
||||||
|
const PathArgument& a5 = PathArgument());
|
||||||
|
|
||||||
|
const Value& resolve(const Value& root) const;
|
||||||
|
Value resolve(const Value& root, const Value& defaultValue) const;
|
||||||
|
/// Creates the "path" to access the specified node and returns a reference on
|
||||||
|
/// the node.
|
||||||
|
Value& make(Value& root) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
using InArgs = std::vector<const PathArgument*>;
|
||||||
|
using Args = std::vector<PathArgument>;
|
||||||
|
|
||||||
|
void makePath(const String& path, const InArgs& in);
|
||||||
|
void addPathInArg(const String& path, const InArgs& in,
|
||||||
|
InArgs::const_iterator& itInArg, PathArgument::Kind kind);
|
||||||
|
static void invalidPath(const String& path, int location);
|
||||||
|
|
||||||
|
Args args_;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief base class for Value iterators.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class JSON_API ValueIteratorBase {
|
||||||
|
public:
|
||||||
|
using iterator_category = std::bidirectional_iterator_tag;
|
||||||
|
using size_t = unsigned int;
|
||||||
|
using difference_type = int;
|
||||||
|
using SelfType = ValueIteratorBase;
|
||||||
|
|
||||||
|
bool operator==(const SelfType& other) const { return isEqual(other); }
|
||||||
|
|
||||||
|
bool operator!=(const SelfType& other) const { return !isEqual(other); }
|
||||||
|
|
||||||
|
difference_type operator-(const SelfType& other) const {
|
||||||
|
return other.computeDistance(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return either the index or the member name of the referenced value as a
|
||||||
|
/// Value.
|
||||||
|
Value key() const;
|
||||||
|
|
||||||
|
/// Return the index of the referenced Value, or -1 if it is not an
|
||||||
|
/// arrayValue.
|
||||||
|
UInt index() const;
|
||||||
|
|
||||||
|
/// Return the member name of the referenced Value, or "" if it is not an
|
||||||
|
/// objectValue.
|
||||||
|
/// \note Avoid `c_str()` on result, as embedded zeroes are possible.
|
||||||
|
String name() const;
|
||||||
|
|
||||||
|
/// Return the member name of the referenced Value. "" if it is not an
|
||||||
|
/// objectValue.
|
||||||
|
/// \deprecated This cannot be used for UTF-8 strings, since there can be
|
||||||
|
/// embedded nulls.
|
||||||
|
JSONCPP_DEPRECATED("Use `key = name();` instead.")
|
||||||
|
char const* memberName() const;
|
||||||
|
/// Return the member name of the referenced Value, or NULL if it is not an
|
||||||
|
/// objectValue.
|
||||||
|
/// \note Better version than memberName(). Allows embedded nulls.
|
||||||
|
char const* memberName(char const** end) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/*! Internal utility functions to assist with implementing
|
||||||
|
* other iterator functions. The const and non-const versions
|
||||||
|
* of the "deref" protected methods expose the protected
|
||||||
|
* current_ member variable in a way that can often be
|
||||||
|
* optimized away by the compiler.
|
||||||
|
*/
|
||||||
|
const Value& deref() const;
|
||||||
|
Value& deref();
|
||||||
|
|
||||||
|
void increment();
|
||||||
|
|
||||||
|
void decrement();
|
||||||
|
|
||||||
|
difference_type computeDistance(const SelfType& other) const;
|
||||||
|
|
||||||
|
bool isEqual(const SelfType& other) const;
|
||||||
|
|
||||||
|
void copy(const SelfType& other);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Value::ObjectValues::iterator current_;
|
||||||
|
// Indicates that iterator is for a null value.
|
||||||
|
bool isNull_{true};
|
||||||
|
|
||||||
|
public:
|
||||||
|
// For some reason, BORLAND needs these at the end, rather
|
||||||
|
// than earlier. No idea why.
|
||||||
|
ValueIteratorBase();
|
||||||
|
explicit ValueIteratorBase(const Value::ObjectValues::iterator& current);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief const iterator for object and array value.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class JSON_API ValueConstIterator : public ValueIteratorBase {
|
||||||
|
friend class Value;
|
||||||
|
|
||||||
|
public:
|
||||||
|
using value_type = const Value;
|
||||||
|
// typedef unsigned int size_t;
|
||||||
|
// typedef int difference_type;
|
||||||
|
using reference = const Value&;
|
||||||
|
using pointer = const Value*;
|
||||||
|
using SelfType = ValueConstIterator;
|
||||||
|
|
||||||
|
ValueConstIterator();
|
||||||
|
ValueConstIterator(ValueIterator const& other);
|
||||||
|
|
||||||
|
private:
|
||||||
|
/*! \internal Use by Value to create an iterator.
|
||||||
|
*/
|
||||||
|
explicit ValueConstIterator(const Value::ObjectValues::iterator& current);
|
||||||
|
|
||||||
|
public:
|
||||||
|
SelfType& operator=(const ValueIteratorBase& other);
|
||||||
|
|
||||||
|
SelfType operator++(int) {
|
||||||
|
SelfType temp(*this);
|
||||||
|
++*this;
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
SelfType operator--(int) {
|
||||||
|
SelfType temp(*this);
|
||||||
|
--*this;
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
SelfType& operator--() {
|
||||||
|
decrement();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
SelfType& operator++() {
|
||||||
|
increment();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
reference operator*() const { return deref(); }
|
||||||
|
|
||||||
|
pointer operator->() const { return &deref(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Iterator for object and array value.
|
||||||
|
*/
|
||||||
|
class JSON_API ValueIterator : public ValueIteratorBase {
|
||||||
|
friend class Value;
|
||||||
|
|
||||||
|
public:
|
||||||
|
using value_type = Value;
|
||||||
|
using size_t = unsigned int;
|
||||||
|
using difference_type = int;
|
||||||
|
using reference = Value&;
|
||||||
|
using pointer = Value*;
|
||||||
|
using SelfType = ValueIterator;
|
||||||
|
|
||||||
|
ValueIterator();
|
||||||
|
explicit ValueIterator(const ValueConstIterator& other);
|
||||||
|
ValueIterator(const ValueIterator& other);
|
||||||
|
|
||||||
|
private:
|
||||||
|
/*! \internal Use by Value to create an iterator.
|
||||||
|
*/
|
||||||
|
explicit ValueIterator(const Value::ObjectValues::iterator& current);
|
||||||
|
|
||||||
|
public:
|
||||||
|
SelfType& operator=(const SelfType& other);
|
||||||
|
|
||||||
|
SelfType operator++(int) {
|
||||||
|
SelfType temp(*this);
|
||||||
|
++*this;
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
SelfType operator--(int) {
|
||||||
|
SelfType temp(*this);
|
||||||
|
--*this;
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
SelfType& operator--() {
|
||||||
|
decrement();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
SelfType& operator++() {
|
||||||
|
increment();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! The return value of non-const iterators can be
|
||||||
|
* changed, so the these functions are not const
|
||||||
|
* because the returned references/pointers can be used
|
||||||
|
* to change state of the base class.
|
||||||
|
*/
|
||||||
|
reference operator*() const { return const_cast<reference>(deref()); }
|
||||||
|
pointer operator->() const { return const_cast<pointer>(&deref()); }
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void swap(Value& a, Value& b) { a.swap(b); }
|
||||||
|
|
||||||
|
} // namespace Json
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
|
||||||
|
#endif // JSON_H_INCLUDED
|
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef JSON_VERSION_H_INCLUDED
|
||||||
|
#define JSON_VERSION_H_INCLUDED
|
||||||
|
|
||||||
|
// Note: version must be updated in three places when doing a release. This
|
||||||
|
// annoying process ensures that amalgamate, CMake, and meson all report the
|
||||||
|
// correct version.
|
||||||
|
// 1. /meson.build
|
||||||
|
// 2. /include/json/version.h
|
||||||
|
// 3. /CMakeLists.txt
|
||||||
|
// IMPORTANT: also update the SOVERSION!!
|
||||||
|
|
||||||
|
#define JSONCPP_VERSION_STRING "1.9.5"
|
||||||
|
#define JSONCPP_VERSION_MAJOR 1
|
||||||
|
#define JSONCPP_VERSION_MINOR 9
|
||||||
|
#define JSONCPP_VERSION_PATCH 5
|
||||||
|
#define JSONCPP_VERSION_QUALIFIER
|
||||||
|
#define JSONCPP_VERSION_HEXA \
|
||||||
|
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
|
||||||
|
(JSONCPP_VERSION_PATCH << 8))
|
||||||
|
|
||||||
|
#ifdef JSONCPP_USING_SECURE_MEMORY
|
||||||
|
#undef JSONCPP_USING_SECURE_MEMORY
|
||||||
|
#endif
|
||||||
|
#define JSONCPP_USING_SECURE_MEMORY 0
|
||||||
|
// If non-zero, the library zeroes any memory that it has allocated before
|
||||||
|
// it frees its memory.
|
||||||
|
|
||||||
|
#endif // JSON_VERSION_H_INCLUDED
|
@ -0,0 +1,370 @@
|
|||||||
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
// Distributed under MIT license, or public domain if desired and
|
||||||
|
// recognized in your jurisdiction.
|
||||||
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
#ifndef JSON_WRITER_H_INCLUDED
|
||||||
|
#define JSON_WRITER_H_INCLUDED
|
||||||
|
|
||||||
|
#if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
#include "value.h"
|
||||||
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
#include <ostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
|
||||||
|
// be used by...
|
||||||
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) && defined(_MSC_VER)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4251)
|
||||||
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
namespace Json {
|
||||||
|
|
||||||
|
class Value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* \code
|
||||||
|
* using namespace Json;
|
||||||
|
* void writeToStdout(StreamWriter::Factory const& factory, Value const& value)
|
||||||
|
* { std::unique_ptr<StreamWriter> const writer( factory.newStreamWriter());
|
||||||
|
* writer->write(value, &std::cout);
|
||||||
|
* std::cout << std::endl; // add lf and flush
|
||||||
|
* }
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
class JSON_API StreamWriter {
|
||||||
|
protected:
|
||||||
|
OStream* sout_; // not owned; will not delete
|
||||||
|
public:
|
||||||
|
StreamWriter();
|
||||||
|
virtual ~StreamWriter();
|
||||||
|
/** Write Value into document as configured in sub-class.
|
||||||
|
* Do not take ownership of sout, but maintain a reference during function.
|
||||||
|
* \pre sout != NULL
|
||||||
|
* \return zero on success (For now, we always return zero, so check the
|
||||||
|
* stream instead.) \throw std::exception possibly, depending on
|
||||||
|
* configuration
|
||||||
|
*/
|
||||||
|
virtual int write(Value const& root, OStream* sout) = 0;
|
||||||
|
|
||||||
|
/** \brief A simple abstract factory.
|
||||||
|
*/
|
||||||
|
class JSON_API Factory {
|
||||||
|
public:
|
||||||
|
virtual ~Factory();
|
||||||
|
/** \brief Allocate a CharReader via operator new().
|
||||||
|
* \throw std::exception if something goes wrong (e.g. invalid settings)
|
||||||
|
*/
|
||||||
|
virtual StreamWriter* newStreamWriter() const = 0;
|
||||||
|
}; // Factory
|
||||||
|
}; // StreamWriter
|
||||||
|
|
||||||
|
/** \brief Write into stringstream, then return string, for convenience.
|
||||||
|
* A StreamWriter will be created from the factory, used, and then deleted.
|
||||||
|
*/
|
||||||
|
String JSON_API writeString(StreamWriter::Factory const& factory,
|
||||||
|
Value const& root);
|
||||||
|
|
||||||
|
/** \brief Build a StreamWriter implementation.
|
||||||
|
|
||||||
|
* Usage:
|
||||||
|
* \code
|
||||||
|
* using namespace Json;
|
||||||
|
* Value value = ...;
|
||||||
|
* StreamWriterBuilder builder;
|
||||||
|
* builder["commentStyle"] = "None";
|
||||||
|
* builder["indentation"] = " "; // or whatever you like
|
||||||
|
* std::unique_ptr<Json::StreamWriter> writer(
|
||||||
|
* builder.newStreamWriter());
|
||||||
|
* writer->write(value, &std::cout);
|
||||||
|
* std::cout << std::endl; // add lf and flush
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
|
||||||
|
public:
|
||||||
|
// Note: We use a Json::Value so that we can add data-members to this class
|
||||||
|
// without a major version bump.
|
||||||
|
/** Configuration of this builder.
|
||||||
|
* Available settings (case-sensitive):
|
||||||
|
* - "commentStyle": "None" or "All"
|
||||||
|
* - "indentation": "<anything>".
|
||||||
|
* - Setting this to an empty string also omits newline characters.
|
||||||
|
* - "enableYAMLCompatibility": false or true
|
||||||
|
* - slightly change the whitespace around colons
|
||||||
|
* - "dropNullPlaceholders": false or true
|
||||||
|
* - Drop the "null" string from the writer's output for nullValues.
|
||||||
|
* Strictly speaking, this is not valid JSON. But when the output is being
|
||||||
|
* fed to a browser's JavaScript, it makes for smaller output and the
|
||||||
|
* browser can handle the output just fine.
|
||||||
|
* - "useSpecialFloats": false or true
|
||||||
|
* - If true, outputs non-finite floating point values in the following way:
|
||||||
|
* NaN values as "NaN", positive infinity as "Infinity", and negative
|
||||||
|
* infinity as "-Infinity".
|
||||||
|
* - "precision": int
|
||||||
|
* - Number of precision digits for formatting of real values.
|
||||||
|
* - "precisionType": "significant"(default) or "decimal"
|
||||||
|
* - Type of precision for formatting of real values.
|
||||||
|
* - "emitUTF8": false or true
|
||||||
|
* - If true, outputs raw UTF8 strings instead of escaping them.
|
||||||
|
|
||||||
|
* You can examine 'settings_` yourself
|
||||||
|
* to see the defaults. You can also write and read them just like any
|
||||||
|
* JSON Value.
|
||||||
|
* \sa setDefaults()
|
||||||
|
*/
|
||||||
|
Json::Value settings_;
|
||||||
|
|
||||||
|
StreamWriterBuilder();
|
||||||
|
~StreamWriterBuilder() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \throw std::exception if something goes wrong (e.g. invalid settings)
|
||||||
|
*/
|
||||||
|
StreamWriter* newStreamWriter() const override;
|
||||||
|
|
||||||
|
/** \return true if 'settings' are legal and consistent;
|
||||||
|
* otherwise, indicate bad settings via 'invalid'.
|
||||||
|
*/
|
||||||
|
bool validate(Json::Value* invalid) const;
|
||||||
|
/** A simple way to update a specific setting.
|
||||||
|
*/
|
||||||
|
Value& operator[](const String& key);
|
||||||
|
|
||||||
|
/** Called by ctor, but you can use this to reset settings_.
|
||||||
|
* \pre 'settings' != NULL (but Json::null is fine)
|
||||||
|
* \remark Defaults:
|
||||||
|
* \snippet src/lib_json/json_writer.cpp StreamWriterBuilderDefaults
|
||||||
|
*/
|
||||||
|
static void setDefaults(Json::Value* settings);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Abstract class for writers.
|
||||||
|
* \deprecated Use StreamWriter. (And really, this is an implementation detail.)
|
||||||
|
*/
|
||||||
|
class JSON_API Writer {
|
||||||
|
public:
|
||||||
|
virtual ~Writer();
|
||||||
|
|
||||||
|
virtual String write(const Value& root) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format
|
||||||
|
*without formatting (not human friendly).
|
||||||
|
*
|
||||||
|
* The JSON document is written in a single line. It is not intended for 'human'
|
||||||
|
*consumption,
|
||||||
|
* but may be useful to support feature such as RPC where bandwidth is limited.
|
||||||
|
* \sa Reader, Value
|
||||||
|
* \deprecated Use StreamWriterBuilder.
|
||||||
|
*/
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4996) // Deriving from deprecated class
|
||||||
|
#endif
|
||||||
|
class JSON_API FastWriter
|
||||||
|
: public Writer {
|
||||||
|
public:
|
||||||
|
FastWriter();
|
||||||
|
~FastWriter() override = default;
|
||||||
|
|
||||||
|
void enableYAMLCompatibility();
|
||||||
|
|
||||||
|
/** \brief Drop the "null" string from the writer's output for nullValues.
|
||||||
|
* Strictly speaking, this is not valid JSON. But when the output is being
|
||||||
|
* fed to a browser's JavaScript, it makes for smaller output and the
|
||||||
|
* browser can handle the output just fine.
|
||||||
|
*/
|
||||||
|
void dropNullPlaceholders();
|
||||||
|
|
||||||
|
void omitEndingLineFeed();
|
||||||
|
|
||||||
|
public: // overridden from Writer
|
||||||
|
String write(const Value& root) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void writeValue(const Value& value);
|
||||||
|
|
||||||
|
String document_;
|
||||||
|
bool yamlCompatibilityEnabled_{false};
|
||||||
|
bool dropNullPlaceholders_{false};
|
||||||
|
bool omitEndingLineFeed_{false};
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
|
||||||
|
*human friendly way.
|
||||||
|
*
|
||||||
|
* The rules for line break and indent are as follow:
|
||||||
|
* - Object value:
|
||||||
|
* - if empty then print {} without indent and line break
|
||||||
|
* - if not empty the print '{', line break & indent, print one value per
|
||||||
|
*line
|
||||||
|
* and then unindent and line break and print '}'.
|
||||||
|
* - Array value:
|
||||||
|
* - if empty then print [] without indent and line break
|
||||||
|
* - if the array contains no object value, empty array or some other value
|
||||||
|
*types,
|
||||||
|
* and all the values fit on one lines, then print the array on a single
|
||||||
|
*line.
|
||||||
|
* - otherwise, it the values do not fit on one line, or the array contains
|
||||||
|
* object or non empty array, then print one value per line.
|
||||||
|
*
|
||||||
|
* If the Value have comments then they are outputted according to their
|
||||||
|
*#CommentPlacement.
|
||||||
|
*
|
||||||
|
* \sa Reader, Value, Value::setComment()
|
||||||
|
* \deprecated Use StreamWriterBuilder.
|
||||||
|
*/
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4996) // Deriving from deprecated class
|
||||||
|
#endif
|
||||||
|
class JSON_API
|
||||||
|
StyledWriter : public Writer {
|
||||||
|
public:
|
||||||
|
StyledWriter();
|
||||||
|
~StyledWriter() override = default;
|
||||||
|
|
||||||
|
public: // overridden from Writer
|
||||||
|
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
|
||||||
|
* \param root Value to serialize.
|
||||||
|
* \return String containing the JSON document that represents the root value.
|
||||||
|
*/
|
||||||
|
String write(const Value& root) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void writeValue(const Value& value);
|
||||||
|
void writeArrayValue(const Value& value);
|
||||||
|
bool isMultilineArray(const Value& value);
|
||||||
|
void pushValue(const String& value);
|
||||||
|
void writeIndent();
|
||||||
|
void writeWithIndent(const String& value);
|
||||||
|
void indent();
|
||||||
|
void unindent();
|
||||||
|
void writeCommentBeforeValue(const Value& root);
|
||||||
|
void writeCommentAfterValueOnSameLine(const Value& root);
|
||||||
|
static bool hasCommentForValue(const Value& value);
|
||||||
|
static String normalizeEOL(const String& text);
|
||||||
|
|
||||||
|
using ChildValues = std::vector<String>;
|
||||||
|
|
||||||
|
ChildValues childValues_;
|
||||||
|
String document_;
|
||||||
|
String indentString_;
|
||||||
|
unsigned int rightMargin_{74};
|
||||||
|
unsigned int indentSize_{3};
|
||||||
|
bool addChildValues_{false};
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
|
||||||
|
human friendly way,
|
||||||
|
to a stream rather than to a string.
|
||||||
|
*
|
||||||
|
* The rules for line break and indent are as follow:
|
||||||
|
* - Object value:
|
||||||
|
* - if empty then print {} without indent and line break
|
||||||
|
* - if not empty the print '{', line break & indent, print one value per
|
||||||
|
line
|
||||||
|
* and then unindent and line break and print '}'.
|
||||||
|
* - Array value:
|
||||||
|
* - if empty then print [] without indent and line break
|
||||||
|
* - if the array contains no object value, empty array or some other value
|
||||||
|
types,
|
||||||
|
* and all the values fit on one lines, then print the array on a single
|
||||||
|
line.
|
||||||
|
* - otherwise, it the values do not fit on one line, or the array contains
|
||||||
|
* object or non empty array, then print one value per line.
|
||||||
|
*
|
||||||
|
* If the Value have comments then they are outputted according to their
|
||||||
|
#CommentPlacement.
|
||||||
|
*
|
||||||
|
* \sa Reader, Value, Value::setComment()
|
||||||
|
* \deprecated Use StreamWriterBuilder.
|
||||||
|
*/
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4996) // Deriving from deprecated class
|
||||||
|
#endif
|
||||||
|
class JSON_API
|
||||||
|
StyledStreamWriter {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* \param indentation Each level will be indented by this amount extra.
|
||||||
|
*/
|
||||||
|
StyledStreamWriter(String indentation = "\t");
|
||||||
|
~StyledStreamWriter() = default;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
|
||||||
|
* \param out Stream to write to. (Can be ostringstream, e.g.)
|
||||||
|
* \param root Value to serialize.
|
||||||
|
* \note There is no point in deriving from Writer, since write() should not
|
||||||
|
* return a value.
|
||||||
|
*/
|
||||||
|
void write(OStream& out, const Value& root);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void writeValue(const Value& value);
|
||||||
|
void writeArrayValue(const Value& value);
|
||||||
|
bool isMultilineArray(const Value& value);
|
||||||
|
void pushValue(const String& value);
|
||||||
|
void writeIndent();
|
||||||
|
void writeWithIndent(const String& value);
|
||||||
|
void indent();
|
||||||
|
void unindent();
|
||||||
|
void writeCommentBeforeValue(const Value& root);
|
||||||
|
void writeCommentAfterValueOnSameLine(const Value& root);
|
||||||
|
static bool hasCommentForValue(const Value& value);
|
||||||
|
static String normalizeEOL(const String& text);
|
||||||
|
|
||||||
|
using ChildValues = std::vector<String>;
|
||||||
|
|
||||||
|
ChildValues childValues_;
|
||||||
|
OStream* document_;
|
||||||
|
String indentString_;
|
||||||
|
unsigned int rightMargin_{74};
|
||||||
|
String indentation_;
|
||||||
|
bool addChildValues_ : 1;
|
||||||
|
bool indented_ : 1;
|
||||||
|
};
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(JSON_HAS_INT64)
|
||||||
|
String JSON_API valueToString(Int value);
|
||||||
|
String JSON_API valueToString(UInt value);
|
||||||
|
#endif // if defined(JSON_HAS_INT64)
|
||||||
|
String JSON_API valueToString(LargestInt value);
|
||||||
|
String JSON_API valueToString(LargestUInt value);
|
||||||
|
String JSON_API valueToString(
|
||||||
|
double value, unsigned int precision = Value::defaultRealPrecision,
|
||||||
|
PrecisionType precisionType = PrecisionType::significantDigits);
|
||||||
|
String JSON_API valueToString(bool value);
|
||||||
|
String JSON_API valueToQuotedString(const char* value);
|
||||||
|
|
||||||
|
/// \brief Output using the StyledStreamWriter.
|
||||||
|
/// \see Json::operator>>()
|
||||||
|
JSON_API OStream& operator<<(OStream&, const Value& root);
|
||||||
|
|
||||||
|
} // namespace Json
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
|
||||||
|
#endif // JSON_WRITER_H_INCLUDED
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,138 @@
|
|||||||
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
// Distributed under MIT license, or public domain if desired and
|
||||||
|
// recognized in your jurisdiction.
|
||||||
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
||||||
|
#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
||||||
|
|
||||||
|
#if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
#include <json/config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Also support old flag NO_LOCALE_SUPPORT
|
||||||
|
#ifdef NO_LOCALE_SUPPORT
|
||||||
|
#define JSONCPP_NO_LOCALE_SUPPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef JSONCPP_NO_LOCALE_SUPPORT
|
||||||
|
#include <clocale>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This header provides common string manipulation support, such as UTF-8,
|
||||||
|
* portable conversion from/to string...
|
||||||
|
*
|
||||||
|
* It is an internal header that must not be exposed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Json {
|
||||||
|
static inline char getDecimalPoint() {
|
||||||
|
#ifdef JSONCPP_NO_LOCALE_SUPPORT
|
||||||
|
return '\0';
|
||||||
|
#else
|
||||||
|
struct lconv* lc = localeconv();
|
||||||
|
return lc ? *(lc->decimal_point) : '\0';
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Converts a unicode code-point to UTF-8.
|
||||||
|
static inline String codePointToUTF8(unsigned int cp) {
|
||||||
|
String result;
|
||||||
|
|
||||||
|
// based on description from http://en.wikipedia.org/wiki/UTF-8
|
||||||
|
|
||||||
|
if (cp <= 0x7f) {
|
||||||
|
result.resize(1);
|
||||||
|
result[0] = static_cast<char>(cp);
|
||||||
|
} else if (cp <= 0x7FF) {
|
||||||
|
result.resize(2);
|
||||||
|
result[1] = static_cast<char>(0x80 | (0x3f & cp));
|
||||||
|
result[0] = static_cast<char>(0xC0 | (0x1f & (cp >> 6)));
|
||||||
|
} else if (cp <= 0xFFFF) {
|
||||||
|
result.resize(3);
|
||||||
|
result[2] = static_cast<char>(0x80 | (0x3f & cp));
|
||||||
|
result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
|
||||||
|
result[0] = static_cast<char>(0xE0 | (0xf & (cp >> 12)));
|
||||||
|
} else if (cp <= 0x10FFFF) {
|
||||||
|
result.resize(4);
|
||||||
|
result[3] = static_cast<char>(0x80 | (0x3f & cp));
|
||||||
|
result[2] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
|
||||||
|
result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 12)));
|
||||||
|
result[0] = static_cast<char>(0xF0 | (0x7 & (cp >> 18)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum {
|
||||||
|
/// Constant that specify the size of the buffer that must be passed to
|
||||||
|
/// uintToString.
|
||||||
|
uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1
|
||||||
|
};
|
||||||
|
|
||||||
|
// Defines a char buffer for use with uintToString().
|
||||||
|
using UIntToStringBuffer = char[uintToStringBufferSize];
|
||||||
|
|
||||||
|
/** Converts an unsigned integer to string.
|
||||||
|
* @param value Unsigned integer to convert to string
|
||||||
|
* @param current Input/Output string buffer.
|
||||||
|
* Must have at least uintToStringBufferSize chars free.
|
||||||
|
*/
|
||||||
|
static inline void uintToString(LargestUInt value, char*& current) {
|
||||||
|
*--current = 0;
|
||||||
|
do {
|
||||||
|
*--current = static_cast<char>(value % 10U + static_cast<unsigned>('0'));
|
||||||
|
value /= 10;
|
||||||
|
} while (value != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Change ',' to '.' everywhere in buffer.
|
||||||
|
*
|
||||||
|
* We had a sophisticated way, but it did not work in WinCE.
|
||||||
|
* @see https://github.com/open-source-parsers/jsoncpp/pull/9
|
||||||
|
*/
|
||||||
|
template <typename Iter> Iter fixNumericLocale(Iter begin, Iter end) {
|
||||||
|
for (; begin != end; ++begin) {
|
||||||
|
if (*begin == ',') {
|
||||||
|
*begin = '.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return begin;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Iter> void fixNumericLocaleInput(Iter begin, Iter end) {
|
||||||
|
char decimalPoint = getDecimalPoint();
|
||||||
|
if (decimalPoint == '\0' || decimalPoint == '.') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (; begin != end; ++begin) {
|
||||||
|
if (*begin == '.') {
|
||||||
|
*begin = decimalPoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return iterator that would be the new end of the range [begin,end), if we
|
||||||
|
* were to delete zeros in the end of string, but not the last zero before '.'.
|
||||||
|
*/
|
||||||
|
template <typename Iter>
|
||||||
|
Iter fixZerosInTheEnd(Iter begin, Iter end, unsigned int precision) {
|
||||||
|
for (; begin != end; --end) {
|
||||||
|
if (*(end - 1) != '0') {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
// Don't delete the last zero before the decimal point.
|
||||||
|
if (begin != (end - 1) && begin != (end - 2) && *(end - 2) == '.') {
|
||||||
|
if (precision) {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
return end - 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Json
|
||||||
|
|
||||||
|
#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,156 @@
|
|||||||
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
// Distributed under MIT license, or public domain if desired and
|
||||||
|
// recognized in your jurisdiction.
|
||||||
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
// included by json_value.cpp
|
||||||
|
|
||||||
|
namespace Json {
|
||||||
|
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// class ValueIteratorBase
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
ValueIteratorBase::ValueIteratorBase() : current_() {}
|
||||||
|
|
||||||
|
ValueIteratorBase::ValueIteratorBase(
|
||||||
|
const Value::ObjectValues::iterator& current)
|
||||||
|
: current_(current), isNull_(false) {}
|
||||||
|
|
||||||
|
Value& ValueIteratorBase::deref() { return current_->second; }
|
||||||
|
const Value& ValueIteratorBase::deref() const { return current_->second; }
|
||||||
|
|
||||||
|
void ValueIteratorBase::increment() { ++current_; }
|
||||||
|
|
||||||
|
void ValueIteratorBase::decrement() { --current_; }
|
||||||
|
|
||||||
|
ValueIteratorBase::difference_type
|
||||||
|
ValueIteratorBase::computeDistance(const SelfType& other) const {
|
||||||
|
// Iterator for null value are initialized using the default
|
||||||
|
// constructor, which initialize current_ to the default
|
||||||
|
// std::map::iterator. As begin() and end() are two instance
|
||||||
|
// of the default std::map::iterator, they can not be compared.
|
||||||
|
// To allow this, we handle this comparison specifically.
|
||||||
|
if (isNull_ && other.isNull_) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Usage of std::distance is not portable (does not compile with Sun Studio 12
|
||||||
|
// RogueWave STL,
|
||||||
|
// which is the one used by default).
|
||||||
|
// Using a portable hand-made version for non random iterator instead:
|
||||||
|
// return difference_type( std::distance( current_, other.current_ ) );
|
||||||
|
difference_type myDistance = 0;
|
||||||
|
for (Value::ObjectValues::iterator it = current_; it != other.current_;
|
||||||
|
++it) {
|
||||||
|
++myDistance;
|
||||||
|
}
|
||||||
|
return myDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ValueIteratorBase::isEqual(const SelfType& other) const {
|
||||||
|
if (isNull_) {
|
||||||
|
return other.isNull_;
|
||||||
|
}
|
||||||
|
return current_ == other.current_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ValueIteratorBase::copy(const SelfType& other) {
|
||||||
|
current_ = other.current_;
|
||||||
|
isNull_ = other.isNull_;
|
||||||
|
}
|
||||||
|
|
||||||
|
Value ValueIteratorBase::key() const {
|
||||||
|
const Value::CZString czstring = (*current_).first;
|
||||||
|
if (czstring.data()) {
|
||||||
|
if (czstring.isStaticString())
|
||||||
|
return Value(StaticString(czstring.data()));
|
||||||
|
return Value(czstring.data(), czstring.data() + czstring.length());
|
||||||
|
}
|
||||||
|
return Value(czstring.index());
|
||||||
|
}
|
||||||
|
|
||||||
|
UInt ValueIteratorBase::index() const {
|
||||||
|
const Value::CZString czstring = (*current_).first;
|
||||||
|
if (!czstring.data())
|
||||||
|
return czstring.index();
|
||||||
|
return Value::UInt(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ValueIteratorBase::name() const {
|
||||||
|
char const* keey;
|
||||||
|
char const* end;
|
||||||
|
keey = memberName(&end);
|
||||||
|
if (!keey)
|
||||||
|
return String();
|
||||||
|
return String(keey, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
char const* ValueIteratorBase::memberName() const {
|
||||||
|
const char* cname = (*current_).first.data();
|
||||||
|
return cname ? cname : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
char const* ValueIteratorBase::memberName(char const** end) const {
|
||||||
|
const char* cname = (*current_).first.data();
|
||||||
|
if (!cname) {
|
||||||
|
*end = nullptr;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
*end = cname + (*current_).first.length();
|
||||||
|
return cname;
|
||||||
|
}
|
||||||
|
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// class ValueConstIterator
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
ValueConstIterator::ValueConstIterator() = default;
|
||||||
|
|
||||||
|
ValueConstIterator::ValueConstIterator(
|
||||||
|
const Value::ObjectValues::iterator& current)
|
||||||
|
: ValueIteratorBase(current) {}
|
||||||
|
|
||||||
|
ValueConstIterator::ValueConstIterator(ValueIterator const& other)
|
||||||
|
: ValueIteratorBase(other) {}
|
||||||
|
|
||||||
|
ValueConstIterator& ValueConstIterator::
|
||||||
|
operator=(const ValueIteratorBase& other) {
|
||||||
|
copy(other);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// class ValueIterator
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
ValueIterator::ValueIterator() = default;
|
||||||
|
|
||||||
|
ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current)
|
||||||
|
: ValueIteratorBase(current) {}
|
||||||
|
|
||||||
|
ValueIterator::ValueIterator(const ValueConstIterator& other)
|
||||||
|
: ValueIteratorBase(other) {
|
||||||
|
throwRuntimeError("ConstIterator to Iterator should never be allowed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ValueIterator::ValueIterator(const ValueIterator& other) = default;
|
||||||
|
|
||||||
|
ValueIterator& ValueIterator::operator=(const SelfType& other) {
|
||||||
|
copy(other);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Json
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
|||||||
|
@JSONCPP_VERSION@
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016-2020 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/C++ on VMS, and is included automatically
|
||||||
|
* after each header file from this directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The C++ compiler doesn't understand these pragmas, even though it
|
||||||
|
* understands the corresponding command line qualifier.
|
||||||
|
*/
|
||||||
|
#ifndef __cplusplus
|
||||||
|
/* restore state. Must correspond to the save in __decc_include_prologue.h */
|
||||||
|
# pragma names restore
|
||||||
|
#endif
|
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016-2020 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/C++ on VMS, and is included automatically
|
||||||
|
* after each header file from this directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The C++ compiler doesn't understand these pragmas, even though it
|
||||||
|
* understands the corresponding command line qualifier.
|
||||||
|
*/
|
||||||
|
#ifndef __cplusplus
|
||||||
|
/* 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
|
||||||
|
#endif
|
@ -1,579 +1,10 @@
|
|||||||
/* crypto/asn1/asn1_mac.h */
|
|
||||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This package is an SSL implementation written
|
|
||||||
* by Eric Young (eay@cryptsoft.com).
|
|
||||||
* The implementation was written so as to conform with Netscapes SSL.
|
|
||||||
*
|
|
||||||
* This library is free for commercial and non-commercial use as long as
|
|
||||||
* the following conditions are aheared to. The following conditions
|
|
||||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
|
||||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
|
||||||
* included with this distribution is covered by the same copyright terms
|
|
||||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
|
||||||
*
|
|
||||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
|
||||||
* the code are not to be removed.
|
|
||||||
* If this package is used in a product, Eric Young should be given attribution
|
|
||||||
* as the author of the parts of the library used.
|
|
||||||
* This can be in the form of a textual message at program startup or
|
|
||||||
* in documentation (online or textual) provided with the package.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* "This product includes cryptographic software written by
|
|
||||||
* Eric Young (eay@cryptsoft.com)"
|
|
||||||
* The word 'cryptographic' can be left out if the rouines from the library
|
|
||||||
* being used are not cryptographic related :-).
|
|
||||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
|
||||||
* the apps directory (application code) you must include an acknowledgement:
|
|
||||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* The licence and distribution terms for any publically available version or
|
|
||||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
|
||||||
* copied and put under another distribution licence
|
|
||||||
* [including the GNU Public Licence.]
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef HEADER_ASN1_MAC_H
|
|
||||||
# define HEADER_ASN1_MAC_H
|
|
||||||
|
|
||||||
# include <openssl/asn1.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifndef ASN1_MAC_ERR_LIB
|
|
||||||
# define ASN1_MAC_ERR_LIB ERR_LIB_ASN1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# define ASN1_MAC_H_err(f,r,line) \
|
|
||||||
ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_vars(a,type,func) \
|
|
||||||
ASN1_const_CTX c; \
|
|
||||||
type ret=NULL; \
|
|
||||||
\
|
|
||||||
c.pp=(const unsigned char **)pp; \
|
|
||||||
c.q= *(const unsigned char **)pp; \
|
|
||||||
c.error=ERR_R_NESTED_ASN1_ERROR; \
|
|
||||||
if ((a == NULL) || ((*a) == NULL)) \
|
|
||||||
{ if ((ret=(type)func()) == NULL) \
|
|
||||||
{ c.line=__LINE__; goto err; } } \
|
|
||||||
else ret=(*a);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_Init() \
|
|
||||||
c.p= *(const unsigned char **)pp; \
|
|
||||||
c.max=(length == 0)?0:(c.p+length);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_Finish_2(a) \
|
|
||||||
if (!asn1_const_Finish(&c)) \
|
|
||||||
{ c.line=__LINE__; goto err; } \
|
|
||||||
*(const unsigned char **)pp=c.p; \
|
|
||||||
if (a != NULL) (*a)=ret; \
|
|
||||||
return(ret);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_Finish(a,func,e) \
|
|
||||||
M_ASN1_D2I_Finish_2(a); \
|
|
||||||
err:\
|
|
||||||
ASN1_MAC_H_err((e),c.error,c.line); \
|
|
||||||
asn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \
|
|
||||||
if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
|
|
||||||
return(NULL)
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_start_sequence() \
|
|
||||||
if (!asn1_GetSequence(&c,&length)) \
|
|
||||||
{ c.line=__LINE__; goto err; }
|
|
||||||
/* Begin reading ASN1 without a surrounding sequence */
|
|
||||||
# define M_ASN1_D2I_begin() \
|
|
||||||
c.slen = length;
|
|
||||||
|
|
||||||
/* End reading ASN1 with no check on length */
|
|
||||||
# define M_ASN1_D2I_Finish_nolen(a, func, e) \
|
|
||||||
*pp=c.p; \
|
|
||||||
if (a != NULL) (*a)=ret; \
|
|
||||||
return(ret); \
|
|
||||||
err:\
|
|
||||||
ASN1_MAC_H_err((e),c.error,c.line); \
|
|
||||||
asn1_add_error(*pp,(int)(c.q- *pp)); \
|
|
||||||
if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
|
|
||||||
return(NULL)
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_end_sequence() \
|
|
||||||
(((c.inf&1) == 0)?(c.slen <= 0): \
|
|
||||||
(c.eos=ASN1_const_check_infinite_end(&c.p,c.slen)))
|
|
||||||
|
|
||||||
/* Don't use this with d2i_ASN1_BOOLEAN() */
|
|
||||||
# define M_ASN1_D2I_get(b, func) \
|
|
||||||
c.q=c.p; \
|
|
||||||
if (func(&(b),&c.p,c.slen) == NULL) \
|
|
||||||
{c.line=__LINE__; goto err; } \
|
|
||||||
c.slen-=(c.p-c.q);
|
|
||||||
|
|
||||||
/* Don't use this with d2i_ASN1_BOOLEAN() */
|
|
||||||
# define M_ASN1_D2I_get_x(type,b,func) \
|
|
||||||
c.q=c.p; \
|
|
||||||
if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \
|
|
||||||
{c.line=__LINE__; goto err; } \
|
|
||||||
c.slen-=(c.p-c.q);
|
|
||||||
|
|
||||||
/* use this instead () */
|
|
||||||
# define M_ASN1_D2I_get_int(b,func) \
|
|
||||||
c.q=c.p; \
|
|
||||||
if (func(&(b),&c.p,c.slen) < 0) \
|
|
||||||
{c.line=__LINE__; goto err; } \
|
|
||||||
c.slen-=(c.p-c.q);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_opt(b,func,type) \
|
|
||||||
if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \
|
|
||||||
== (V_ASN1_UNIVERSAL|(type)))) \
|
|
||||||
{ \
|
|
||||||
M_ASN1_D2I_get(b,func); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_int_opt(b,func,type) \
|
|
||||||
if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \
|
|
||||||
== (V_ASN1_UNIVERSAL|(type)))) \
|
|
||||||
{ \
|
|
||||||
M_ASN1_D2I_get_int(b,func); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_imp(b,func, type) \
|
|
||||||
M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \
|
|
||||||
c.q=c.p; \
|
|
||||||
if (func(&(b),&c.p,c.slen) == NULL) \
|
|
||||||
{c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \
|
|
||||||
c.slen-=(c.p-c.q);\
|
|
||||||
M_ASN1_next_prev=_tmp;
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \
|
|
||||||
if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \
|
|
||||||
(V_ASN1_CONTEXT_SPECIFIC|(tag)))) \
|
|
||||||
{ \
|
|
||||||
unsigned char _tmp = M_ASN1_next; \
|
|
||||||
M_ASN1_D2I_get_imp(b,func, type);\
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_set(r,func,free_func) \
|
|
||||||
M_ASN1_D2I_get_imp_set(r,func,free_func, \
|
|
||||||
V_ASN1_SET,V_ASN1_UNIVERSAL);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_set_type(type,r,func,free_func) \
|
|
||||||
M_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \
|
|
||||||
V_ASN1_SET,V_ASN1_UNIVERSAL);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_set_opt(r,func,free_func) \
|
|
||||||
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
|
|
||||||
V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
|
|
||||||
{ M_ASN1_D2I_get_set(r,func,free_func); }
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_set_opt_type(type,r,func,free_func) \
|
|
||||||
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
|
|
||||||
V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
|
|
||||||
{ M_ASN1_D2I_get_set_type(type,r,func,free_func); }
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_SET_opt(a,f) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
|
||||||
M_ASN1_I2D_len_SET(a,f);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_SET_opt(a,f) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
|
||||||
M_ASN1_I2D_put_SET(a,f);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
|
||||||
M_ASN1_I2D_put_SEQUENCE(a,f);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_SEQUENCE_opt_type(type,a,f) \
|
|
||||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
|
||||||
M_ASN1_I2D_put_SEQUENCE_type(type,a,f);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \
|
|
||||||
if ((c.slen != 0) && \
|
|
||||||
(M_ASN1_next == \
|
|
||||||
(V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
|
|
||||||
{ \
|
|
||||||
M_ASN1_D2I_get_imp_set(b,func,free_func,\
|
|
||||||
tag,V_ASN1_CONTEXT_SPECIFIC); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_IMP_set_opt_type(type,b,func,free_func,tag) \
|
|
||||||
if ((c.slen != 0) && \
|
|
||||||
(M_ASN1_next == \
|
|
||||||
(V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
|
|
||||||
{ \
|
|
||||||
M_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\
|
|
||||||
tag,V_ASN1_CONTEXT_SPECIFIC); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_seq(r,func,free_func) \
|
|
||||||
M_ASN1_D2I_get_imp_set(r,func,free_func,\
|
|
||||||
V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \
|
|
||||||
M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
|
|
||||||
V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_seq_opt(r,func,free_func) \
|
|
||||||
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
|
|
||||||
V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
|
|
||||||
{ M_ASN1_D2I_get_seq(r,func,free_func); }
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_seq_opt_type(type,r,func,free_func) \
|
|
||||||
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
|
|
||||||
V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
|
|
||||||
{ M_ASN1_D2I_get_seq_type(type,r,func,free_func); }
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_IMP_set(r,func,free_func,x) \
|
|
||||||
M_ASN1_D2I_get_imp_set(r,func,free_func,\
|
|
||||||
x,V_ASN1_CONTEXT_SPECIFIC);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \
|
|
||||||
M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
|
|
||||||
x,V_ASN1_CONTEXT_SPECIFIC);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \
|
|
||||||
c.q=c.p; \
|
|
||||||
if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\
|
|
||||||
(void (*)())free_func,a,b) == NULL) \
|
|
||||||
{ c.line=__LINE__; goto err; } \
|
|
||||||
c.slen-=(c.p-c.q);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \
|
|
||||||
c.q=c.p; \
|
|
||||||
if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\
|
|
||||||
free_func,a,b) == NULL) \
|
|
||||||
{ c.line=__LINE__; goto err; } \
|
|
||||||
c.slen-=(c.p-c.q);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_set_strings(r,func,a,b) \
|
|
||||||
c.q=c.p; \
|
|
||||||
if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \
|
|
||||||
{ c.line=__LINE__; goto err; } \
|
|
||||||
c.slen-=(c.p-c.q);
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_EXP_opt(r,func,tag) \
|
|
||||||
if ((c.slen != 0L) && (M_ASN1_next == \
|
|
||||||
(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
|
|
||||||
{ \
|
|
||||||
int Tinf,Ttag,Tclass; \
|
|
||||||
long Tlen; \
|
|
||||||
\
|
|
||||||
c.q=c.p; \
|
|
||||||
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
|
|
||||||
if (Tinf & 0x80) \
|
|
||||||
{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
|
|
||||||
c.line=__LINE__; goto err; } \
|
|
||||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
|
|
||||||
Tlen = c.slen - (c.p - c.q) - 2; \
|
|
||||||
if (func(&(r),&c.p,Tlen) == NULL) \
|
|
||||||
{ c.line=__LINE__; goto err; } \
|
|
||||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
|
|
||||||
Tlen = c.slen - (c.p - c.q); \
|
|
||||||
if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \
|
|
||||||
{ c.error=ERR_R_MISSING_ASN1_EOS; \
|
|
||||||
c.line=__LINE__; goto err; } \
|
|
||||||
}\
|
|
||||||
c.slen-=(c.p-c.q); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_EXP_set_opt(r,func,free_func,tag,b) \
|
|
||||||
if ((c.slen != 0) && (M_ASN1_next == \
|
|
||||||
(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
|
|
||||||
{ \
|
|
||||||
int Tinf,Ttag,Tclass; \
|
|
||||||
long Tlen; \
|
|
||||||
\
|
|
||||||
c.q=c.p; \
|
|
||||||
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
|
|
||||||
if (Tinf & 0x80) \
|
|
||||||
{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
|
|
||||||
c.line=__LINE__; goto err; } \
|
|
||||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
|
|
||||||
Tlen = c.slen - (c.p - c.q) - 2; \
|
|
||||||
if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \
|
|
||||||
(void (*)())free_func, \
|
|
||||||
b,V_ASN1_UNIVERSAL) == NULL) \
|
|
||||||
{ c.line=__LINE__; goto err; } \
|
|
||||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
|
|
||||||
Tlen = c.slen - (c.p - c.q); \
|
|
||||||
if(!ASN1_check_infinite_end(&c.p, Tlen)) \
|
|
||||||
{ c.error=ERR_R_MISSING_ASN1_EOS; \
|
|
||||||
c.line=__LINE__; goto err; } \
|
|
||||||
}\
|
|
||||||
c.slen-=(c.p-c.q); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_D2I_get_EXP_set_opt_type(type,r,func,free_func,tag,b) \
|
|
||||||
if ((c.slen != 0) && (M_ASN1_next == \
|
|
||||||
(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
|
|
||||||
{ \
|
|
||||||
int Tinf,Ttag,Tclass; \
|
|
||||||
long Tlen; \
|
|
||||||
\
|
|
||||||
c.q=c.p; \
|
|
||||||
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
|
|
||||||
if (Tinf & 0x80) \
|
|
||||||
{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
|
|
||||||
c.line=__LINE__; goto err; } \
|
|
||||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
|
|
||||||
Tlen = c.slen - (c.p - c.q) - 2; \
|
|
||||||
if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \
|
|
||||||
free_func,b,V_ASN1_UNIVERSAL) == NULL) \
|
|
||||||
{ c.line=__LINE__; goto err; } \
|
|
||||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
|
|
||||||
Tlen = c.slen - (c.p - c.q); \
|
|
||||||
if(!ASN1_check_infinite_end(&c.p, Tlen)) \
|
|
||||||
{ c.error=ERR_R_MISSING_ASN1_EOS; \
|
|
||||||
c.line=__LINE__; goto err; } \
|
|
||||||
}\
|
|
||||||
c.slen-=(c.p-c.q); \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* New macros */
|
|
||||||
# define M_ASN1_New_Malloc(ret,type) \
|
|
||||||
if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \
|
|
||||||
{ c.line=__LINE__; goto err2; }
|
|
||||||
|
|
||||||
# define M_ASN1_New(arg,func) \
|
|
||||||
if (((arg)=func()) == NULL) return(NULL)
|
|
||||||
|
|
||||||
# define M_ASN1_New_Error(a) \
|
|
||||||
/*- err: ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \
|
|
||||||
return(NULL);*/ \
|
|
||||||
err2: ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \
|
|
||||||
return(NULL)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately, some
|
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
* macros that use ASN1_const_CTX still insist on writing in the input
|
*
|
||||||
* stream. ARGH! ARGH! ARGH! Let's get rid of this macro package. Please? --
|
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||||
* Richard Levitte
|
* 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
|
||||||
*/
|
*/
|
||||||
# define M_ASN1_next (*((unsigned char *)(c.p)))
|
|
||||||
# define M_ASN1_next_prev (*((unsigned char *)(c.q)))
|
|
||||||
|
|
||||||
/*************************************************/
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_vars(a) int r=0,ret=0; \
|
|
||||||
unsigned char *p; \
|
|
||||||
if (a == NULL) return(0)
|
|
||||||
|
|
||||||
/* Length Macros */
|
|
||||||
# define M_ASN1_I2D_len(a,f) ret+=f(a,NULL)
|
|
||||||
# define M_ASN1_I2D_len_IMP_opt(a,f) if (a != NULL) M_ASN1_I2D_len(a,f)
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_SET(a,f) \
|
|
||||||
ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_SET_type(type,a,f) \
|
|
||||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \
|
|
||||||
V_ASN1_UNIVERSAL,IS_SET);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_SEQUENCE(a,f) \
|
|
||||||
ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
|
|
||||||
IS_SEQUENCE);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \
|
|
||||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \
|
|
||||||
V_ASN1_UNIVERSAL,IS_SEQUENCE)
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
|
||||||
M_ASN1_I2D_len_SEQUENCE(a,f);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_SEQUENCE_opt_type(type,a,f) \
|
|
||||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
|
||||||
M_ASN1_I2D_len_SEQUENCE_type(type,a,f);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_IMP_SET(a,f,x) \
|
|
||||||
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \
|
|
||||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
|
|
||||||
V_ASN1_CONTEXT_SPECIFIC,IS_SET);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
|
||||||
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
|
||||||
IS_SET);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \
|
|
||||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
|
||||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
|
|
||||||
V_ASN1_CONTEXT_SPECIFIC,IS_SET);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \
|
|
||||||
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
|
||||||
IS_SEQUENCE);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a,f,x) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
|
||||||
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
|
||||||
IS_SEQUENCE);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type,a,f,x) \
|
|
||||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
|
||||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
|
|
||||||
V_ASN1_CONTEXT_SPECIFIC, \
|
|
||||||
IS_SEQUENCE);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \
|
|
||||||
if (a != NULL)\
|
|
||||||
{ \
|
|
||||||
v=f(a,NULL); \
|
|
||||||
ret+=ASN1_object_size(1,v,mtag); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_EXP_SET_opt(a,f,mtag,tag,v) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0))\
|
|
||||||
{ \
|
|
||||||
v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
|
|
||||||
ret+=ASN1_object_size(1,v,mtag); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0))\
|
|
||||||
{ \
|
|
||||||
v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \
|
|
||||||
IS_SEQUENCE); \
|
|
||||||
ret+=ASN1_object_size(1,v,mtag); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \
|
|
||||||
if ((a != NULL) && (sk_##type##_num(a) != 0))\
|
|
||||||
{ \
|
|
||||||
v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \
|
|
||||||
V_ASN1_UNIVERSAL, \
|
|
||||||
IS_SEQUENCE); \
|
|
||||||
ret+=ASN1_object_size(1,v,mtag); \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Put Macros */
|
|
||||||
# define M_ASN1_I2D_put(a,f) f(a,&p)
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_IMP_opt(a,f,t) \
|
|
||||||
if (a != NULL) \
|
|
||||||
{ \
|
|
||||||
unsigned char *q=p; \
|
|
||||||
f(a,&p); \
|
|
||||||
*q=(V_ASN1_CONTEXT_SPECIFIC|t|(*q&V_ASN1_CONSTRUCTED));\
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\
|
|
||||||
V_ASN1_UNIVERSAL,IS_SET)
|
|
||||||
# define M_ASN1_I2D_put_SET_type(type,a,f) \
|
|
||||||
i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET)
|
|
||||||
# define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
|
|
||||||
V_ASN1_CONTEXT_SPECIFIC,IS_SET)
|
|
||||||
# define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \
|
|
||||||
i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET)
|
|
||||||
# define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
|
|
||||||
V_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE)
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\
|
|
||||||
V_ASN1_UNIVERSAL,IS_SEQUENCE)
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \
|
|
||||||
i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
|
|
||||||
IS_SEQUENCE)
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
|
||||||
M_ASN1_I2D_put_SEQUENCE(a,f);
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_IMP_SET_opt(a,f,x) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
|
||||||
{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
|
||||||
IS_SET); }
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \
|
|
||||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
|
||||||
{ i2d_ASN1_SET_OF_##type(a,&p,f,x, \
|
|
||||||
V_ASN1_CONTEXT_SPECIFIC, \
|
|
||||||
IS_SET); }
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
|
||||||
{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
|
||||||
IS_SEQUENCE); }
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type,a,f,x) \
|
|
||||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
|
||||||
{ i2d_ASN1_SET_OF_##type(a,&p,f,x, \
|
|
||||||
V_ASN1_CONTEXT_SPECIFIC, \
|
|
||||||
IS_SEQUENCE); }
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \
|
|
||||||
if (a != NULL) \
|
|
||||||
{ \
|
|
||||||
ASN1_put_object(&p,1,v,tag,V_ASN1_CONTEXT_SPECIFIC); \
|
|
||||||
f(a,&p); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_EXP_SET_opt(a,f,mtag,tag,v) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
|
||||||
{ \
|
|
||||||
ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
|
|
||||||
i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \
|
|
||||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
|
||||||
{ \
|
|
||||||
ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
|
|
||||||
i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \
|
|
||||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
|
||||||
{ \
|
|
||||||
ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
|
|
||||||
i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \
|
|
||||||
IS_SEQUENCE); \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_seq_total() \
|
|
||||||
r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \
|
|
||||||
if (pp == NULL) return(r); \
|
|
||||||
p= *pp; \
|
|
||||||
ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_INF_seq_start(tag,ctx) \
|
|
||||||
*(p++)=(V_ASN1_CONSTRUCTED|(tag)|(ctx)); \
|
|
||||||
*(p++)=0x80
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_INF_seq_end() *(p++)=0x00; *(p++)=0x00
|
|
||||||
|
|
||||||
# define M_ASN1_I2D_finish() *pp=p; \
|
|
||||||
return(r);
|
|
||||||
|
|
||||||
int asn1_GetSequence(ASN1_const_CTX *c, long *length);
|
|
||||||
void asn1_add_error(const unsigned char *address, int offset);
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#error "This file is obsolete; please update your software."
|
||||||
|
@ -0,0 +1,256 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2020 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_ASN1ERR_H
|
||||||
|
# define HEADER_ASN1ERR_H
|
||||||
|
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_ASN1_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ASN1 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_BIO_INIT 113
|
||||||
|
# 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_ENC_SAVE 115
|
||||||
|
# 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_EX_I2D 144
|
||||||
|
# define ASN1_F_ASN1_ITEM_FLAGS_I2D 118
|
||||||
|
# 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_PRIMITIVE_NEW 119
|
||||||
|
# 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_C2I_UINT64_INT 101
|
||||||
|
# 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_BUF 142
|
||||||
|
# define ASN1_F_DO_CREATE 124
|
||||||
|
# define ASN1_F_DO_DUMP 125
|
||||||
|
# define ASN1_F_DO_TCREATE 222
|
||||||
|
# define ASN1_F_I2A_ASN1_OBJECT 126
|
||||||
|
# define ASN1_F_I2D_ASN1_BIO_STREAM 211
|
||||||
|
# define ASN1_F_I2D_ASN1_OBJECT 143
|
||||||
|
# define ASN1_F_I2D_DSA_PUBKEY 161
|
||||||
|
# define ASN1_F_I2D_EC_PUBKEY 181
|
||||||
|
# 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_NDEF_PREFIX 127
|
||||||
|
# define ASN1_F_NDEF_SUFFIX 136
|
||||||
|
# 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_STABLE_GET 138
|
||||||
|
# define ASN1_F_STBL_MODULE_INIT 223
|
||||||
|
# define ASN1_F_UINT32_C2I 105
|
||||||
|
# define ASN1_F_UINT32_NEW 139
|
||||||
|
# define ASN1_F_UINT64_C2I 112
|
||||||
|
# define ASN1_F_UINT64_NEW 141
|
||||||
|
# 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
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ASN1 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_BAD_TEMPLATE 230
|
||||||
|
# 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 189
|
||||||
|
# define ASN1_R_MSTRING_NOT_UNIVERSAL 139
|
||||||
|
# define ASN1_R_MSTRING_WRONG_TAG 140
|
||||||
|
# define ASN1_R_NESTED_ASN1_STRING 197
|
||||||
|
# define ASN1_R_NESTED_TOO_DEEP 201
|
||||||
|
# define ASN1_R_NON_HEX_CHARACTERS 141
|
||||||
|
# define ASN1_R_NOT_ASCII_FORMAT 190
|
||||||
|
# define ASN1_R_NOT_ENOUGH_DATA 142
|
||||||
|
# define ASN1_R_NO_CONTENT_TYPE 209
|
||||||
|
# define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
|
||||||
|
# define ASN1_R_NO_MULTIPART_BODY_FAILURE 210
|
||||||
|
# define ASN1_R_NO_MULTIPART_BOUNDARY 211
|
||||||
|
# define ASN1_R_NO_SIG_CONTENT_TYPE 212
|
||||||
|
# define ASN1_R_NULL_IS_WRONG_LENGTH 144
|
||||||
|
# define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191
|
||||||
|
# define ASN1_R_ODD_NUMBER_OF_CHARS 145
|
||||||
|
# define ASN1_R_SECOND_NUMBER_TOO_LARGE 147
|
||||||
|
# define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148
|
||||||
|
# define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
|
||||||
|
# define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192
|
||||||
|
# define ASN1_R_SHORT_LINE 150
|
||||||
|
# define ASN1_R_SIG_INVALID_MIME_TYPE 213
|
||||||
|
# define ASN1_R_STREAMING_NOT_SUPPORTED 202
|
||||||
|
# define ASN1_R_STRING_TOO_LONG 151
|
||||||
|
# define ASN1_R_STRING_TOO_SHORT 152
|
||||||
|
# define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
|
||||||
|
# define ASN1_R_TIME_NOT_ASCII_FORMAT 193
|
||||||
|
# define ASN1_R_TOO_LARGE 223
|
||||||
|
# define ASN1_R_TOO_LONG 155
|
||||||
|
# define ASN1_R_TOO_SMALL 224
|
||||||
|
# define ASN1_R_TYPE_NOT_CONSTRUCTED 156
|
||||||
|
# define ASN1_R_TYPE_NOT_PRIMITIVE 195
|
||||||
|
# define ASN1_R_UNEXPECTED_EOC 159
|
||||||
|
# define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215
|
||||||
|
# define ASN1_R_UNKNOWN_FORMAT 160
|
||||||
|
# define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
|
||||||
|
# define ASN1_R_UNKNOWN_OBJECT_TYPE 162
|
||||||
|
# define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
|
||||||
|
# define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199
|
||||||
|
# define ASN1_R_UNKNOWN_TAG 194
|
||||||
|
# define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
|
||||||
|
# define ASN1_R_UNSUPPORTED_CIPHER 228
|
||||||
|
# define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
|
||||||
|
# define ASN1_R_UNSUPPORTED_TYPE 196
|
||||||
|
# define ASN1_R_WRONG_INTEGER_TYPE 225
|
||||||
|
# define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200
|
||||||
|
# define ASN1_R_WRONG_TAG 168
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2015-2018 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifndef HEADER_ASYNC_H
|
||||||
|
# define HEADER_ASYNC_H
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# if defined(BASETYPES) || defined(_WINDEF_H)
|
||||||
|
/* application has to include <windows.h> to use this */
|
||||||
|
#define OSSL_ASYNC_FD HANDLE
|
||||||
|
#define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
#define OSSL_ASYNC_FD int
|
||||||
|
#define OSSL_BAD_ASYNC_FD -1
|
||||||
|
#endif
|
||||||
|
# include <openssl/asyncerr.h>
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
typedef struct async_job_st ASYNC_JOB;
|
||||||
|
typedef struct async_wait_ctx_st ASYNC_WAIT_CTX;
|
||||||
|
|
||||||
|
#define ASYNC_ERR 0
|
||||||
|
#define ASYNC_NO_JOBS 1
|
||||||
|
#define ASYNC_PAUSE 2
|
||||||
|
#define ASYNC_FINISH 3
|
||||||
|
|
||||||
|
int ASYNC_init_thread(size_t max_size, size_t init_size);
|
||||||
|
void ASYNC_cleanup_thread(void);
|
||||||
|
|
||||||
|
#ifdef OSSL_ASYNC_FD
|
||||||
|
ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void);
|
||||||
|
void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx);
|
||||||
|
int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key,
|
||||||
|
OSSL_ASYNC_FD fd,
|
||||||
|
void *custom_data,
|
||||||
|
void (*cleanup)(ASYNC_WAIT_CTX *, const void *,
|
||||||
|
OSSL_ASYNC_FD, void *));
|
||||||
|
int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key,
|
||||||
|
OSSL_ASYNC_FD *fd, void **custom_data);
|
||||||
|
int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd,
|
||||||
|
size_t *numfds);
|
||||||
|
int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd,
|
||||||
|
size_t *numaddfds, OSSL_ASYNC_FD *delfd,
|
||||||
|
size_t *numdelfds);
|
||||||
|
int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int ASYNC_is_capable(void);
|
||||||
|
|
||||||
|
int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret,
|
||||||
|
int (*func)(void *), void *args, size_t size);
|
||||||
|
int ASYNC_pause_job(void);
|
||||||
|
|
||||||
|
ASYNC_JOB *ASYNC_get_current_job(void);
|
||||||
|
ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job);
|
||||||
|
void ASYNC_block_pause(void);
|
||||||
|
void ASYNC_unblock_pause(void);
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_ASYNCERR_H
|
||||||
|
# define HEADER_ASYNCERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_ASYNC_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ASYNC function codes.
|
||||||
|
*/
|
||||||
|
# define ASYNC_F_ASYNC_CTX_NEW 100
|
||||||
|
# define ASYNC_F_ASYNC_INIT_THREAD 101
|
||||||
|
# define ASYNC_F_ASYNC_JOB_NEW 102
|
||||||
|
# define ASYNC_F_ASYNC_PAUSE_JOB 103
|
||||||
|
# define ASYNC_F_ASYNC_START_FUNC 104
|
||||||
|
# define ASYNC_F_ASYNC_START_JOB 105
|
||||||
|
# define ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD 106
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ASYNC reason codes.
|
||||||
|
*/
|
||||||
|
# define ASYNC_R_FAILED_TO_SET_POOL 101
|
||||||
|
# define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102
|
||||||
|
# define ASYNC_R_INIT_FAILED 105
|
||||||
|
# define ASYNC_R_INVALID_POOL_SIZE 103
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,124 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_BIOERR_H
|
||||||
|
# define HEADER_BIOERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_BIO_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BIO function codes.
|
||||||
|
*/
|
||||||
|
# define BIO_F_ACPT_STATE 100
|
||||||
|
# define BIO_F_ADDRINFO_WRAP 148
|
||||||
|
# define BIO_F_ADDR_STRINGS 134
|
||||||
|
# define BIO_F_BIO_ACCEPT 101
|
||||||
|
# define BIO_F_BIO_ACCEPT_EX 137
|
||||||
|
# define BIO_F_BIO_ACCEPT_NEW 152
|
||||||
|
# define BIO_F_BIO_ADDR_NEW 144
|
||||||
|
# define BIO_F_BIO_BIND 147
|
||||||
|
# define BIO_F_BIO_CALLBACK_CTRL 131
|
||||||
|
# define BIO_F_BIO_CONNECT 138
|
||||||
|
# define BIO_F_BIO_CONNECT_NEW 153
|
||||||
|
# define BIO_F_BIO_CTRL 103
|
||||||
|
# define BIO_F_BIO_GETS 104
|
||||||
|
# define BIO_F_BIO_GET_HOST_IP 106
|
||||||
|
# define BIO_F_BIO_GET_NEW_INDEX 102
|
||||||
|
# define BIO_F_BIO_GET_PORT 107
|
||||||
|
# define BIO_F_BIO_LISTEN 139
|
||||||
|
# define BIO_F_BIO_LOOKUP 135
|
||||||
|
# define BIO_F_BIO_LOOKUP_EX 143
|
||||||
|
# define BIO_F_BIO_MAKE_PAIR 121
|
||||||
|
# define BIO_F_BIO_METH_NEW 146
|
||||||
|
# define BIO_F_BIO_NEW 108
|
||||||
|
# define BIO_F_BIO_NEW_DGRAM_SCTP 145
|
||||||
|
# define BIO_F_BIO_NEW_FILE 109
|
||||||
|
# define BIO_F_BIO_NEW_MEM_BUF 126
|
||||||
|
# define BIO_F_BIO_NREAD 123
|
||||||
|
# define BIO_F_BIO_NREAD0 124
|
||||||
|
# define BIO_F_BIO_NWRITE 125
|
||||||
|
# define BIO_F_BIO_NWRITE0 122
|
||||||
|
# define BIO_F_BIO_PARSE_HOSTSERV 136
|
||||||
|
# define BIO_F_BIO_PUTS 110
|
||||||
|
# define BIO_F_BIO_READ 111
|
||||||
|
# define BIO_F_BIO_READ_EX 105
|
||||||
|
# define BIO_F_BIO_READ_INTERN 120
|
||||||
|
# define BIO_F_BIO_SOCKET 140
|
||||||
|
# define BIO_F_BIO_SOCKET_NBIO 142
|
||||||
|
# define BIO_F_BIO_SOCK_INFO 141
|
||||||
|
# define BIO_F_BIO_SOCK_INIT 112
|
||||||
|
# define BIO_F_BIO_WRITE 113
|
||||||
|
# define BIO_F_BIO_WRITE_EX 119
|
||||||
|
# define BIO_F_BIO_WRITE_INTERN 128
|
||||||
|
# define BIO_F_BUFFER_CTRL 114
|
||||||
|
# define BIO_F_CONN_CTRL 127
|
||||||
|
# define BIO_F_CONN_STATE 115
|
||||||
|
# define BIO_F_DGRAM_SCTP_NEW 149
|
||||||
|
# define BIO_F_DGRAM_SCTP_READ 132
|
||||||
|
# define BIO_F_DGRAM_SCTP_WRITE 133
|
||||||
|
# define BIO_F_DOAPR_OUTCH 150
|
||||||
|
# define BIO_F_FILE_CTRL 116
|
||||||
|
# define BIO_F_FILE_READ 130
|
||||||
|
# define BIO_F_LINEBUFFER_CTRL 129
|
||||||
|
# define BIO_F_LINEBUFFER_NEW 151
|
||||||
|
# define BIO_F_MEM_WRITE 117
|
||||||
|
# define BIO_F_NBIOF_NEW 154
|
||||||
|
# define BIO_F_SLG_WRITE 155
|
||||||
|
# define BIO_F_SSL_NEW 118
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BIO reason codes.
|
||||||
|
*/
|
||||||
|
# define BIO_R_ACCEPT_ERROR 100
|
||||||
|
# define BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET 141
|
||||||
|
# define BIO_R_AMBIGUOUS_HOST_OR_SERVICE 129
|
||||||
|
# define BIO_R_BAD_FOPEN_MODE 101
|
||||||
|
# define BIO_R_BROKEN_PIPE 124
|
||||||
|
# define BIO_R_CONNECT_ERROR 103
|
||||||
|
# define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107
|
||||||
|
# define BIO_R_GETSOCKNAME_ERROR 132
|
||||||
|
# define BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS 133
|
||||||
|
# define BIO_R_GETTING_SOCKTYPE 134
|
||||||
|
# define BIO_R_INVALID_ARGUMENT 125
|
||||||
|
# define BIO_R_INVALID_SOCKET 135
|
||||||
|
# define BIO_R_IN_USE 123
|
||||||
|
# define BIO_R_LENGTH_TOO_LONG 102
|
||||||
|
# define BIO_R_LISTEN_V6_ONLY 136
|
||||||
|
# define BIO_R_LOOKUP_RETURNED_NOTHING 142
|
||||||
|
# define BIO_R_MALFORMED_HOST_OR_SERVICE 130
|
||||||
|
# define BIO_R_NBIO_CONNECT_ERROR 110
|
||||||
|
# define BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED 143
|
||||||
|
# define BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED 144
|
||||||
|
# define BIO_R_NO_PORT_DEFINED 113
|
||||||
|
# define BIO_R_NO_SUCH_FILE 128
|
||||||
|
# define BIO_R_NULL_PARAMETER 115
|
||||||
|
# define BIO_R_UNABLE_TO_BIND_SOCKET 117
|
||||||
|
# define BIO_R_UNABLE_TO_CREATE_SOCKET 118
|
||||||
|
# define BIO_R_UNABLE_TO_KEEPALIVE 137
|
||||||
|
# define BIO_R_UNABLE_TO_LISTEN_SOCKET 119
|
||||||
|
# define BIO_R_UNABLE_TO_NODELAY 138
|
||||||
|
# define BIO_R_UNABLE_TO_REUSEADDR 139
|
||||||
|
# define BIO_R_UNAVAILABLE_IP_FAMILY 145
|
||||||
|
# define BIO_R_UNINITIALIZED 120
|
||||||
|
# define BIO_R_UNKNOWN_INFO_TYPE 140
|
||||||
|
# define BIO_R_UNSUPPORTED_IP_FAMILY 146
|
||||||
|
# define BIO_R_UNSUPPORTED_METHOD 121
|
||||||
|
# define BIO_R_UNSUPPORTED_PROTOCOL_FAMILY 131
|
||||||
|
# define BIO_R_WRITE_TO_READ_ONLY_BIO 126
|
||||||
|
# define BIO_R_WSASTARTUP 122
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_BNERR_H
|
||||||
|
# define HEADER_BNERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_BN_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BN function codes.
|
||||||
|
*/
|
||||||
|
# define BN_F_BNRAND 127
|
||||||
|
# define BN_F_BNRAND_RANGE 138
|
||||||
|
# define BN_F_BN_BLINDING_CONVERT_EX 100
|
||||||
|
# define BN_F_BN_BLINDING_CREATE_PARAM 128
|
||||||
|
# define BN_F_BN_BLINDING_INVERT_EX 101
|
||||||
|
# define BN_F_BN_BLINDING_NEW 102
|
||||||
|
# define BN_F_BN_BLINDING_UPDATE 103
|
||||||
|
# define BN_F_BN_BN2DEC 104
|
||||||
|
# define BN_F_BN_BN2HEX 105
|
||||||
|
# define BN_F_BN_COMPUTE_WNAF 142
|
||||||
|
# define BN_F_BN_CTX_GET 116
|
||||||
|
# define BN_F_BN_CTX_NEW 106
|
||||||
|
# define BN_F_BN_CTX_START 129
|
||||||
|
# define BN_F_BN_DIV 107
|
||||||
|
# define BN_F_BN_DIV_RECP 130
|
||||||
|
# define BN_F_BN_EXP 123
|
||||||
|
# define BN_F_BN_EXPAND_INTERNAL 120
|
||||||
|
# define BN_F_BN_GENCB_NEW 143
|
||||||
|
# define BN_F_BN_GENERATE_DSA_NONCE 140
|
||||||
|
# define BN_F_BN_GENERATE_PRIME_EX 141
|
||||||
|
# define BN_F_BN_GF2M_MOD 131
|
||||||
|
# define BN_F_BN_GF2M_MOD_EXP 132
|
||||||
|
# define BN_F_BN_GF2M_MOD_MUL 133
|
||||||
|
# define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134
|
||||||
|
# define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135
|
||||||
|
# define BN_F_BN_GF2M_MOD_SQR 136
|
||||||
|
# define BN_F_BN_GF2M_MOD_SQRT 137
|
||||||
|
# define BN_F_BN_LSHIFT 145
|
||||||
|
# define BN_F_BN_MOD_EXP2_MONT 118
|
||||||
|
# define BN_F_BN_MOD_EXP_MONT 109
|
||||||
|
# define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124
|
||||||
|
# define BN_F_BN_MOD_EXP_MONT_WORD 117
|
||||||
|
# define BN_F_BN_MOD_EXP_RECP 125
|
||||||
|
# define BN_F_BN_MOD_EXP_SIMPLE 126
|
||||||
|
# define BN_F_BN_MOD_INVERSE 110
|
||||||
|
# define BN_F_BN_MOD_INVERSE_NO_BRANCH 139
|
||||||
|
# define BN_F_BN_MOD_LSHIFT_QUICK 119
|
||||||
|
# define BN_F_BN_MOD_SQRT 121
|
||||||
|
# define BN_F_BN_MONT_CTX_NEW 149
|
||||||
|
# define BN_F_BN_MPI2BN 112
|
||||||
|
# define BN_F_BN_NEW 113
|
||||||
|
# define BN_F_BN_POOL_GET 147
|
||||||
|
# define BN_F_BN_RAND 114
|
||||||
|
# define BN_F_BN_RAND_RANGE 122
|
||||||
|
# define BN_F_BN_RECP_CTX_NEW 150
|
||||||
|
# define BN_F_BN_RSHIFT 146
|
||||||
|
# define BN_F_BN_SET_WORDS 144
|
||||||
|
# define BN_F_BN_STACK_PUSH 148
|
||||||
|
# define BN_F_BN_USUB 115
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BN reason codes.
|
||||||
|
*/
|
||||||
|
# define BN_R_ARG2_LT_ARG3 100
|
||||||
|
# define BN_R_BAD_RECIPROCAL 101
|
||||||
|
# define BN_R_BIGNUM_TOO_LONG 114
|
||||||
|
# define BN_R_BITS_TOO_SMALL 118
|
||||||
|
# define BN_R_CALLED_WITH_EVEN_MODULUS 102
|
||||||
|
# define BN_R_DIV_BY_ZERO 103
|
||||||
|
# define BN_R_ENCODING_ERROR 104
|
||||||
|
# define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105
|
||||||
|
# define BN_R_INPUT_NOT_REDUCED 110
|
||||||
|
# define BN_R_INVALID_LENGTH 106
|
||||||
|
# define BN_R_INVALID_RANGE 115
|
||||||
|
# define BN_R_INVALID_SHIFT 119
|
||||||
|
# define BN_R_NOT_A_SQUARE 111
|
||||||
|
# define BN_R_NOT_INITIALIZED 107
|
||||||
|
# define BN_R_NO_INVERSE 108
|
||||||
|
# define BN_R_NO_SOLUTION 116
|
||||||
|
# define BN_R_PRIVATE_KEY_TOO_LARGE 117
|
||||||
|
# define BN_R_P_IS_NOT_PRIME 112
|
||||||
|
# define BN_R_TOO_MANY_ITERATIONS 113
|
||||||
|
# define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109
|
||||||
|
|
||||||
|
#endif
|
@ -1,125 +1,58 @@
|
|||||||
/* crypto/buffer/buffer.h */
|
/*
|
||||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This package is an SSL implementation written
|
|
||||||
* by Eric Young (eay@cryptsoft.com).
|
|
||||||
* The implementation was written so as to conform with Netscapes SSL.
|
|
||||||
*
|
|
||||||
* This library is free for commercial and non-commercial use as long as
|
|
||||||
* the following conditions are aheared to. The following conditions
|
|
||||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
|
||||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
|
||||||
* included with this distribution is covered by the same copyright terms
|
|
||||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
|
||||||
*
|
|
||||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
|
||||||
* the code are not to be removed.
|
|
||||||
* If this package is used in a product, Eric Young should be given attribution
|
|
||||||
* as the author of the parts of the library used.
|
|
||||||
* This can be in the form of a textual message at program startup or
|
|
||||||
* in documentation (online or textual) provided with the package.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* "This product includes cryptographic software written by
|
|
||||||
* Eric Young (eay@cryptsoft.com)"
|
|
||||||
* The word 'cryptographic' can be left out if the rouines from the library
|
|
||||||
* being used are not cryptographic related :-).
|
|
||||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
|
||||||
* the apps directory (application code) you must include an acknowledgement:
|
|
||||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
*
|
||||||
* The licence and distribution terms for any publically available version or
|
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
* this file except in compliance with the License. You can obtain a copy
|
||||||
* copied and put under another distribution licence
|
* in the file LICENSE in the source distribution or at
|
||||||
* [including the GNU Public Licence.]
|
* https://www.openssl.org/source/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEADER_BUFFER_H
|
#ifndef HEADER_BUFFER_H
|
||||||
# define HEADER_BUFFER_H
|
# define HEADER_BUFFER_H
|
||||||
|
|
||||||
# include <openssl/ossl_typ.h>
|
# include <openssl/ossl_typ.h>
|
||||||
|
# ifndef HEADER_CRYPTO_H
|
||||||
|
# include <openssl/crypto.h>
|
||||||
|
# endif
|
||||||
|
# include <openssl/buffererr.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
|
|
||||||
# if !defined(NO_SYS_TYPES_H)
|
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Already declared in ossl_typ.h */
|
/*
|
||||||
/* typedef struct buf_mem_st BUF_MEM; */
|
* These names are outdated as of OpenSSL 1.1; a future release
|
||||||
|
* will move them to be deprecated.
|
||||||
|
*/
|
||||||
|
# define BUF_strdup(s) OPENSSL_strdup(s)
|
||||||
|
# define BUF_strndup(s, size) OPENSSL_strndup(s, size)
|
||||||
|
# define BUF_memdup(data, size) OPENSSL_memdup(data, size)
|
||||||
|
# define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size)
|
||||||
|
# define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size)
|
||||||
|
# define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen)
|
||||||
|
|
||||||
struct buf_mem_st {
|
struct buf_mem_st {
|
||||||
size_t length; /* current number of bytes */
|
size_t length; /* current number of bytes */
|
||||||
char *data;
|
char *data;
|
||||||
size_t max; /* size of buffer */
|
size_t max; /* size of buffer */
|
||||||
|
unsigned long flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# define BUF_MEM_FLAG_SECURE 0x01
|
||||||
|
|
||||||
BUF_MEM *BUF_MEM_new(void);
|
BUF_MEM *BUF_MEM_new(void);
|
||||||
|
BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
|
||||||
void BUF_MEM_free(BUF_MEM *a);
|
void BUF_MEM_free(BUF_MEM *a);
|
||||||
int BUF_MEM_grow(BUF_MEM *str, size_t len);
|
size_t BUF_MEM_grow(BUF_MEM *str, size_t len);
|
||||||
int BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
|
size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
|
||||||
size_t BUF_strnlen(const char *str, size_t maxlen);
|
|
||||||
char *BUF_strdup(const char *str);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Like strndup, but in addition, explicitly guarantees to never read past the
|
|
||||||
* first |siz| bytes of |str|.
|
|
||||||
*/
|
|
||||||
char *BUF_strndup(const char *str, size_t siz);
|
|
||||||
|
|
||||||
void *BUF_memdup(const void *data, size_t siz);
|
|
||||||
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
|
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
|
||||||
|
|
||||||
/* safe string functions */
|
|
||||||
size_t BUF_strlcpy(char *dst, const char *src, size_t siz);
|
|
||||||
size_t BUF_strlcat(char *dst, const char *src, size_t siz);
|
|
||||||
|
|
||||||
/* 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.
|
|
||||||
*/
|
|
||||||
void ERR_load_BUF_strings(void);
|
|
||||||
|
|
||||||
/* Error codes for the BUF functions. */
|
# ifdef __cplusplus
|
||||||
|
|
||||||
/* Function codes. */
|
|
||||||
# define BUF_F_BUF_MEMDUP 103
|
|
||||||
# define BUF_F_BUF_MEM_GROW 100
|
|
||||||
# define BUF_F_BUF_MEM_GROW_CLEAN 105
|
|
||||||
# define BUF_F_BUF_MEM_NEW 101
|
|
||||||
# define BUF_F_BUF_STRDUP 102
|
|
||||||
# define BUF_F_BUF_STRNDUP 104
|
|
||||||
|
|
||||||
/* Reason codes. */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_BUFERR_H
|
||||||
|
# define HEADER_BUFERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_BUF_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BUF function codes.
|
||||||
|
*/
|
||||||
|
# define BUF_F_BUF_MEM_GROW 100
|
||||||
|
# define BUF_F_BUF_MEM_GROW_CLEAN 105
|
||||||
|
# define BUF_F_BUF_MEM_NEW 101
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BUF reason codes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,202 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_CMSERR_H
|
||||||
|
# define HEADER_CMSERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CMS
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_CMS_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CMS function codes.
|
||||||
|
*/
|
||||||
|
# define CMS_F_CHECK_CONTENT 99
|
||||||
|
# define CMS_F_CMS_ADD0_CERT 164
|
||||||
|
# define CMS_F_CMS_ADD0_RECIPIENT_KEY 100
|
||||||
|
# define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD 165
|
||||||
|
# define CMS_F_CMS_ADD1_RECEIPTREQUEST 158
|
||||||
|
# define CMS_F_CMS_ADD1_RECIPIENT_CERT 101
|
||||||
|
# define CMS_F_CMS_ADD1_SIGNER 102
|
||||||
|
# define CMS_F_CMS_ADD1_SIGNINGTIME 103
|
||||||
|
# define CMS_F_CMS_COMPRESS 104
|
||||||
|
# define CMS_F_CMS_COMPRESSEDDATA_CREATE 105
|
||||||
|
# define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO 106
|
||||||
|
# define CMS_F_CMS_COPY_CONTENT 107
|
||||||
|
# define CMS_F_CMS_COPY_MESSAGEDIGEST 108
|
||||||
|
# define CMS_F_CMS_DATA 109
|
||||||
|
# define CMS_F_CMS_DATAFINAL 110
|
||||||
|
# define CMS_F_CMS_DATAINIT 111
|
||||||
|
# define CMS_F_CMS_DECRYPT 112
|
||||||
|
# define CMS_F_CMS_DECRYPT_SET1_KEY 113
|
||||||
|
# define CMS_F_CMS_DECRYPT_SET1_PASSWORD 166
|
||||||
|
# define CMS_F_CMS_DECRYPT_SET1_PKEY 114
|
||||||
|
# define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 115
|
||||||
|
# define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 116
|
||||||
|
# define CMS_F_CMS_DIGESTEDDATA_DO_FINAL 117
|
||||||
|
# define CMS_F_CMS_DIGEST_VERIFY 118
|
||||||
|
# define CMS_F_CMS_ENCODE_RECEIPT 161
|
||||||
|
# define CMS_F_CMS_ENCRYPT 119
|
||||||
|
# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT 179
|
||||||
|
# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO 120
|
||||||
|
# define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT 121
|
||||||
|
# define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT 122
|
||||||
|
# define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY 123
|
||||||
|
# define CMS_F_CMS_ENVELOPEDDATA_CREATE 124
|
||||||
|
# define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO 125
|
||||||
|
# define CMS_F_CMS_ENVELOPED_DATA_INIT 126
|
||||||
|
# define CMS_F_CMS_ENV_ASN1_CTRL 171
|
||||||
|
# define CMS_F_CMS_FINAL 127
|
||||||
|
# define CMS_F_CMS_GET0_CERTIFICATE_CHOICES 128
|
||||||
|
# define CMS_F_CMS_GET0_CONTENT 129
|
||||||
|
# define CMS_F_CMS_GET0_ECONTENT_TYPE 130
|
||||||
|
# define CMS_F_CMS_GET0_ENVELOPED 131
|
||||||
|
# define CMS_F_CMS_GET0_REVOCATION_CHOICES 132
|
||||||
|
# define CMS_F_CMS_GET0_SIGNED 133
|
||||||
|
# define CMS_F_CMS_MSGSIGDIGEST_ADD1 162
|
||||||
|
# define CMS_F_CMS_RECEIPTREQUEST_CREATE0 159
|
||||||
|
# define CMS_F_CMS_RECEIPT_VERIFY 160
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_DECRYPT 134
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_ENCRYPT 169
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT 178
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG 175
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID 173
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS 172
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP 174
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT 135
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT 136
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID 137
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP 138
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP 139
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT 140
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 141
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 142
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 143
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT 167
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 144
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD 168
|
||||||
|
# define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 145
|
||||||
|
# define CMS_F_CMS_SD_ASN1_CTRL 170
|
||||||
|
# define CMS_F_CMS_SET1_IAS 176
|
||||||
|
# define CMS_F_CMS_SET1_KEYID 177
|
||||||
|
# define CMS_F_CMS_SET1_SIGNERIDENTIFIER 146
|
||||||
|
# define CMS_F_CMS_SET_DETACHED 147
|
||||||
|
# define CMS_F_CMS_SIGN 148
|
||||||
|
# define CMS_F_CMS_SIGNED_DATA_INIT 149
|
||||||
|
# define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN 150
|
||||||
|
# define CMS_F_CMS_SIGNERINFO_SIGN 151
|
||||||
|
# define CMS_F_CMS_SIGNERINFO_VERIFY 152
|
||||||
|
# define CMS_F_CMS_SIGNERINFO_VERIFY_CERT 153
|
||||||
|
# define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT 154
|
||||||
|
# define CMS_F_CMS_SIGN_RECEIPT 163
|
||||||
|
# define CMS_F_CMS_SI_CHECK_ATTRIBUTES 183
|
||||||
|
# define CMS_F_CMS_STREAM 155
|
||||||
|
# define CMS_F_CMS_UNCOMPRESS 156
|
||||||
|
# define CMS_F_CMS_VERIFY 157
|
||||||
|
# define CMS_F_KEK_UNWRAP_KEY 180
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CMS reason codes.
|
||||||
|
*/
|
||||||
|
# define CMS_R_ADD_SIGNER_ERROR 99
|
||||||
|
# define CMS_R_ATTRIBUTE_ERROR 161
|
||||||
|
# define CMS_R_CERTIFICATE_ALREADY_PRESENT 175
|
||||||
|
# define CMS_R_CERTIFICATE_HAS_NO_KEYID 160
|
||||||
|
# define CMS_R_CERTIFICATE_VERIFY_ERROR 100
|
||||||
|
# define CMS_R_CIPHER_INITIALISATION_ERROR 101
|
||||||
|
# define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102
|
||||||
|
# define CMS_R_CMS_DATAFINAL_ERROR 103
|
||||||
|
# define CMS_R_CMS_LIB 104
|
||||||
|
# define CMS_R_CONTENTIDENTIFIER_MISMATCH 170
|
||||||
|
# define CMS_R_CONTENT_NOT_FOUND 105
|
||||||
|
# define CMS_R_CONTENT_TYPE_MISMATCH 171
|
||||||
|
# define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106
|
||||||
|
# define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107
|
||||||
|
# define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108
|
||||||
|
# define CMS_R_CONTENT_VERIFY_ERROR 109
|
||||||
|
# define CMS_R_CTRL_ERROR 110
|
||||||
|
# define CMS_R_CTRL_FAILURE 111
|
||||||
|
# define CMS_R_DECRYPT_ERROR 112
|
||||||
|
# define CMS_R_ERROR_GETTING_PUBLIC_KEY 113
|
||||||
|
# define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114
|
||||||
|
# define CMS_R_ERROR_SETTING_KEY 115
|
||||||
|
# define CMS_R_ERROR_SETTING_RECIPIENTINFO 116
|
||||||
|
# define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117
|
||||||
|
# define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176
|
||||||
|
# define CMS_R_INVALID_KEY_LENGTH 118
|
||||||
|
# define CMS_R_MD_BIO_INIT_ERROR 119
|
||||||
|
# define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120
|
||||||
|
# define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121
|
||||||
|
# define CMS_R_MSGSIGDIGEST_ERROR 172
|
||||||
|
# define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162
|
||||||
|
# define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163
|
||||||
|
# define CMS_R_NEED_ONE_SIGNER 164
|
||||||
|
# define CMS_R_NOT_A_SIGNED_RECEIPT 165
|
||||||
|
# define CMS_R_NOT_ENCRYPTED_DATA 122
|
||||||
|
# define CMS_R_NOT_KEK 123
|
||||||
|
# define CMS_R_NOT_KEY_AGREEMENT 181
|
||||||
|
# define CMS_R_NOT_KEY_TRANSPORT 124
|
||||||
|
# define CMS_R_NOT_PWRI 177
|
||||||
|
# define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125
|
||||||
|
# define CMS_R_NO_CIPHER 126
|
||||||
|
# define CMS_R_NO_CONTENT 127
|
||||||
|
# define CMS_R_NO_CONTENT_TYPE 173
|
||||||
|
# define CMS_R_NO_DEFAULT_DIGEST 128
|
||||||
|
# define CMS_R_NO_DIGEST_SET 129
|
||||||
|
# define CMS_R_NO_KEY 130
|
||||||
|
# define CMS_R_NO_KEY_OR_CERT 174
|
||||||
|
# define CMS_R_NO_MATCHING_DIGEST 131
|
||||||
|
# define CMS_R_NO_MATCHING_RECIPIENT 132
|
||||||
|
# define CMS_R_NO_MATCHING_SIGNATURE 166
|
||||||
|
# define CMS_R_NO_MSGSIGDIGEST 167
|
||||||
|
# define CMS_R_NO_PASSWORD 178
|
||||||
|
# define CMS_R_NO_PRIVATE_KEY 133
|
||||||
|
# define CMS_R_NO_PUBLIC_KEY 134
|
||||||
|
# define CMS_R_NO_RECEIPT_REQUEST 168
|
||||||
|
# define CMS_R_NO_SIGNERS 135
|
||||||
|
# define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136
|
||||||
|
# define CMS_R_RECEIPT_DECODE_ERROR 169
|
||||||
|
# define CMS_R_RECIPIENT_ERROR 137
|
||||||
|
# define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138
|
||||||
|
# define CMS_R_SIGNFINAL_ERROR 139
|
||||||
|
# define CMS_R_SMIME_TEXT_ERROR 140
|
||||||
|
# define CMS_R_STORE_INIT_ERROR 141
|
||||||
|
# define CMS_R_TYPE_NOT_COMPRESSED_DATA 142
|
||||||
|
# define CMS_R_TYPE_NOT_DATA 143
|
||||||
|
# define CMS_R_TYPE_NOT_DIGESTED_DATA 144
|
||||||
|
# define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145
|
||||||
|
# define CMS_R_TYPE_NOT_ENVELOPED_DATA 146
|
||||||
|
# define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147
|
||||||
|
# define CMS_R_UNKNOWN_CIPHER 148
|
||||||
|
# define CMS_R_UNKNOWN_DIGEST_ALGORITHM 149
|
||||||
|
# define CMS_R_UNKNOWN_ID 150
|
||||||
|
# define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151
|
||||||
|
# define CMS_R_UNSUPPORTED_CONTENT_TYPE 152
|
||||||
|
# define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153
|
||||||
|
# define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179
|
||||||
|
# define CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE 155
|
||||||
|
# define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154
|
||||||
|
# define CMS_R_UNSUPPORTED_TYPE 156
|
||||||
|
# define CMS_R_UNWRAP_ERROR 157
|
||||||
|
# define CMS_R_UNWRAP_FAILURE 180
|
||||||
|
# define CMS_R_VERIFICATION_FAILURE 158
|
||||||
|
# define CMS_R_WRAP_ERROR 159
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
@ -1,83 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2015-2018 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_COMP_H
|
#ifndef HEADER_COMP_H
|
||||||
# define HEADER_COMP_H
|
# define HEADER_COMP_H
|
||||||
|
|
||||||
# include <openssl/crypto.h>
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
# ifdef OPENSSL_NO_COMP
|
|
||||||
# error COMP is disabled.
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
# ifndef OPENSSL_NO_COMP
|
||||||
|
# include <openssl/crypto.h>
|
||||||
|
# include <openssl/comperr.h>
|
||||||
|
# ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
typedef struct comp_ctx_st COMP_CTX;
|
|
||||||
|
|
||||||
struct comp_method_st {
|
|
||||||
int type; /* NID for compression library */
|
|
||||||
const char *name; /* A text string to identify the library */
|
|
||||||
int (*init) (COMP_CTX *ctx);
|
|
||||||
void (*finish) (COMP_CTX *ctx);
|
|
||||||
int (*compress) (COMP_CTX *ctx,
|
|
||||||
unsigned char *out, unsigned int olen,
|
|
||||||
unsigned char *in, unsigned int ilen);
|
|
||||||
int (*expand) (COMP_CTX *ctx,
|
|
||||||
unsigned char *out, unsigned int olen,
|
|
||||||
unsigned char *in, unsigned int ilen);
|
|
||||||
/*
|
|
||||||
* The following two do NOTHING, but are kept for backward compatibility
|
|
||||||
*/
|
|
||||||
long (*ctrl) (void);
|
|
||||||
long (*callback_ctrl) (void);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct comp_ctx_st {
|
|
||||||
COMP_METHOD *meth;
|
|
||||||
unsigned long compress_in;
|
|
||||||
unsigned long compress_out;
|
|
||||||
unsigned long expand_in;
|
|
||||||
unsigned long expand_out;
|
|
||||||
CRYPTO_EX_DATA ex_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
|
COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
|
||||||
|
const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx);
|
||||||
|
int COMP_CTX_get_type(const COMP_CTX* comp);
|
||||||
|
int COMP_get_type(const COMP_METHOD *meth);
|
||||||
|
const char *COMP_get_name(const COMP_METHOD *meth);
|
||||||
void COMP_CTX_free(COMP_CTX *ctx);
|
void COMP_CTX_free(COMP_CTX *ctx);
|
||||||
|
|
||||||
int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
||||||
unsigned char *in, int ilen);
|
unsigned char *in, int ilen);
|
||||||
int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
||||||
unsigned char *in, int ilen);
|
unsigned char *in, int ilen);
|
||||||
COMP_METHOD *COMP_rle(void);
|
|
||||||
COMP_METHOD *COMP_zlib(void);
|
COMP_METHOD *COMP_zlib(void);
|
||||||
void COMP_zlib_cleanup(void);
|
|
||||||
|
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||||
|
#define COMP_zlib_cleanup() while(0) continue
|
||||||
|
#endif
|
||||||
|
|
||||||
# ifdef HEADER_BIO_H
|
# ifdef HEADER_BIO_H
|
||||||
# ifdef ZLIB
|
# ifdef ZLIB
|
||||||
BIO_METHOD *BIO_f_zlib(void);
|
const BIO_METHOD *BIO_f_zlib(void);
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* 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.
|
|
||||||
*/
|
|
||||||
void ERR_load_COMP_strings(void);
|
|
||||||
|
|
||||||
/* Error codes for the COMP functions. */
|
|
||||||
|
|
||||||
/* Function codes. */
|
# ifdef __cplusplus
|
||||||
# define COMP_F_BIO_ZLIB_FLUSH 99
|
|
||||||
# define COMP_F_BIO_ZLIB_NEW 100
|
|
||||||
# define COMP_F_BIO_ZLIB_READ 101
|
|
||||||
# define COMP_F_BIO_ZLIB_WRITE 102
|
|
||||||
|
|
||||||
/* Reason codes. */
|
|
||||||
# define COMP_R_ZLIB_DEFLATE_ERROR 99
|
|
||||||
# define COMP_R_ZLIB_INFLATE_ERROR 100
|
|
||||||
# define COMP_R_ZLIB_NOT_SUPPORTED 101
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_COMPERR_H
|
||||||
|
# define HEADER_COMPERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_COMP
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_COMP_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COMP function codes.
|
||||||
|
*/
|
||||||
|
# define COMP_F_BIO_ZLIB_FLUSH 99
|
||||||
|
# define COMP_F_BIO_ZLIB_NEW 100
|
||||||
|
# define COMP_F_BIO_ZLIB_READ 101
|
||||||
|
# define COMP_F_BIO_ZLIB_WRITE 102
|
||||||
|
# define COMP_F_COMP_CTX_NEW 103
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COMP reason codes.
|
||||||
|
*/
|
||||||
|
# define COMP_R_ZLIB_DEFLATE_ERROR 99
|
||||||
|
# define COMP_R_ZLIB_INFLATE_ERROR 100
|
||||||
|
# define COMP_R_ZLIB_NOT_SUPPORTED 101
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_CONFERR_H
|
||||||
|
# define HEADER_CONFERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_CONF_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CONF function codes.
|
||||||
|
*/
|
||||||
|
# define CONF_F_CONF_DUMP_FP 104
|
||||||
|
# define CONF_F_CONF_LOAD 100
|
||||||
|
# define CONF_F_CONF_LOAD_FP 103
|
||||||
|
# define CONF_F_CONF_PARSE_LIST 119
|
||||||
|
# define CONF_F_DEF_LOAD 120
|
||||||
|
# define CONF_F_DEF_LOAD_BIO 121
|
||||||
|
# define CONF_F_GET_NEXT_FILE 107
|
||||||
|
# define CONF_F_MODULE_ADD 122
|
||||||
|
# define CONF_F_MODULE_INIT 115
|
||||||
|
# define CONF_F_MODULE_LOAD_DSO 117
|
||||||
|
# define CONF_F_MODULE_RUN 118
|
||||||
|
# define CONF_F_NCONF_DUMP_BIO 105
|
||||||
|
# define CONF_F_NCONF_DUMP_FP 106
|
||||||
|
# define CONF_F_NCONF_GET_NUMBER_E 112
|
||||||
|
# define CONF_F_NCONF_GET_SECTION 108
|
||||||
|
# define CONF_F_NCONF_GET_STRING 109
|
||||||
|
# define CONF_F_NCONF_LOAD 113
|
||||||
|
# define CONF_F_NCONF_LOAD_BIO 110
|
||||||
|
# define CONF_F_NCONF_LOAD_FP 114
|
||||||
|
# define CONF_F_NCONF_NEW 111
|
||||||
|
# define CONF_F_PROCESS_INCLUDE 116
|
||||||
|
# define CONF_F_SSL_MODULE_INIT 123
|
||||||
|
# define CONF_F_STR_COPY 101
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CONF reason codes.
|
||||||
|
*/
|
||||||
|
# define CONF_R_ERROR_LOADING_DSO 110
|
||||||
|
# define CONF_R_LIST_CANNOT_BE_NULL 115
|
||||||
|
# define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
|
||||||
|
# define CONF_R_MISSING_EQUAL_SIGN 101
|
||||||
|
# define CONF_R_MISSING_INIT_FUNCTION 112
|
||||||
|
# define CONF_R_MODULE_INITIALIZATION_ERROR 109
|
||||||
|
# define CONF_R_NO_CLOSE_BRACE 102
|
||||||
|
# define CONF_R_NO_CONF 105
|
||||||
|
# define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
|
||||||
|
# define CONF_R_NO_SECTION 107
|
||||||
|
# define CONF_R_NO_SUCH_FILE 114
|
||||||
|
# define CONF_R_NO_VALUE 108
|
||||||
|
# define CONF_R_NUMBER_TOO_LARGE 121
|
||||||
|
# define CONF_R_RECURSIVE_DIRECTORY_INCLUDE 111
|
||||||
|
# define CONF_R_SSL_COMMAND_SECTION_EMPTY 117
|
||||||
|
# define CONF_R_SSL_COMMAND_SECTION_NOT_FOUND 118
|
||||||
|
# define CONF_R_SSL_SECTION_EMPTY 119
|
||||||
|
# define CONF_R_SSL_SECTION_NOT_FOUND 120
|
||||||
|
# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
|
||||||
|
# define CONF_R_UNKNOWN_MODULE_NAME 113
|
||||||
|
# define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116
|
||||||
|
# define CONF_R_VARIABLE_HAS_NO_VALUE 104
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_CRYPTOERR_H
|
||||||
|
# define HEADER_CRYPTOERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_CRYPTO_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CRYPTO function codes.
|
||||||
|
*/
|
||||||
|
# define CRYPTO_F_CMAC_CTX_NEW 120
|
||||||
|
# define CRYPTO_F_CRYPTO_DUP_EX_DATA 110
|
||||||
|
# define CRYPTO_F_CRYPTO_FREE_EX_DATA 111
|
||||||
|
# define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100
|
||||||
|
# define CRYPTO_F_CRYPTO_MEMDUP 115
|
||||||
|
# define CRYPTO_F_CRYPTO_NEW_EX_DATA 112
|
||||||
|
# define CRYPTO_F_CRYPTO_OCB128_COPY_CTX 121
|
||||||
|
# define CRYPTO_F_CRYPTO_OCB128_INIT 122
|
||||||
|
# define CRYPTO_F_CRYPTO_SET_EX_DATA 102
|
||||||
|
# define CRYPTO_F_FIPS_MODE_SET 109
|
||||||
|
# define CRYPTO_F_GET_AND_LOCK 113
|
||||||
|
# define CRYPTO_F_OPENSSL_ATEXIT 114
|
||||||
|
# define CRYPTO_F_OPENSSL_BUF2HEXSTR 117
|
||||||
|
# define CRYPTO_F_OPENSSL_FOPEN 119
|
||||||
|
# define CRYPTO_F_OPENSSL_HEXSTR2BUF 118
|
||||||
|
# define CRYPTO_F_OPENSSL_INIT_CRYPTO 116
|
||||||
|
# define CRYPTO_F_OPENSSL_LH_NEW 126
|
||||||
|
# define CRYPTO_F_OPENSSL_SK_DEEP_COPY 127
|
||||||
|
# define CRYPTO_F_OPENSSL_SK_DUP 128
|
||||||
|
# define CRYPTO_F_PKEY_HMAC_INIT 123
|
||||||
|
# define CRYPTO_F_PKEY_POLY1305_INIT 124
|
||||||
|
# define CRYPTO_F_PKEY_SIPHASH_INIT 125
|
||||||
|
# define CRYPTO_F_SK_RESERVE 129
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CRYPTO reason codes.
|
||||||
|
*/
|
||||||
|
# define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101
|
||||||
|
# define CRYPTO_R_ILLEGAL_HEX_DIGIT 102
|
||||||
|
# define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,474 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016-2018 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_CT_H
|
||||||
|
# define HEADER_CT_H
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CT
|
||||||
|
# include <openssl/ossl_typ.h>
|
||||||
|
# include <openssl/safestack.h>
|
||||||
|
# include <openssl/x509.h>
|
||||||
|
# include <openssl/cterr.h>
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Minimum RSA key size, from RFC6962 */
|
||||||
|
# define SCT_MIN_RSA_BITS 2048
|
||||||
|
|
||||||
|
/* All hashes are SHA256 in v1 of Certificate Transparency */
|
||||||
|
# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CT_LOG_ENTRY_TYPE_NOT_SET = -1,
|
||||||
|
CT_LOG_ENTRY_TYPE_X509 = 0,
|
||||||
|
CT_LOG_ENTRY_TYPE_PRECERT = 1
|
||||||
|
} ct_log_entry_type_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SCT_VERSION_NOT_SET = -1,
|
||||||
|
SCT_VERSION_V1 = 0
|
||||||
|
} sct_version_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SCT_SOURCE_UNKNOWN,
|
||||||
|
SCT_SOURCE_TLS_EXTENSION,
|
||||||
|
SCT_SOURCE_X509V3_EXTENSION,
|
||||||
|
SCT_SOURCE_OCSP_STAPLED_RESPONSE
|
||||||
|
} sct_source_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SCT_VALIDATION_STATUS_NOT_SET,
|
||||||
|
SCT_VALIDATION_STATUS_UNKNOWN_LOG,
|
||||||
|
SCT_VALIDATION_STATUS_VALID,
|
||||||
|
SCT_VALIDATION_STATUS_INVALID,
|
||||||
|
SCT_VALIDATION_STATUS_UNVERIFIED,
|
||||||
|
SCT_VALIDATION_STATUS_UNKNOWN_VERSION
|
||||||
|
} sct_validation_status_t;
|
||||||
|
|
||||||
|
DEFINE_STACK_OF(SCT)
|
||||||
|
DEFINE_STACK_OF(CTLOG)
|
||||||
|
|
||||||
|
/******************************************
|
||||||
|
* CT policy evaluation context functions *
|
||||||
|
******************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new, empty policy evaluation context.
|
||||||
|
* The caller is responsible for calling CT_POLICY_EVAL_CTX_free when finished
|
||||||
|
* with the CT_POLICY_EVAL_CTX.
|
||||||
|
*/
|
||||||
|
CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void);
|
||||||
|
|
||||||
|
/* Deletes a policy evaluation context and anything it owns. */
|
||||||
|
void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
/* Gets the peer certificate that the SCTs are for */
|
||||||
|
X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets the certificate associated with the received SCTs.
|
||||||
|
* Increments the reference count of cert.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert);
|
||||||
|
|
||||||
|
/* Gets the issuer of the aforementioned certificate */
|
||||||
|
X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets the issuer of the certificate associated with the received SCTs.
|
||||||
|
* Increments the reference count of issuer.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer);
|
||||||
|
|
||||||
|
/* Gets the CT logs that are trusted sources of SCTs */
|
||||||
|
const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */
|
||||||
|
void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,
|
||||||
|
CTLOG_STORE *log_store);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gets the time, in milliseconds since the Unix epoch, that will be used as the
|
||||||
|
* current time when checking whether an SCT was issued in the future.
|
||||||
|
* Such SCTs will fail validation, as required by RFC6962.
|
||||||
|
*/
|
||||||
|
uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch.
|
||||||
|
* If an SCT's timestamp is after this time, it will be interpreted as having
|
||||||
|
* been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs
|
||||||
|
* whose timestamp is in the future", so an SCT will not validate in this case.
|
||||||
|
*/
|
||||||
|
void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms);
|
||||||
|
|
||||||
|
/*****************
|
||||||
|
* SCT functions *
|
||||||
|
*****************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new, blank SCT.
|
||||||
|
* The caller is responsible for calling SCT_free when finished with the SCT.
|
||||||
|
*/
|
||||||
|
SCT *SCT_new(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new SCT from some base64-encoded strings.
|
||||||
|
* The caller is responsible for calling SCT_free when finished with the SCT.
|
||||||
|
*/
|
||||||
|
SCT *SCT_new_from_base64(unsigned char version,
|
||||||
|
const char *logid_base64,
|
||||||
|
ct_log_entry_type_t entry_type,
|
||||||
|
uint64_t timestamp,
|
||||||
|
const char *extensions_base64,
|
||||||
|
const char *signature_base64);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Frees the SCT and the underlying data structures.
|
||||||
|
*/
|
||||||
|
void SCT_free(SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free a stack of SCTs, and the underlying SCTs themselves.
|
||||||
|
* Intended to be compatible with X509V3_EXT_FREE.
|
||||||
|
*/
|
||||||
|
void SCT_LIST_free(STACK_OF(SCT) *a);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the version of the SCT.
|
||||||
|
*/
|
||||||
|
sct_version_t SCT_get_version(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the version of an SCT.
|
||||||
|
* Returns 1 on success, 0 if the version is unrecognized.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set_version(SCT *sct, sct_version_t version);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the log entry type of the SCT.
|
||||||
|
*/
|
||||||
|
ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the log entry type of an SCT.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gets the ID of the log that an SCT came from.
|
||||||
|
* Ownership of the log ID remains with the SCT.
|
||||||
|
* Returns the length of the log ID.
|
||||||
|
*/
|
||||||
|
size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the log ID of an SCT to point directly to the *log_id specified.
|
||||||
|
* The SCT takes ownership of the specified pointer.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the log ID of an SCT.
|
||||||
|
* This makes a copy of the log_id.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set1_log_id(SCT *sct, const unsigned char *log_id,
|
||||||
|
size_t log_id_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the timestamp for the SCT (epoch time in milliseconds).
|
||||||
|
*/
|
||||||
|
uint64_t SCT_get_timestamp(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the timestamp of an SCT (epoch time in milliseconds).
|
||||||
|
*/
|
||||||
|
void SCT_set_timestamp(SCT *sct, uint64_t timestamp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the NID for the signature used by the SCT.
|
||||||
|
* For CT v1, this will be either NID_sha256WithRSAEncryption or
|
||||||
|
* NID_ecdsa_with_SHA256 (or NID_undef if incorrect/unset).
|
||||||
|
*/
|
||||||
|
int SCT_get_signature_nid(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the signature type of an SCT
|
||||||
|
* For CT v1, this should be either NID_sha256WithRSAEncryption or
|
||||||
|
* NID_ecdsa_with_SHA256.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set_signature_nid(SCT *sct, int nid);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set *ext to point to the extension data for the SCT. ext must not be NULL.
|
||||||
|
* The SCT retains ownership of this pointer.
|
||||||
|
* Returns length of the data pointed to.
|
||||||
|
*/
|
||||||
|
size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the extensions of an SCT to point directly to the *ext specified.
|
||||||
|
* The SCT takes ownership of the specified pointer.
|
||||||
|
*/
|
||||||
|
void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the extensions of an SCT.
|
||||||
|
* This takes a copy of the ext.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set1_extensions(SCT *sct, const unsigned char *ext,
|
||||||
|
size_t ext_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set *sig to point to the signature for the SCT. sig must not be NULL.
|
||||||
|
* The SCT retains ownership of this pointer.
|
||||||
|
* Returns length of the data pointed to.
|
||||||
|
*/
|
||||||
|
size_t SCT_get0_signature(const SCT *sct, unsigned char **sig);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the signature of an SCT to point directly to the *sig specified.
|
||||||
|
* The SCT takes ownership of the specified pointer.
|
||||||
|
*/
|
||||||
|
void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the signature of an SCT to be a copy of the *sig specified.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set1_signature(SCT *sct, const unsigned char *sig,
|
||||||
|
size_t sig_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The origin of this SCT, e.g. TLS extension, OCSP response, etc.
|
||||||
|
*/
|
||||||
|
sct_source_t SCT_get_source(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the origin of this SCT, e.g. TLS extension, OCSP response, etc.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set_source(SCT *sct, sct_source_t source);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns a text string describing the validation status of |sct|.
|
||||||
|
*/
|
||||||
|
const char *SCT_validation_status_string(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pretty-prints an |sct| to |out|.
|
||||||
|
* It will be indented by the number of spaces specified by |indent|.
|
||||||
|
* If |logs| is not NULL, it will be used to lookup the CT log that the SCT came
|
||||||
|
* from, so that the log name can be printed.
|
||||||
|
*/
|
||||||
|
void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pretty-prints an |sct_list| to |out|.
|
||||||
|
* It will be indented by the number of spaces specified by |indent|.
|
||||||
|
* SCTs will be delimited by |separator|.
|
||||||
|
* If |logs| is not NULL, it will be used to lookup the CT log that each SCT
|
||||||
|
* came from, so that the log names can be printed.
|
||||||
|
*/
|
||||||
|
void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent,
|
||||||
|
const char *separator, const CTLOG_STORE *logs);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gets the last result of validating this SCT.
|
||||||
|
* If it has not been validated yet, returns SCT_VALIDATION_STATUS_NOT_SET.
|
||||||
|
*/
|
||||||
|
sct_validation_status_t SCT_get_validation_status(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Validates the given SCT with the provided context.
|
||||||
|
* Sets the "validation_status" field of the SCT.
|
||||||
|
* Returns 1 if the SCT is valid and the signature verifies.
|
||||||
|
* Returns 0 if the SCT is invalid or could not be verified.
|
||||||
|
* Returns -1 if an error occurs.
|
||||||
|
*/
|
||||||
|
__owur int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Validates the given list of SCTs with the provided context.
|
||||||
|
* Sets the "validation_status" field of each SCT.
|
||||||
|
* Returns 1 if there are no invalid SCTs and all signatures verify.
|
||||||
|
* Returns 0 if at least one SCT is invalid or could not be verified.
|
||||||
|
* Returns a negative integer if an error occurs.
|
||||||
|
*/
|
||||||
|
__owur int SCT_LIST_validate(const STACK_OF(SCT) *scts,
|
||||||
|
CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************
|
||||||
|
* SCT parsing and serialisation *
|
||||||
|
*********************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Serialize (to TLS format) a stack of SCTs and return the length.
|
||||||
|
* "a" must not be NULL.
|
||||||
|
* If "pp" is NULL, just return the length of what would have been serialized.
|
||||||
|
* If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
|
||||||
|
* for data that caller is responsible for freeing (only if function returns
|
||||||
|
* successfully).
|
||||||
|
* If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
|
||||||
|
* that "*pp" is large enough to accept all of the serialized data.
|
||||||
|
* Returns < 0 on error, >= 0 indicating bytes written (or would have been)
|
||||||
|
* on success.
|
||||||
|
*/
|
||||||
|
__owur int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert TLS format SCT list to a stack of SCTs.
|
||||||
|
* If "a" or "*a" is NULL, a new stack will be created that the caller is
|
||||||
|
* responsible for freeing (by calling SCT_LIST_free).
|
||||||
|
* "**pp" and "*pp" must not be NULL.
|
||||||
|
* Upon success, "*pp" will point to after the last bytes read, and a stack
|
||||||
|
* will be returned.
|
||||||
|
* Upon failure, a NULL pointer will be returned, and the position of "*pp" is
|
||||||
|
* not defined.
|
||||||
|
*/
|
||||||
|
STACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
|
||||||
|
size_t len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Serialize (to DER format) a stack of SCTs and return the length.
|
||||||
|
* "a" must not be NULL.
|
||||||
|
* If "pp" is NULL, just returns the length of what would have been serialized.
|
||||||
|
* If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
|
||||||
|
* for data that caller is responsible for freeing (only if function returns
|
||||||
|
* successfully).
|
||||||
|
* If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
|
||||||
|
* that "*pp" is large enough to accept all of the serialized data.
|
||||||
|
* Returns < 0 on error, >= 0 indicating bytes written (or would have been)
|
||||||
|
* on success.
|
||||||
|
*/
|
||||||
|
__owur int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parses an SCT list in DER format and returns it.
|
||||||
|
* If "a" or "*a" is NULL, a new stack will be created that the caller is
|
||||||
|
* responsible for freeing (by calling SCT_LIST_free).
|
||||||
|
* "**pp" and "*pp" must not be NULL.
|
||||||
|
* Upon success, "*pp" will point to after the last bytes read, and a stack
|
||||||
|
* will be returned.
|
||||||
|
* Upon failure, a NULL pointer will be returned, and the position of "*pp" is
|
||||||
|
* not defined.
|
||||||
|
*/
|
||||||
|
STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
|
||||||
|
long len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Serialize (to TLS format) an |sct| and write it to |out|.
|
||||||
|
* If |out| is null, no SCT will be output but the length will still be returned.
|
||||||
|
* If |out| points to a null pointer, a string will be allocated to hold the
|
||||||
|
* TLS-format SCT. It is the responsibility of the caller to free it.
|
||||||
|
* If |out| points to an allocated string, the TLS-format SCT will be written
|
||||||
|
* to it.
|
||||||
|
* The length of the SCT in TLS format will be returned.
|
||||||
|
*/
|
||||||
|
__owur int i2o_SCT(const SCT *sct, unsigned char **out);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parses an SCT in TLS format and returns it.
|
||||||
|
* If |psct| is not null, it will end up pointing to the parsed SCT. If it
|
||||||
|
* already points to a non-null pointer, the pointer will be free'd.
|
||||||
|
* |in| should be a pointer to a string containing the TLS-format SCT.
|
||||||
|
* |in| will be advanced to the end of the SCT if parsing succeeds.
|
||||||
|
* |len| should be the length of the SCT in |in|.
|
||||||
|
* Returns NULL if an error occurs.
|
||||||
|
* If the SCT is an unsupported version, only the SCT's 'sct' and 'sct_len'
|
||||||
|
* fields will be populated (with |in| and |len| respectively).
|
||||||
|
*/
|
||||||
|
SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len);
|
||||||
|
|
||||||
|
/********************
|
||||||
|
* CT log functions *
|
||||||
|
********************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new CT log instance with the given |public_key| and |name|.
|
||||||
|
* Takes ownership of |public_key| but copies |name|.
|
||||||
|
* Returns NULL if malloc fails or if |public_key| cannot be converted to DER.
|
||||||
|
* Should be deleted by the caller using CTLOG_free when no longer needed.
|
||||||
|
*/
|
||||||
|
CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER
|
||||||
|
* in |pkey_base64|. The |name| is a string to help users identify this log.
|
||||||
|
* Returns 1 on success, 0 on failure.
|
||||||
|
* Should be deleted by the caller using CTLOG_free when no longer needed.
|
||||||
|
*/
|
||||||
|
int CTLOG_new_from_base64(CTLOG ** ct_log,
|
||||||
|
const char *pkey_base64, const char *name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deletes a CT log instance and its fields.
|
||||||
|
*/
|
||||||
|
void CTLOG_free(CTLOG *log);
|
||||||
|
|
||||||
|
/* Gets the name of the CT log */
|
||||||
|
const char *CTLOG_get0_name(const CTLOG *log);
|
||||||
|
/* Gets the ID of the CT log */
|
||||||
|
void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id,
|
||||||
|
size_t *log_id_len);
|
||||||
|
/* Gets the public key of the CT log */
|
||||||
|
EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log);
|
||||||
|
|
||||||
|
/**************************
|
||||||
|
* CT log store functions *
|
||||||
|
**************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new CT log store.
|
||||||
|
* Should be deleted by the caller using CTLOG_STORE_free when no longer needed.
|
||||||
|
*/
|
||||||
|
CTLOG_STORE *CTLOG_STORE_new(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deletes a CT log store and all of the CT log instances held within.
|
||||||
|
*/
|
||||||
|
void CTLOG_STORE_free(CTLOG_STORE *store);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Finds a CT log in the store based on its log ID.
|
||||||
|
* Returns the CT log, or NULL if no match is found.
|
||||||
|
*/
|
||||||
|
const CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store,
|
||||||
|
const uint8_t *log_id,
|
||||||
|
size_t log_id_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Loads a CT log list into a |store| from a |file|.
|
||||||
|
* Returns 1 if loading is successful, or 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Loads the default CT log list into a |store|.
|
||||||
|
* Returns 1 if loading is successful, or 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store);
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_CTERR_H
|
||||||
|
# define HEADER_CTERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CT
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_CT_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CT function codes.
|
||||||
|
*/
|
||||||
|
# define CT_F_CTLOG_NEW 117
|
||||||
|
# define CT_F_CTLOG_NEW_FROM_BASE64 118
|
||||||
|
# define CT_F_CTLOG_NEW_FROM_CONF 119
|
||||||
|
# define CT_F_CTLOG_STORE_LOAD_CTX_NEW 122
|
||||||
|
# define CT_F_CTLOG_STORE_LOAD_FILE 123
|
||||||
|
# define CT_F_CTLOG_STORE_LOAD_LOG 130
|
||||||
|
# define CT_F_CTLOG_STORE_NEW 131
|
||||||
|
# define CT_F_CT_BASE64_DECODE 124
|
||||||
|
# define CT_F_CT_POLICY_EVAL_CTX_NEW 133
|
||||||
|
# define CT_F_CT_V1_LOG_ID_FROM_PKEY 125
|
||||||
|
# define CT_F_I2O_SCT 107
|
||||||
|
# define CT_F_I2O_SCT_LIST 108
|
||||||
|
# define CT_F_I2O_SCT_SIGNATURE 109
|
||||||
|
# define CT_F_O2I_SCT 110
|
||||||
|
# define CT_F_O2I_SCT_LIST 111
|
||||||
|
# define CT_F_O2I_SCT_SIGNATURE 112
|
||||||
|
# define CT_F_SCT_CTX_NEW 126
|
||||||
|
# define CT_F_SCT_CTX_VERIFY 128
|
||||||
|
# define CT_F_SCT_NEW 100
|
||||||
|
# define CT_F_SCT_NEW_FROM_BASE64 127
|
||||||
|
# define CT_F_SCT_SET0_LOG_ID 101
|
||||||
|
# define CT_F_SCT_SET1_EXTENSIONS 114
|
||||||
|
# define CT_F_SCT_SET1_LOG_ID 115
|
||||||
|
# define CT_F_SCT_SET1_SIGNATURE 116
|
||||||
|
# define CT_F_SCT_SET_LOG_ENTRY_TYPE 102
|
||||||
|
# define CT_F_SCT_SET_SIGNATURE_NID 103
|
||||||
|
# define CT_F_SCT_SET_VERSION 104
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CT reason codes.
|
||||||
|
*/
|
||||||
|
# define CT_R_BASE64_DECODE_ERROR 108
|
||||||
|
# define CT_R_INVALID_LOG_ID_LENGTH 100
|
||||||
|
# define CT_R_LOG_CONF_INVALID 109
|
||||||
|
# define CT_R_LOG_CONF_INVALID_KEY 110
|
||||||
|
# define CT_R_LOG_CONF_MISSING_DESCRIPTION 111
|
||||||
|
# define CT_R_LOG_CONF_MISSING_KEY 112
|
||||||
|
# define CT_R_LOG_KEY_INVALID 113
|
||||||
|
# define CT_R_SCT_FUTURE_TIMESTAMP 116
|
||||||
|
# define CT_R_SCT_INVALID 104
|
||||||
|
# define CT_R_SCT_INVALID_SIGNATURE 107
|
||||||
|
# define CT_R_SCT_LIST_INVALID 105
|
||||||
|
# define CT_R_SCT_LOG_ID_MISMATCH 114
|
||||||
|
# define CT_R_SCT_NOT_SET 106
|
||||||
|
# define CT_R_SCT_UNSUPPORTED_VERSION 115
|
||||||
|
# define CT_R_UNRECOGNIZED_SIGNATURE_NID 101
|
||||||
|
# define CT_R_UNSUPPORTED_ENTRY_TYPE 102
|
||||||
|
# define CT_R_UNSUPPORTED_VERSION 103
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
@ -1,497 +0,0 @@
|
|||||||
/* crypto/des/des_old.h */
|
|
||||||
|
|
||||||
/*-
|
|
||||||
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
|
||||||
*
|
|
||||||
* The function names in here are deprecated and are only present to
|
|
||||||
* provide an interface compatible with openssl 0.9.6 and older as
|
|
||||||
* well as libdes. OpenSSL now provides functions where "des_" has
|
|
||||||
* been replaced with "DES_" in the names, to make it possible to
|
|
||||||
* make incompatible changes that are needed for C type security and
|
|
||||||
* other stuff.
|
|
||||||
*
|
|
||||||
* This include files has two compatibility modes:
|
|
||||||
*
|
|
||||||
* - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API
|
|
||||||
* that is compatible with libdes and SSLeay.
|
|
||||||
* - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an
|
|
||||||
* API that is compatible with OpenSSL 0.9.5x to 0.9.6x.
|
|
||||||
*
|
|
||||||
* Note that these modes break earlier snapshots of OpenSSL, where
|
|
||||||
* libdes compatibility was the only available mode or (later on) the
|
|
||||||
* prefered compatibility mode. However, after much consideration
|
|
||||||
* (and more or less violent discussions with external parties), it
|
|
||||||
* was concluded that OpenSSL should be compatible with earlier versions
|
|
||||||
* of itself before anything else. Also, in all honesty, libdes is
|
|
||||||
* an old beast that shouldn't really be used any more.
|
|
||||||
*
|
|
||||||
* Please consider starting to use the DES_ functions rather than the
|
|
||||||
* des_ ones. The des_ functions will disappear completely before
|
|
||||||
* OpenSSL 1.0!
|
|
||||||
*
|
|
||||||
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Written by Richard Levitte (richard@levitte.org) for the OpenSSL project
|
|
||||||
* 2001.
|
|
||||||
*/
|
|
||||||
/* ====================================================================
|
|
||||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
*
|
|
||||||
* 3. All advertising materials mentioning features or use of this
|
|
||||||
* software must display the following acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
|
||||||
*
|
|
||||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* prior written permission. For written permission, please contact
|
|
||||||
* openssl-core@openssl.org.
|
|
||||||
*
|
|
||||||
* 5. Products derived from this software may not be called "OpenSSL"
|
|
||||||
* nor may "OpenSSL" appear in their names without prior written
|
|
||||||
* permission of the OpenSSL Project.
|
|
||||||
*
|
|
||||||
* 6. Redistributions of any form whatsoever must retain the following
|
|
||||||
* acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
|
||||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
|
||||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
||||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
||||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
* ====================================================================
|
|
||||||
*
|
|
||||||
* This product includes cryptographic software written by Eric Young
|
|
||||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
|
||||||
* Hudson (tjh@cryptsoft.com).
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef HEADER_DES_H
|
|
||||||
# define HEADER_DES_H
|
|
||||||
|
|
||||||
# include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */
|
|
||||||
|
|
||||||
# ifdef OPENSSL_NO_DES
|
|
||||||
# error DES is disabled.
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef HEADER_NEW_DES_H
|
|
||||||
# error You must include des.h, not des_old.h directly.
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef _KERBEROS_DES_H
|
|
||||||
# error <openssl/des_old.h> replaces <kerberos/des.h>.
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# include <openssl/symhacks.h>
|
|
||||||
|
|
||||||
# ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
|
||||||
# undef OPENSSL_EXTERN
|
|
||||||
# define OPENSSL_EXTERN OPENSSL_EXPORT
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifdef _
|
|
||||||
# undef _
|
|
||||||
# endif
|
|
||||||
|
|
||||||
typedef unsigned char _ossl_old_des_cblock[8];
|
|
||||||
typedef struct _ossl_old_des_ks_struct {
|
|
||||||
union {
|
|
||||||
_ossl_old_des_cblock _;
|
|
||||||
/*
|
|
||||||
* make sure things are correct size on machines with 8 byte longs
|
|
||||||
*/
|
|
||||||
DES_LONG pad[2];
|
|
||||||
} ks;
|
|
||||||
} _ossl_old_des_key_schedule[16];
|
|
||||||
|
|
||||||
# ifndef OPENSSL_DES_LIBDES_COMPATIBILITY
|
|
||||||
# define des_cblock DES_cblock
|
|
||||||
# define const_des_cblock const_DES_cblock
|
|
||||||
# define des_key_schedule DES_key_schedule
|
|
||||||
# define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
|
|
||||||
DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e))
|
|
||||||
# define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
|
|
||||||
DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e))
|
|
||||||
# define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\
|
|
||||||
DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e))
|
|
||||||
# define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
|
|
||||||
DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e))
|
|
||||||
# define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
|
|
||||||
DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n))
|
|
||||||
# define des_options()\
|
|
||||||
DES_options()
|
|
||||||
# define des_cbc_cksum(i,o,l,k,iv)\
|
|
||||||
DES_cbc_cksum((i),(o),(l),&(k),(iv))
|
|
||||||
# define des_cbc_encrypt(i,o,l,k,iv,e)\
|
|
||||||
DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e))
|
|
||||||
# define des_ncbc_encrypt(i,o,l,k,iv,e)\
|
|
||||||
DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e))
|
|
||||||
# define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
|
|
||||||
DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e))
|
|
||||||
# define des_cfb_encrypt(i,o,n,l,k,iv,e)\
|
|
||||||
DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e))
|
|
||||||
# define des_ecb_encrypt(i,o,k,e)\
|
|
||||||
DES_ecb_encrypt((i),(o),&(k),(e))
|
|
||||||
# define des_encrypt1(d,k,e)\
|
|
||||||
DES_encrypt1((d),&(k),(e))
|
|
||||||
# define des_encrypt2(d,k,e)\
|
|
||||||
DES_encrypt2((d),&(k),(e))
|
|
||||||
# define des_encrypt3(d,k1,k2,k3)\
|
|
||||||
DES_encrypt3((d),&(k1),&(k2),&(k3))
|
|
||||||
# define des_decrypt3(d,k1,k2,k3)\
|
|
||||||
DES_decrypt3((d),&(k1),&(k2),&(k3))
|
|
||||||
# define des_xwhite_in2out(k,i,o)\
|
|
||||||
DES_xwhite_in2out((k),(i),(o))
|
|
||||||
# define des_enc_read(f,b,l,k,iv)\
|
|
||||||
DES_enc_read((f),(b),(l),&(k),(iv))
|
|
||||||
# define des_enc_write(f,b,l,k,iv)\
|
|
||||||
DES_enc_write((f),(b),(l),&(k),(iv))
|
|
||||||
# define des_fcrypt(b,s,r)\
|
|
||||||
DES_fcrypt((b),(s),(r))
|
|
||||||
# if 0
|
|
||||||
# define des_crypt(b,s)\
|
|
||||||
DES_crypt((b),(s))
|
|
||||||
# if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)
|
|
||||||
# define crypt(b,s)\
|
|
||||||
DES_crypt((b),(s))
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# define des_ofb_encrypt(i,o,n,l,k,iv)\
|
|
||||||
DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv))
|
|
||||||
# define des_pcbc_encrypt(i,o,l,k,iv,e)\
|
|
||||||
DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e))
|
|
||||||
# define des_quad_cksum(i,o,l,c,s)\
|
|
||||||
DES_quad_cksum((i),(o),(l),(c),(s))
|
|
||||||
# define des_random_seed(k)\
|
|
||||||
_ossl_096_des_random_seed((k))
|
|
||||||
# define des_random_key(r)\
|
|
||||||
DES_random_key((r))
|
|
||||||
# define des_read_password(k,p,v) \
|
|
||||||
DES_read_password((k),(p),(v))
|
|
||||||
# define des_read_2passwords(k1,k2,p,v) \
|
|
||||||
DES_read_2passwords((k1),(k2),(p),(v))
|
|
||||||
# define des_set_odd_parity(k)\
|
|
||||||
DES_set_odd_parity((k))
|
|
||||||
# define des_check_key_parity(k)\
|
|
||||||
DES_check_key_parity((k))
|
|
||||||
# define des_is_weak_key(k)\
|
|
||||||
DES_is_weak_key((k))
|
|
||||||
# define des_set_key(k,ks)\
|
|
||||||
DES_set_key((k),&(ks))
|
|
||||||
# define des_key_sched(k,ks)\
|
|
||||||
DES_key_sched((k),&(ks))
|
|
||||||
# define des_set_key_checked(k,ks)\
|
|
||||||
DES_set_key_checked((k),&(ks))
|
|
||||||
# define des_set_key_unchecked(k,ks)\
|
|
||||||
DES_set_key_unchecked((k),&(ks))
|
|
||||||
# define des_string_to_key(s,k)\
|
|
||||||
DES_string_to_key((s),(k))
|
|
||||||
# define des_string_to_2keys(s,k1,k2)\
|
|
||||||
DES_string_to_2keys((s),(k1),(k2))
|
|
||||||
# define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
|
|
||||||
DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e))
|
|
||||||
# define des_ofb64_encrypt(i,o,l,ks,iv,n)\
|
|
||||||
DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n))
|
|
||||||
|
|
||||||
# define des_ecb2_encrypt(i,o,k1,k2,e) \
|
|
||||||
des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
|
|
||||||
|
|
||||||
# define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
|
|
||||||
des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
|
|
||||||
|
|
||||||
# define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
|
|
||||||
des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
|
|
||||||
|
|
||||||
# define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
|
|
||||||
des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
|
|
||||||
|
|
||||||
# define des_check_key DES_check_key
|
|
||||||
# define des_rw_mode DES_rw_mode
|
|
||||||
# else /* libdes compatibility */
|
|
||||||
/*
|
|
||||||
* Map all symbol names to _ossl_old_des_* form, so we avoid all clashes with
|
|
||||||
* libdes
|
|
||||||
*/
|
|
||||||
# define des_cblock _ossl_old_des_cblock
|
|
||||||
# define des_key_schedule _ossl_old_des_key_schedule
|
|
||||||
# define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
|
|
||||||
_ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e))
|
|
||||||
# define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
|
|
||||||
_ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e))
|
|
||||||
# define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
|
|
||||||
_ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e))
|
|
||||||
# define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
|
|
||||||
_ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n))
|
|
||||||
# define des_options()\
|
|
||||||
_ossl_old_des_options()
|
|
||||||
# define des_cbc_cksum(i,o,l,k,iv)\
|
|
||||||
_ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv))
|
|
||||||
# define des_cbc_encrypt(i,o,l,k,iv,e)\
|
|
||||||
_ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e))
|
|
||||||
# define des_ncbc_encrypt(i,o,l,k,iv,e)\
|
|
||||||
_ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e))
|
|
||||||
# define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
|
|
||||||
_ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e))
|
|
||||||
# define des_cfb_encrypt(i,o,n,l,k,iv,e)\
|
|
||||||
_ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e))
|
|
||||||
# define des_ecb_encrypt(i,o,k,e)\
|
|
||||||
_ossl_old_des_ecb_encrypt((i),(o),(k),(e))
|
|
||||||
# define des_encrypt(d,k,e)\
|
|
||||||
_ossl_old_des_encrypt((d),(k),(e))
|
|
||||||
# define des_encrypt2(d,k,e)\
|
|
||||||
_ossl_old_des_encrypt2((d),(k),(e))
|
|
||||||
# define des_encrypt3(d,k1,k2,k3)\
|
|
||||||
_ossl_old_des_encrypt3((d),(k1),(k2),(k3))
|
|
||||||
# define des_decrypt3(d,k1,k2,k3)\
|
|
||||||
_ossl_old_des_decrypt3((d),(k1),(k2),(k3))
|
|
||||||
# define des_xwhite_in2out(k,i,o)\
|
|
||||||
_ossl_old_des_xwhite_in2out((k),(i),(o))
|
|
||||||
# define des_enc_read(f,b,l,k,iv)\
|
|
||||||
_ossl_old_des_enc_read((f),(b),(l),(k),(iv))
|
|
||||||
# define des_enc_write(f,b,l,k,iv)\
|
|
||||||
_ossl_old_des_enc_write((f),(b),(l),(k),(iv))
|
|
||||||
# define des_fcrypt(b,s,r)\
|
|
||||||
_ossl_old_des_fcrypt((b),(s),(r))
|
|
||||||
# define des_crypt(b,s)\
|
|
||||||
_ossl_old_des_crypt((b),(s))
|
|
||||||
# if 0
|
|
||||||
# define crypt(b,s)\
|
|
||||||
_ossl_old_crypt((b),(s))
|
|
||||||
# endif
|
|
||||||
# define des_ofb_encrypt(i,o,n,l,k,iv)\
|
|
||||||
_ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv))
|
|
||||||
# define des_pcbc_encrypt(i,o,l,k,iv,e)\
|
|
||||||
_ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e))
|
|
||||||
# define des_quad_cksum(i,o,l,c,s)\
|
|
||||||
_ossl_old_des_quad_cksum((i),(o),(l),(c),(s))
|
|
||||||
# define des_random_seed(k)\
|
|
||||||
_ossl_old_des_random_seed((k))
|
|
||||||
# define des_random_key(r)\
|
|
||||||
_ossl_old_des_random_key((r))
|
|
||||||
# define des_read_password(k,p,v) \
|
|
||||||
_ossl_old_des_read_password((k),(p),(v))
|
|
||||||
# define des_read_2passwords(k1,k2,p,v) \
|
|
||||||
_ossl_old_des_read_2passwords((k1),(k2),(p),(v))
|
|
||||||
# define des_set_odd_parity(k)\
|
|
||||||
_ossl_old_des_set_odd_parity((k))
|
|
||||||
# define des_is_weak_key(k)\
|
|
||||||
_ossl_old_des_is_weak_key((k))
|
|
||||||
# define des_set_key(k,ks)\
|
|
||||||
_ossl_old_des_set_key((k),(ks))
|
|
||||||
# define des_key_sched(k,ks)\
|
|
||||||
_ossl_old_des_key_sched((k),(ks))
|
|
||||||
# define des_string_to_key(s,k)\
|
|
||||||
_ossl_old_des_string_to_key((s),(k))
|
|
||||||
# define des_string_to_2keys(s,k1,k2)\
|
|
||||||
_ossl_old_des_string_to_2keys((s),(k1),(k2))
|
|
||||||
# define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
|
|
||||||
_ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e))
|
|
||||||
# define des_ofb64_encrypt(i,o,l,ks,iv,n)\
|
|
||||||
_ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n))
|
|
||||||
|
|
||||||
# define des_ecb2_encrypt(i,o,k1,k2,e) \
|
|
||||||
des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
|
|
||||||
|
|
||||||
# define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
|
|
||||||
des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
|
|
||||||
|
|
||||||
# define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
|
|
||||||
des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
|
|
||||||
|
|
||||||
# define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
|
|
||||||
des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
|
|
||||||
|
|
||||||
# define des_check_key DES_check_key
|
|
||||||
# define des_rw_mode DES_rw_mode
|
|
||||||
# endif
|
|
||||||
|
|
||||||
const char *_ossl_old_des_options(void);
|
|
||||||
void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,
|
|
||||||
_ossl_old_des_cblock *output,
|
|
||||||
_ossl_old_des_key_schedule ks1,
|
|
||||||
_ossl_old_des_key_schedule ks2,
|
|
||||||
_ossl_old_des_key_schedule ks3, int enc);
|
|
||||||
DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,
|
|
||||||
_ossl_old_des_cblock *output, long length,
|
|
||||||
_ossl_old_des_key_schedule schedule,
|
|
||||||
_ossl_old_des_cblock *ivec);
|
|
||||||
void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,
|
|
||||||
_ossl_old_des_cblock *output, long length,
|
|
||||||
_ossl_old_des_key_schedule schedule,
|
|
||||||
_ossl_old_des_cblock *ivec, int enc);
|
|
||||||
void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,
|
|
||||||
_ossl_old_des_cblock *output, long length,
|
|
||||||
_ossl_old_des_key_schedule schedule,
|
|
||||||
_ossl_old_des_cblock *ivec, int enc);
|
|
||||||
void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,
|
|
||||||
_ossl_old_des_cblock *output, long length,
|
|
||||||
_ossl_old_des_key_schedule schedule,
|
|
||||||
_ossl_old_des_cblock *ivec,
|
|
||||||
_ossl_old_des_cblock *inw,
|
|
||||||
_ossl_old_des_cblock *outw, int enc);
|
|
||||||
void _ossl_old_des_cfb_encrypt(unsigned char *in, unsigned char *out,
|
|
||||||
int numbits, long length,
|
|
||||||
_ossl_old_des_key_schedule schedule,
|
|
||||||
_ossl_old_des_cblock *ivec, int enc);
|
|
||||||
void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,
|
|
||||||
_ossl_old_des_cblock *output,
|
|
||||||
_ossl_old_des_key_schedule ks, int enc);
|
|
||||||
void _ossl_old_des_encrypt(DES_LONG *data, _ossl_old_des_key_schedule ks,
|
|
||||||
int enc);
|
|
||||||
void _ossl_old_des_encrypt2(DES_LONG *data, _ossl_old_des_key_schedule ks,
|
|
||||||
int enc);
|
|
||||||
void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
|
|
||||||
_ossl_old_des_key_schedule ks2,
|
|
||||||
_ossl_old_des_key_schedule ks3);
|
|
||||||
void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
|
|
||||||
_ossl_old_des_key_schedule ks2,
|
|
||||||
_ossl_old_des_key_schedule ks3);
|
|
||||||
void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input,
|
|
||||||
_ossl_old_des_cblock *output, long length,
|
|
||||||
_ossl_old_des_key_schedule ks1,
|
|
||||||
_ossl_old_des_key_schedule ks2,
|
|
||||||
_ossl_old_des_key_schedule ks3,
|
|
||||||
_ossl_old_des_cblock *ivec, int enc);
|
|
||||||
void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out,
|
|
||||||
long length,
|
|
||||||
_ossl_old_des_key_schedule ks1,
|
|
||||||
_ossl_old_des_key_schedule ks2,
|
|
||||||
_ossl_old_des_key_schedule ks3,
|
|
||||||
_ossl_old_des_cblock *ivec, int *num,
|
|
||||||
int enc);
|
|
||||||
void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,
|
|
||||||
long length,
|
|
||||||
_ossl_old_des_key_schedule ks1,
|
|
||||||
_ossl_old_des_key_schedule ks2,
|
|
||||||
_ossl_old_des_key_schedule ks3,
|
|
||||||
_ossl_old_des_cblock *ivec, int *num);
|
|
||||||
# if 0
|
|
||||||
void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key),
|
|
||||||
_ossl_old_des_cblock (*in_white),
|
|
||||||
_ossl_old_des_cblock (*out_white));
|
|
||||||
# endif
|
|
||||||
|
|
||||||
int _ossl_old_des_enc_read(int fd, char *buf, int len,
|
|
||||||
_ossl_old_des_key_schedule sched,
|
|
||||||
_ossl_old_des_cblock *iv);
|
|
||||||
int _ossl_old_des_enc_write(int fd, char *buf, int len,
|
|
||||||
_ossl_old_des_key_schedule sched,
|
|
||||||
_ossl_old_des_cblock *iv);
|
|
||||||
char *_ossl_old_des_fcrypt(const char *buf, const char *salt, char *ret);
|
|
||||||
char *_ossl_old_des_crypt(const char *buf, const char *salt);
|
|
||||||
# if !defined(PERL5) && !defined(NeXT)
|
|
||||||
char *_ossl_old_crypt(const char *buf, const char *salt);
|
|
||||||
# endif
|
|
||||||
void _ossl_old_des_ofb_encrypt(unsigned char *in, unsigned char *out,
|
|
||||||
int numbits, long length,
|
|
||||||
_ossl_old_des_key_schedule schedule,
|
|
||||||
_ossl_old_des_cblock *ivec);
|
|
||||||
void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,
|
|
||||||
_ossl_old_des_cblock *output, long length,
|
|
||||||
_ossl_old_des_key_schedule schedule,
|
|
||||||
_ossl_old_des_cblock *ivec, int enc);
|
|
||||||
DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,
|
|
||||||
_ossl_old_des_cblock *output, long length,
|
|
||||||
int out_count, _ossl_old_des_cblock *seed);
|
|
||||||
void _ossl_old_des_random_seed(_ossl_old_des_cblock key);
|
|
||||||
void _ossl_old_des_random_key(_ossl_old_des_cblock ret);
|
|
||||||
int _ossl_old_des_read_password(_ossl_old_des_cblock *key, const char *prompt,
|
|
||||||
int verify);
|
|
||||||
int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,
|
|
||||||
_ossl_old_des_cblock *key2,
|
|
||||||
const char *prompt, int verify);
|
|
||||||
void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key);
|
|
||||||
int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key);
|
|
||||||
int _ossl_old_des_set_key(_ossl_old_des_cblock *key,
|
|
||||||
_ossl_old_des_key_schedule schedule);
|
|
||||||
int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,
|
|
||||||
_ossl_old_des_key_schedule schedule);
|
|
||||||
void _ossl_old_des_string_to_key(char *str, _ossl_old_des_cblock *key);
|
|
||||||
void _ossl_old_des_string_to_2keys(char *str, _ossl_old_des_cblock *key1,
|
|
||||||
_ossl_old_des_cblock *key2);
|
|
||||||
void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out,
|
|
||||||
long length,
|
|
||||||
_ossl_old_des_key_schedule schedule,
|
|
||||||
_ossl_old_des_cblock *ivec, int *num,
|
|
||||||
int enc);
|
|
||||||
void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out,
|
|
||||||
long length,
|
|
||||||
_ossl_old_des_key_schedule schedule,
|
|
||||||
_ossl_old_des_cblock *ivec, int *num);
|
|
||||||
|
|
||||||
void _ossl_096_des_random_seed(des_cblock *key);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The following definitions provide compatibility with the MIT Kerberos
|
|
||||||
* library. The _ossl_old_des_key_schedule structure is not binary
|
|
||||||
* compatible.
|
|
||||||
*/
|
|
||||||
|
|
||||||
# define _KERBEROS_DES_H
|
|
||||||
|
|
||||||
# define KRBDES_ENCRYPT DES_ENCRYPT
|
|
||||||
# define KRBDES_DECRYPT DES_DECRYPT
|
|
||||||
|
|
||||||
# ifdef KERBEROS
|
|
||||||
# define ENCRYPT DES_ENCRYPT
|
|
||||||
# define DECRYPT DES_DECRYPT
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef NCOMPAT
|
|
||||||
# define C_Block des_cblock
|
|
||||||
# define Key_schedule des_key_schedule
|
|
||||||
# define KEY_SZ DES_KEY_SZ
|
|
||||||
# define string_to_key des_string_to_key
|
|
||||||
# define read_pw_string des_read_pw_string
|
|
||||||
# define random_key des_random_key
|
|
||||||
# define pcbc_encrypt des_pcbc_encrypt
|
|
||||||
# define set_key des_set_key
|
|
||||||
# define key_sched des_key_sched
|
|
||||||
# define ecb_encrypt des_ecb_encrypt
|
|
||||||
# define cbc_encrypt des_cbc_encrypt
|
|
||||||
# define ncbc_encrypt des_ncbc_encrypt
|
|
||||||
# define xcbc_encrypt des_xcbc_encrypt
|
|
||||||
# define cbc_cksum des_cbc_cksum
|
|
||||||
# define quad_cksum des_quad_cksum
|
|
||||||
# define check_parity des_check_key_parity
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# define des_fixup_key_parity DES_fixup_key_parity
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* for DES_read_pw_string et al */
|
|
||||||
# include <openssl/ui_compat.h>
|
|
||||||
|
|
||||||
#endif
|
|
@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_DHERR_H
|
||||||
|
# define HEADER_DHERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DH
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_DH_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DH function codes.
|
||||||
|
*/
|
||||||
|
# define DH_F_COMPUTE_KEY 102
|
||||||
|
# define DH_F_DHPARAMS_PRINT_FP 101
|
||||||
|
# define DH_F_DH_BUILTIN_GENPARAMS 106
|
||||||
|
# define DH_F_DH_CHECK_EX 121
|
||||||
|
# define DH_F_DH_CHECK_PARAMS_EX 122
|
||||||
|
# define DH_F_DH_CHECK_PUB_KEY_EX 123
|
||||||
|
# define DH_F_DH_CMS_DECRYPT 114
|
||||||
|
# define DH_F_DH_CMS_SET_PEERKEY 115
|
||||||
|
# define DH_F_DH_CMS_SET_SHARED_INFO 116
|
||||||
|
# define DH_F_DH_METH_DUP 117
|
||||||
|
# define DH_F_DH_METH_NEW 118
|
||||||
|
# define DH_F_DH_METH_SET1_NAME 119
|
||||||
|
# define DH_F_DH_NEW_BY_NID 104
|
||||||
|
# define DH_F_DH_NEW_METHOD 105
|
||||||
|
# define DH_F_DH_PARAM_DECODE 107
|
||||||
|
# define DH_F_DH_PKEY_PUBLIC_CHECK 124
|
||||||
|
# define DH_F_DH_PRIV_DECODE 110
|
||||||
|
# define DH_F_DH_PRIV_ENCODE 111
|
||||||
|
# define DH_F_DH_PUB_DECODE 108
|
||||||
|
# define DH_F_DH_PUB_ENCODE 109
|
||||||
|
# define DH_F_DO_DH_PRINT 100
|
||||||
|
# define DH_F_GENERATE_KEY 103
|
||||||
|
# define DH_F_PKEY_DH_CTRL_STR 120
|
||||||
|
# define DH_F_PKEY_DH_DERIVE 112
|
||||||
|
# define DH_F_PKEY_DH_INIT 125
|
||||||
|
# define DH_F_PKEY_DH_KEYGEN 113
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DH reason codes.
|
||||||
|
*/
|
||||||
|
# define DH_R_BAD_GENERATOR 101
|
||||||
|
# define DH_R_BN_DECODE_ERROR 109
|
||||||
|
# define DH_R_BN_ERROR 106
|
||||||
|
# define DH_R_CHECK_INVALID_J_VALUE 115
|
||||||
|
# define DH_R_CHECK_INVALID_Q_VALUE 116
|
||||||
|
# define DH_R_CHECK_PUBKEY_INVALID 122
|
||||||
|
# define DH_R_CHECK_PUBKEY_TOO_LARGE 123
|
||||||
|
# define DH_R_CHECK_PUBKEY_TOO_SMALL 124
|
||||||
|
# define DH_R_CHECK_P_NOT_PRIME 117
|
||||||
|
# define DH_R_CHECK_P_NOT_SAFE_PRIME 118
|
||||||
|
# define DH_R_CHECK_Q_NOT_PRIME 119
|
||||||
|
# define DH_R_DECODE_ERROR 104
|
||||||
|
# define DH_R_INVALID_PARAMETER_NAME 110
|
||||||
|
# define DH_R_INVALID_PARAMETER_NID 114
|
||||||
|
# define DH_R_INVALID_PUBKEY 102
|
||||||
|
# define DH_R_KDF_PARAMETER_ERROR 112
|
||||||
|
# define DH_R_KEYS_NOT_SET 108
|
||||||
|
# define DH_R_MISSING_PUBKEY 125
|
||||||
|
# define DH_R_MODULUS_TOO_LARGE 103
|
||||||
|
# define DH_R_NOT_SUITABLE_GENERATOR 120
|
||||||
|
# define DH_R_NO_PARAMETERS_SET 107
|
||||||
|
# define DH_R_NO_PRIVATE_VALUE 100
|
||||||
|
# define DH_R_PARAMETER_ENCODING_ERROR 105
|
||||||
|
# define DH_R_PEER_KEY_ERROR 111
|
||||||
|
# define DH_R_SHARED_INFO_ERROR 113
|
||||||
|
# define DH_R_UNABLE_TO_CHECK_GENERATOR 121
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_DSAERR_H
|
||||||
|
# define HEADER_DSAERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DSA
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_DSA_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DSA function codes.
|
||||||
|
*/
|
||||||
|
# define DSA_F_DSAPARAMS_PRINT 100
|
||||||
|
# define DSA_F_DSAPARAMS_PRINT_FP 101
|
||||||
|
# define DSA_F_DSA_BUILTIN_PARAMGEN 125
|
||||||
|
# define DSA_F_DSA_BUILTIN_PARAMGEN2 126
|
||||||
|
# define DSA_F_DSA_DO_SIGN 112
|
||||||
|
# define DSA_F_DSA_DO_VERIFY 113
|
||||||
|
# define DSA_F_DSA_METH_DUP 127
|
||||||
|
# define DSA_F_DSA_METH_NEW 128
|
||||||
|
# define DSA_F_DSA_METH_SET1_NAME 129
|
||||||
|
# define DSA_F_DSA_NEW_METHOD 103
|
||||||
|
# define DSA_F_DSA_PARAM_DECODE 119
|
||||||
|
# define DSA_F_DSA_PRINT_FP 105
|
||||||
|
# define DSA_F_DSA_PRIV_DECODE 115
|
||||||
|
# define DSA_F_DSA_PRIV_ENCODE 116
|
||||||
|
# define DSA_F_DSA_PUB_DECODE 117
|
||||||
|
# define DSA_F_DSA_PUB_ENCODE 118
|
||||||
|
# define DSA_F_DSA_SIGN 106
|
||||||
|
# define DSA_F_DSA_SIGN_SETUP 107
|
||||||
|
# define DSA_F_DSA_SIG_NEW 102
|
||||||
|
# define DSA_F_OLD_DSA_PRIV_DECODE 122
|
||||||
|
# define DSA_F_PKEY_DSA_CTRL 120
|
||||||
|
# define DSA_F_PKEY_DSA_CTRL_STR 104
|
||||||
|
# define DSA_F_PKEY_DSA_KEYGEN 121
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DSA reason codes.
|
||||||
|
*/
|
||||||
|
# define DSA_R_BAD_Q_VALUE 102
|
||||||
|
# define DSA_R_BN_DECODE_ERROR 108
|
||||||
|
# define DSA_R_BN_ERROR 109
|
||||||
|
# define DSA_R_DECODE_ERROR 104
|
||||||
|
# define DSA_R_INVALID_DIGEST_TYPE 106
|
||||||
|
# define DSA_R_INVALID_PARAMETERS 112
|
||||||
|
# define DSA_R_MISSING_PARAMETERS 101
|
||||||
|
# define DSA_R_MISSING_PRIVATE_KEY 111
|
||||||
|
# define DSA_R_MODULUS_TOO_LARGE 103
|
||||||
|
# define DSA_R_NO_PARAMETERS_SET 107
|
||||||
|
# define DSA_R_PARAMETER_ENCODING_ERROR 105
|
||||||
|
# define DSA_R_Q_NOT_PRIME 113
|
||||||
|
# define DSA_R_SEED_LEN_SMALL 110
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
@ -1,451 +0,0 @@
|
|||||||
/* dso.h */
|
|
||||||
/*
|
|
||||||
* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project
|
|
||||||
* 2000.
|
|
||||||
*/
|
|
||||||
/* ====================================================================
|
|
||||||
* Copyright (c) 2000 The OpenSSL Project. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
*
|
|
||||||
* 3. All advertising materials mentioning features or use of this
|
|
||||||
* software must display the following acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
|
||||||
*
|
|
||||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* prior written permission. For written permission, please contact
|
|
||||||
* licensing@OpenSSL.org.
|
|
||||||
*
|
|
||||||
* 5. Products derived from this software may not be called "OpenSSL"
|
|
||||||
* nor may "OpenSSL" appear in their names without prior written
|
|
||||||
* permission of the OpenSSL Project.
|
|
||||||
*
|
|
||||||
* 6. Redistributions of any form whatsoever must retain the following
|
|
||||||
* acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
|
||||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
|
||||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
||||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
||||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
* ====================================================================
|
|
||||||
*
|
|
||||||
* This product includes cryptographic software written by Eric Young
|
|
||||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
|
||||||
* Hudson (tjh@cryptsoft.com).
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef HEADER_DSO_H
|
|
||||||
# define HEADER_DSO_H
|
|
||||||
|
|
||||||
# include <openssl/crypto.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* These values are used as commands to DSO_ctrl() */
|
|
||||||
# define DSO_CTRL_GET_FLAGS 1
|
|
||||||
# define DSO_CTRL_SET_FLAGS 2
|
|
||||||
# define DSO_CTRL_OR_FLAGS 3
|
|
||||||
|
|
||||||
/*
|
|
||||||
* By default, DSO_load() will translate the provided filename into a form
|
|
||||||
* typical for the platform (more specifically the DSO_METHOD) using the
|
|
||||||
* dso_name_converter function of the method. Eg. win32 will transform "blah"
|
|
||||||
* into "blah.dll", and dlfcn will transform it into "libblah.so". The
|
|
||||||
* behaviour can be overriden by setting the name_converter callback in the
|
|
||||||
* DSO object (using DSO_set_name_converter()). This callback could even
|
|
||||||
* utilise the DSO_METHOD's converter too if it only wants to override
|
|
||||||
* behaviour for one or two possible DSO methods. However, the following flag
|
|
||||||
* can be set in a DSO to prevent *any* native name-translation at all - eg.
|
|
||||||
* if the caller has prompted the user for a path to a driver library so the
|
|
||||||
* filename should be interpreted as-is.
|
|
||||||
*/
|
|
||||||
# define DSO_FLAG_NO_NAME_TRANSLATION 0x01
|
|
||||||
/*
|
|
||||||
* An extra flag to give if only the extension should be added as
|
|
||||||
* translation. This is obviously only of importance on Unix and other
|
|
||||||
* operating systems where the translation also may prefix the name with
|
|
||||||
* something, like 'lib', and ignored everywhere else. This flag is also
|
|
||||||
* ignored if DSO_FLAG_NO_NAME_TRANSLATION is used at the same time.
|
|
||||||
*/
|
|
||||||
# define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY 0x02
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The following flag controls the translation of symbol names to upper case.
|
|
||||||
* This is currently only being implemented for OpenVMS.
|
|
||||||
*/
|
|
||||||
# define DSO_FLAG_UPCASE_SYMBOL 0x10
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This flag loads the library with public symbols. Meaning: The exported
|
|
||||||
* symbols of this library are public to all libraries loaded after this
|
|
||||||
* library. At the moment only implemented in unix.
|
|
||||||
*/
|
|
||||||
# define DSO_FLAG_GLOBAL_SYMBOLS 0x20
|
|
||||||
|
|
||||||
typedef void (*DSO_FUNC_TYPE) (void);
|
|
||||||
|
|
||||||
typedef struct dso_st DSO;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The function prototype used for method functions (or caller-provided
|
|
||||||
* callbacks) that transform filenames. They are passed a DSO structure
|
|
||||||
* pointer (or NULL if they are to be used independantly of a DSO object) and
|
|
||||||
* a filename to transform. They should either return NULL (if there is an
|
|
||||||
* error condition) or a newly allocated string containing the transformed
|
|
||||||
* form that the caller will need to free with OPENSSL_free() when done.
|
|
||||||
*/
|
|
||||||
typedef char *(*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
|
|
||||||
/*
|
|
||||||
* The function prototype used for method functions (or caller-provided
|
|
||||||
* callbacks) that merge two file specifications. They are passed a DSO
|
|
||||||
* structure pointer (or NULL if they are to be used independantly of a DSO
|
|
||||||
* object) and two file specifications to merge. They should either return
|
|
||||||
* NULL (if there is an error condition) or a newly allocated string
|
|
||||||
* containing the result of merging that the caller will need to free with
|
|
||||||
* OPENSSL_free() when done. Here, merging means that bits and pieces are
|
|
||||||
* taken from each of the file specifications and added together in whatever
|
|
||||||
* fashion that is sensible for the DSO method in question. The only rule
|
|
||||||
* that really applies is that if the two specification contain pieces of the
|
|
||||||
* same type, the copy from the first string takes priority. One could see
|
|
||||||
* it as the first specification is the one given by the user and the second
|
|
||||||
* being a bunch of defaults to add on if they're missing in the first.
|
|
||||||
*/
|
|
||||||
typedef char *(*DSO_MERGER_FUNC)(DSO *, const char *, const char *);
|
|
||||||
|
|
||||||
typedef struct dso_meth_st {
|
|
||||||
const char *name;
|
|
||||||
/*
|
|
||||||
* Loads a shared library, NB: new DSO_METHODs must ensure that a
|
|
||||||
* successful load populates the loaded_filename field, and likewise a
|
|
||||||
* successful unload OPENSSL_frees and NULLs it out.
|
|
||||||
*/
|
|
||||||
int (*dso_load) (DSO *dso);
|
|
||||||
/* Unloads a shared library */
|
|
||||||
int (*dso_unload) (DSO *dso);
|
|
||||||
/* Binds a variable */
|
|
||||||
void *(*dso_bind_var) (DSO *dso, const char *symname);
|
|
||||||
/*
|
|
||||||
* Binds a function - assumes a return type of DSO_FUNC_TYPE. This should
|
|
||||||
* be cast to the real function prototype by the caller. Platforms that
|
|
||||||
* don't have compatible representations for different prototypes (this
|
|
||||||
* is possible within ANSI C) are highly unlikely to have shared
|
|
||||||
* libraries at all, let alone a DSO_METHOD implemented for them.
|
|
||||||
*/
|
|
||||||
DSO_FUNC_TYPE (*dso_bind_func) (DSO *dso, const char *symname);
|
|
||||||
/* I don't think this would actually be used in any circumstances. */
|
|
||||||
# if 0
|
|
||||||
/* Unbinds a variable */
|
|
||||||
int (*dso_unbind_var) (DSO *dso, char *symname, void *symptr);
|
|
||||||
/* Unbinds a function */
|
|
||||||
int (*dso_unbind_func) (DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
|
|
||||||
# endif
|
|
||||||
/*
|
|
||||||
* The generic (yuck) "ctrl()" function. NB: Negative return values
|
|
||||||
* (rather than zero) indicate errors.
|
|
||||||
*/
|
|
||||||
long (*dso_ctrl) (DSO *dso, int cmd, long larg, void *parg);
|
|
||||||
/*
|
|
||||||
* The default DSO_METHOD-specific function for converting filenames to a
|
|
||||||
* canonical native form.
|
|
||||||
*/
|
|
||||||
DSO_NAME_CONVERTER_FUNC dso_name_converter;
|
|
||||||
/*
|
|
||||||
* The default DSO_METHOD-specific function for converting filenames to a
|
|
||||||
* canonical native form.
|
|
||||||
*/
|
|
||||||
DSO_MERGER_FUNC dso_merger;
|
|
||||||
/* [De]Initialisation handlers. */
|
|
||||||
int (*init) (DSO *dso);
|
|
||||||
int (*finish) (DSO *dso);
|
|
||||||
/* Return pathname of the module containing location */
|
|
||||||
int (*pathbyaddr) (void *addr, char *path, int sz);
|
|
||||||
/* Perform global symbol lookup, i.e. among *all* modules */
|
|
||||||
void *(*globallookup) (const char *symname);
|
|
||||||
} DSO_METHOD;
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
/* The low-level handle type used to refer to a loaded shared library */
|
|
||||||
|
|
||||||
struct dso_st {
|
|
||||||
DSO_METHOD *meth;
|
|
||||||
/*
|
|
||||||
* Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS doesn't use
|
|
||||||
* anything but will need to cache the filename for use in the dso_bind
|
|
||||||
* handler. All in all, let each method control its own destiny.
|
|
||||||
* "Handles" and such go in a STACK.
|
|
||||||
*/
|
|
||||||
STACK_OF(void) *meth_data;
|
|
||||||
int references;
|
|
||||||
int flags;
|
|
||||||
/*
|
|
||||||
* For use by applications etc ... use this for your bits'n'pieces, don't
|
|
||||||
* touch meth_data!
|
|
||||||
*/
|
|
||||||
CRYPTO_EX_DATA ex_data;
|
|
||||||
/*
|
|
||||||
* If this callback function pointer is set to non-NULL, then it will be
|
|
||||||
* used in DSO_load() in place of meth->dso_name_converter. NB: This
|
|
||||||
* should normally set using DSO_set_name_converter().
|
|
||||||
*/
|
|
||||||
DSO_NAME_CONVERTER_FUNC name_converter;
|
|
||||||
/*
|
|
||||||
* If this callback function pointer is set to non-NULL, then it will be
|
|
||||||
* used in DSO_load() in place of meth->dso_merger. NB: This should
|
|
||||||
* normally set using DSO_set_merger().
|
|
||||||
*/
|
|
||||||
DSO_MERGER_FUNC merger;
|
|
||||||
/*
|
|
||||||
* This is populated with (a copy of) the platform-independant filename
|
|
||||||
* used for this DSO.
|
|
||||||
*/
|
|
||||||
char *filename;
|
|
||||||
/*
|
|
||||||
* This is populated with (a copy of) the translated filename by which
|
|
||||||
* the DSO was actually loaded. It is NULL iff the DSO is not currently
|
|
||||||
* loaded. NB: This is here because the filename translation process may
|
|
||||||
* involve a callback being invoked more than once not only to convert to
|
|
||||||
* a platform-specific form, but also to try different filenames in the
|
|
||||||
* process of trying to perform a load. As such, this variable can be
|
|
||||||
* used to indicate (a) whether this DSO structure corresponds to a
|
|
||||||
* loaded library or not, and (b) the filename with which it was actually
|
|
||||||
* loaded.
|
|
||||||
*/
|
|
||||||
char *loaded_filename;
|
|
||||||
};
|
|
||||||
|
|
||||||
DSO *DSO_new(void);
|
|
||||||
DSO *DSO_new_method(DSO_METHOD *method);
|
|
||||||
int DSO_free(DSO *dso);
|
|
||||||
int DSO_flags(DSO *dso);
|
|
||||||
int DSO_up_ref(DSO *dso);
|
|
||||||
long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function sets the DSO's name_converter callback. If it is non-NULL,
|
|
||||||
* then it will be used instead of the associated DSO_METHOD's function. If
|
|
||||||
* oldcb is non-NULL then it is set to the function pointer value being
|
|
||||||
* replaced. Return value is non-zero for success.
|
|
||||||
*/
|
|
||||||
int DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb,
|
|
||||||
DSO_NAME_CONVERTER_FUNC *oldcb);
|
|
||||||
/*
|
|
||||||
* These functions can be used to get/set the platform-independant filename
|
|
||||||
* used for a DSO. NB: set will fail if the DSO is already loaded.
|
|
||||||
*/
|
|
||||||
const char *DSO_get_filename(DSO *dso);
|
|
||||||
int DSO_set_filename(DSO *dso, const char *filename);
|
|
||||||
/*
|
|
||||||
* This function will invoke the DSO's name_converter callback to translate a
|
|
||||||
* filename, or if the callback isn't set it will instead use the DSO_METHOD's
|
|
||||||
* converter. If "filename" is NULL, the "filename" in the DSO itself will be
|
|
||||||
* used. If the DSO_FLAG_NO_NAME_TRANSLATION flag is set, then the filename is
|
|
||||||
* simply duplicated. NB: This function is usually called from within a
|
|
||||||
* DSO_METHOD during the processing of a DSO_load() call, and is exposed so
|
|
||||||
* that caller-created DSO_METHODs can do the same thing. A non-NULL return
|
|
||||||
* value will need to be OPENSSL_free()'d.
|
|
||||||
*/
|
|
||||||
char *DSO_convert_filename(DSO *dso, const char *filename);
|
|
||||||
/*
|
|
||||||
* This function will invoke the DSO's merger callback to merge two file
|
|
||||||
* specifications, or if the callback isn't set it will instead use the
|
|
||||||
* DSO_METHOD's merger. A non-NULL return value will need to be
|
|
||||||
* OPENSSL_free()'d.
|
|
||||||
*/
|
|
||||||
char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
|
|
||||||
/*
|
|
||||||
* If the DSO is currently loaded, this returns the filename that it was
|
|
||||||
* loaded under, otherwise it returns NULL. So it is also useful as a test as
|
|
||||||
* to whether the DSO is currently loaded. NB: This will not necessarily
|
|
||||||
* return the same value as DSO_convert_filename(dso, dso->filename), because
|
|
||||||
* the DSO_METHOD's load function may have tried a variety of filenames (with
|
|
||||||
* and/or without the aid of the converters) before settling on the one it
|
|
||||||
* actually loaded.
|
|
||||||
*/
|
|
||||||
const char *DSO_get_loaded_filename(DSO *dso);
|
|
||||||
|
|
||||||
void DSO_set_default_method(DSO_METHOD *meth);
|
|
||||||
DSO_METHOD *DSO_get_default_method(void);
|
|
||||||
DSO_METHOD *DSO_get_method(DSO *dso);
|
|
||||||
DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The all-singing all-dancing load function, you normally pass NULL for the
|
|
||||||
* first and third parameters. Use DSO_up and DSO_free for subsequent
|
|
||||||
* reference count handling. Any flags passed in will be set in the
|
|
||||||
* constructed DSO after its init() function but before the load operation.
|
|
||||||
* If 'dso' is non-NULL, 'flags' is ignored.
|
|
||||||
*/
|
|
||||||
DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags);
|
|
||||||
|
|
||||||
/* This function binds to a variable inside a shared library. */
|
|
||||||
void *DSO_bind_var(DSO *dso, const char *symname);
|
|
||||||
|
|
||||||
/* This function binds to a function inside a shared library. */
|
|
||||||
DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This method is the default, but will beg, borrow, or steal whatever method
|
|
||||||
* should be the default on any particular platform (including
|
|
||||||
* DSO_METH_null() if necessary).
|
|
||||||
*/
|
|
||||||
DSO_METHOD *DSO_METHOD_openssl(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This method is defined for all platforms - if a platform has no DSO
|
|
||||||
* support then this will be the only method!
|
|
||||||
*/
|
|
||||||
DSO_METHOD *DSO_METHOD_null(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If DSO_DLFCN is defined, the standard dlfcn.h-style functions (dlopen,
|
|
||||||
* dlclose, dlsym, etc) will be used and incorporated into this method. If
|
|
||||||
* not, this method will return NULL.
|
|
||||||
*/
|
|
||||||
DSO_METHOD *DSO_METHOD_dlfcn(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If DSO_DL is defined, the standard dl.h-style functions (shl_load,
|
|
||||||
* shl_unload, shl_findsym, etc) will be used and incorporated into this
|
|
||||||
* method. If not, this method will return NULL.
|
|
||||||
*/
|
|
||||||
DSO_METHOD *DSO_METHOD_dl(void);
|
|
||||||
|
|
||||||
/* If WIN32 is defined, use DLLs. If not, return NULL. */
|
|
||||||
DSO_METHOD *DSO_METHOD_win32(void);
|
|
||||||
|
|
||||||
/* If VMS is defined, use shared images. If not, return NULL. */
|
|
||||||
DSO_METHOD *DSO_METHOD_vms(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function writes null-terminated pathname of DSO module containing
|
|
||||||
* 'addr' into 'sz' large caller-provided 'path' and returns the number of
|
|
||||||
* characters [including trailing zero] written to it. If 'sz' is 0 or
|
|
||||||
* negative, 'path' is ignored and required amount of charachers [including
|
|
||||||
* trailing zero] to accomodate pathname is returned. If 'addr' is NULL, then
|
|
||||||
* pathname of cryptolib itself is returned. Negative or zero return value
|
|
||||||
* denotes error.
|
|
||||||
*/
|
|
||||||
int DSO_pathbyaddr(void *addr, char *path, int sz);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function should be used with caution! It looks up symbols in *all*
|
|
||||||
* loaded modules and if module gets unloaded by somebody else attempt to
|
|
||||||
* dereference the pointer is doomed to have fatal consequences. Primary
|
|
||||||
* usage for this function is to probe *core* system functionality, e.g.
|
|
||||||
* check if getnameinfo(3) is available at run-time without bothering about
|
|
||||||
* OS-specific details such as libc.so.versioning or where does it actually
|
|
||||||
* reside: in libc itself or libsocket.
|
|
||||||
*/
|
|
||||||
void *DSO_global_lookup(const char *name);
|
|
||||||
|
|
||||||
/* If BeOS is defined, use shared images. If not, return NULL. */
|
|
||||||
DSO_METHOD *DSO_METHOD_beos(void);
|
|
||||||
|
|
||||||
/* 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.
|
|
||||||
*/
|
|
||||||
void ERR_load_DSO_strings(void);
|
|
||||||
|
|
||||||
/* Error codes for the DSO functions. */
|
|
||||||
|
|
||||||
/* Function codes. */
|
|
||||||
# define DSO_F_BEOS_BIND_FUNC 144
|
|
||||||
# define DSO_F_BEOS_BIND_VAR 145
|
|
||||||
# define DSO_F_BEOS_LOAD 146
|
|
||||||
# define DSO_F_BEOS_NAME_CONVERTER 147
|
|
||||||
# define DSO_F_BEOS_UNLOAD 148
|
|
||||||
# define DSO_F_DLFCN_BIND_FUNC 100
|
|
||||||
# define DSO_F_DLFCN_BIND_VAR 101
|
|
||||||
# define DSO_F_DLFCN_LOAD 102
|
|
||||||
# define DSO_F_DLFCN_MERGER 130
|
|
||||||
# define DSO_F_DLFCN_NAME_CONVERTER 123
|
|
||||||
# define DSO_F_DLFCN_UNLOAD 103
|
|
||||||
# define DSO_F_DL_BIND_FUNC 104
|
|
||||||
# define DSO_F_DL_BIND_VAR 105
|
|
||||||
# define DSO_F_DL_LOAD 106
|
|
||||||
# define DSO_F_DL_MERGER 131
|
|
||||||
# define DSO_F_DL_NAME_CONVERTER 124
|
|
||||||
# define DSO_F_DL_UNLOAD 107
|
|
||||||
# define DSO_F_DSO_BIND_FUNC 108
|
|
||||||
# define DSO_F_DSO_BIND_VAR 109
|
|
||||||
# define DSO_F_DSO_CONVERT_FILENAME 126
|
|
||||||
# define DSO_F_DSO_CTRL 110
|
|
||||||
# define DSO_F_DSO_FREE 111
|
|
||||||
# define DSO_F_DSO_GET_FILENAME 127
|
|
||||||
# define DSO_F_DSO_GET_LOADED_FILENAME 128
|
|
||||||
# define DSO_F_DSO_GLOBAL_LOOKUP 139
|
|
||||||
# define DSO_F_DSO_LOAD 112
|
|
||||||
# define DSO_F_DSO_MERGE 132
|
|
||||||
# define DSO_F_DSO_NEW_METHOD 113
|
|
||||||
# define DSO_F_DSO_PATHBYADDR 140
|
|
||||||
# define DSO_F_DSO_SET_FILENAME 129
|
|
||||||
# define DSO_F_DSO_SET_NAME_CONVERTER 122
|
|
||||||
# define DSO_F_DSO_UP_REF 114
|
|
||||||
# define DSO_F_GLOBAL_LOOKUP_FUNC 138
|
|
||||||
# define DSO_F_PATHBYADDR 137
|
|
||||||
# define DSO_F_VMS_BIND_SYM 115
|
|
||||||
# define DSO_F_VMS_LOAD 116
|
|
||||||
# define DSO_F_VMS_MERGER 133
|
|
||||||
# define DSO_F_VMS_UNLOAD 117
|
|
||||||
# define DSO_F_WIN32_BIND_FUNC 118
|
|
||||||
# define DSO_F_WIN32_BIND_VAR 119
|
|
||||||
# define DSO_F_WIN32_GLOBALLOOKUP 142
|
|
||||||
# define DSO_F_WIN32_GLOBALLOOKUP_FUNC 143
|
|
||||||
# define DSO_F_WIN32_JOINER 135
|
|
||||||
# define DSO_F_WIN32_LOAD 120
|
|
||||||
# define DSO_F_WIN32_MERGER 134
|
|
||||||
# define DSO_F_WIN32_NAME_CONVERTER 125
|
|
||||||
# define DSO_F_WIN32_PATHBYADDR 141
|
|
||||||
# define DSO_F_WIN32_SPLITTER 136
|
|
||||||
# define DSO_F_WIN32_UNLOAD 121
|
|
||||||
|
|
||||||
/* Reason codes. */
|
|
||||||
# define DSO_R_CTRL_FAILED 100
|
|
||||||
# define DSO_R_DSO_ALREADY_LOADED 110
|
|
||||||
# define DSO_R_EMPTY_FILE_STRUCTURE 113
|
|
||||||
# define DSO_R_FAILURE 114
|
|
||||||
# define DSO_R_FILENAME_TOO_BIG 101
|
|
||||||
# define DSO_R_FINISH_FAILED 102
|
|
||||||
# define DSO_R_INCORRECT_FILE_SYNTAX 115
|
|
||||||
# define DSO_R_LOAD_FAILED 103
|
|
||||||
# define DSO_R_NAME_TRANSLATION_FAILED 109
|
|
||||||
# define DSO_R_NO_FILENAME 111
|
|
||||||
# define DSO_R_NO_FILE_SPECIFICATION 116
|
|
||||||
# define DSO_R_NULL_HANDLE 104
|
|
||||||
# define DSO_R_SET_FILENAME_FAILED 112
|
|
||||||
# define DSO_R_STACK_ERROR 105
|
|
||||||
# define DSO_R_SYM_FAILURE 106
|
|
||||||
# define DSO_R_UNLOAD_FAILED 107
|
|
||||||
# define DSO_R_UNSUPPORTED 108
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
File diff suppressed because it is too large
Load Diff
@ -1,134 +1,10 @@
|
|||||||
/* crypto/ecdh/ecdh.h */
|
|
||||||
/* ====================================================================
|
|
||||||
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
|
|
||||||
*
|
|
||||||
* The Elliptic Curve Public-Key Crypto Library (ECC Code) included
|
|
||||||
* herein is developed by SUN MICROSYSTEMS, INC., and is contributed
|
|
||||||
* to the OpenSSL project.
|
|
||||||
*
|
|
||||||
* The ECC Code is licensed pursuant to the OpenSSL open source
|
|
||||||
* license provided below.
|
|
||||||
*
|
|
||||||
* The ECDH software is originally written by Douglas Stebila of
|
|
||||||
* Sun Microsystems Laboratories.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/* ====================================================================
|
|
||||||
* Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
*
|
|
||||||
* 3. All advertising materials mentioning features or use of this
|
|
||||||
* software must display the following acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
|
||||||
*
|
|
||||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* prior written permission. For written permission, please contact
|
|
||||||
* licensing@OpenSSL.org.
|
|
||||||
*
|
|
||||||
* 5. Products derived from this software may not be called "OpenSSL"
|
|
||||||
* nor may "OpenSSL" appear in their names without prior written
|
|
||||||
* permission of the OpenSSL Project.
|
|
||||||
*
|
|
||||||
* 6. Redistributions of any form whatsoever must retain the following
|
|
||||||
* acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
|
||||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
|
||||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
||||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
||||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
* ====================================================================
|
|
||||||
*
|
|
||||||
* This product includes cryptographic software written by Eric Young
|
|
||||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
|
||||||
* Hudson (tjh@cryptsoft.com).
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef HEADER_ECDH_H
|
|
||||||
# define HEADER_ECDH_H
|
|
||||||
|
|
||||||
# include <openssl/opensslconf.h>
|
|
||||||
|
|
||||||
# ifdef OPENSSL_NO_ECDH
|
|
||||||
# error ECDH is disabled.
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# include <openssl/ec.h>
|
|
||||||
# include <openssl/ossl_typ.h>
|
|
||||||
# ifndef OPENSSL_NO_DEPRECATED
|
|
||||||
# include <openssl/bn.h>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# define EC_FLAG_COFACTOR_ECDH 0x1000
|
|
||||||
|
|
||||||
const ECDH_METHOD *ECDH_OpenSSL(void);
|
|
||||||
|
|
||||||
void ECDH_set_default_method(const ECDH_METHOD *);
|
|
||||||
const ECDH_METHOD *ECDH_get_default_method(void);
|
|
||||||
int ECDH_set_method(EC_KEY *, const ECDH_METHOD *);
|
|
||||||
|
|
||||||
int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
|
|
||||||
EC_KEY *ecdh, void *(*KDF) (const void *in, size_t inlen,
|
|
||||||
void *out, size_t *outlen));
|
|
||||||
|
|
||||||
int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
|
|
||||||
*new_func, CRYPTO_EX_dup *dup_func,
|
|
||||||
CRYPTO_EX_free *free_func);
|
|
||||||
int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg);
|
|
||||||
void *ECDH_get_ex_data(EC_KEY *d, int idx);
|
|
||||||
|
|
||||||
int ECDH_KDF_X9_62(unsigned char *out, size_t outlen,
|
|
||||||
const unsigned char *Z, size_t Zlen,
|
|
||||||
const unsigned char *sinfo, size_t sinfolen,
|
|
||||||
const EVP_MD *md);
|
|
||||||
|
|
||||||
/* BEGIN ERROR CODES */
|
|
||||||
/*
|
/*
|
||||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
* made after this point may be overwritten when the script is next run.
|
*
|
||||||
|
* 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
|
||||||
*/
|
*/
|
||||||
void ERR_load_ECDH_strings(void);
|
|
||||||
|
|
||||||
/* Error codes for the ECDH functions. */
|
|
||||||
|
|
||||||
/* Function codes. */
|
|
||||||
# define ECDH_F_ECDH_CHECK 102
|
|
||||||
# define ECDH_F_ECDH_COMPUTE_KEY 100
|
|
||||||
# define ECDH_F_ECDH_DATA_NEW_METHOD 101
|
|
||||||
|
|
||||||
/* Reason codes. */
|
|
||||||
# define ECDH_R_KDF_FAILED 102
|
|
||||||
# define ECDH_R_NON_FIPS_METHOD 103
|
|
||||||
# define ECDH_R_NO_PRIVATE_VALUE 100
|
|
||||||
# define ECDH_R_POINT_ARITHMETIC_FAILURE 101
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#include <openssl/ec.h>
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
@ -1,335 +1,10 @@
|
|||||||
/* crypto/ecdsa/ecdsa.h */
|
|
||||||
/**
|
|
||||||
* \file crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions
|
|
||||||
* \author Written by Nils Larsch for the OpenSSL project
|
|
||||||
*/
|
|
||||||
/* ====================================================================
|
|
||||||
* Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
*
|
|
||||||
* 3. All advertising materials mentioning features or use of this
|
|
||||||
* software must display the following acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
|
||||||
*
|
|
||||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* prior written permission. For written permission, please contact
|
|
||||||
* licensing@OpenSSL.org.
|
|
||||||
*
|
|
||||||
* 5. Products derived from this software may not be called "OpenSSL"
|
|
||||||
* nor may "OpenSSL" appear in their names without prior written
|
|
||||||
* permission of the OpenSSL Project.
|
|
||||||
*
|
|
||||||
* 6. Redistributions of any form whatsoever must retain the following
|
|
||||||
* acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
|
||||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
|
||||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
||||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
||||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
* ====================================================================
|
|
||||||
*
|
|
||||||
* This product includes cryptographic software written by Eric Young
|
|
||||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
|
||||||
* Hudson (tjh@cryptsoft.com).
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef HEADER_ECDSA_H
|
|
||||||
# define HEADER_ECDSA_H
|
|
||||||
|
|
||||||
# include <openssl/opensslconf.h>
|
|
||||||
|
|
||||||
# ifdef OPENSSL_NO_ECDSA
|
|
||||||
# error ECDSA is disabled.
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# include <openssl/ec.h>
|
|
||||||
# include <openssl/ossl_typ.h>
|
|
||||||
# ifndef OPENSSL_NO_DEPRECATED
|
|
||||||
# include <openssl/bn.h>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct ECDSA_SIG_st {
|
|
||||||
BIGNUM *r;
|
|
||||||
BIGNUM *s;
|
|
||||||
} ECDSA_SIG;
|
|
||||||
|
|
||||||
/** Allocates and initialize a ECDSA_SIG structure
|
|
||||||
* \return pointer to a ECDSA_SIG structure or NULL if an error occurred
|
|
||||||
*/
|
|
||||||
ECDSA_SIG *ECDSA_SIG_new(void);
|
|
||||||
|
|
||||||
/** frees a ECDSA_SIG structure
|
|
||||||
* \param sig pointer to the ECDSA_SIG structure
|
|
||||||
*/
|
|
||||||
void ECDSA_SIG_free(ECDSA_SIG *sig);
|
|
||||||
|
|
||||||
/** DER encode content of ECDSA_SIG object (note: this function modifies *pp
|
|
||||||
* (*pp += length of the DER encoded signature)).
|
|
||||||
* \param sig pointer to the ECDSA_SIG object
|
|
||||||
* \param pp pointer to a unsigned char pointer for the output or NULL
|
|
||||||
* \return the length of the DER encoded ECDSA_SIG object or 0
|
|
||||||
*/
|
|
||||||
int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp);
|
|
||||||
|
|
||||||
/** Decodes a DER encoded ECDSA signature (note: this function changes *pp
|
|
||||||
* (*pp += len)).
|
|
||||||
* \param sig pointer to ECDSA_SIG pointer (may be NULL)
|
|
||||||
* \param pp memory buffer with the DER encoded signature
|
|
||||||
* \param len length of the buffer
|
|
||||||
* \return pointer to the decoded ECDSA_SIG structure (or NULL)
|
|
||||||
*/
|
|
||||||
ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len);
|
|
||||||
|
|
||||||
/** Computes the ECDSA signature of the given hash value using
|
|
||||||
* the supplied private key and returns the created signature.
|
|
||||||
* \param dgst pointer to the hash value
|
|
||||||
* \param dgst_len length of the hash value
|
|
||||||
* \param eckey EC_KEY object containing a private EC key
|
|
||||||
* \return pointer to a ECDSA_SIG structure or NULL if an error occurred
|
|
||||||
*/
|
|
||||||
ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dgst_len,
|
|
||||||
EC_KEY *eckey);
|
|
||||||
|
|
||||||
/** Computes ECDSA signature of a given hash value using the supplied
|
|
||||||
* private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
|
|
||||||
* \param dgst pointer to the hash value to sign
|
|
||||||
* \param dgstlen length of the hash value
|
|
||||||
* \param kinv BIGNUM with a pre-computed inverse k (optional)
|
|
||||||
* \param rp BIGNUM with a pre-computed rp value (optioanl),
|
|
||||||
* see ECDSA_sign_setup
|
|
||||||
* \param eckey EC_KEY object containing a private EC key
|
|
||||||
* \return pointer to a ECDSA_SIG structure or NULL if an error occurred
|
|
||||||
*/
|
|
||||||
ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen,
|
|
||||||
const BIGNUM *kinv, const BIGNUM *rp,
|
|
||||||
EC_KEY *eckey);
|
|
||||||
|
|
||||||
/** Verifies that the supplied signature is a valid ECDSA
|
|
||||||
* signature of the supplied hash value using the supplied public key.
|
|
||||||
* \param dgst pointer to the hash value
|
|
||||||
* \param dgst_len length of the hash value
|
|
||||||
* \param sig ECDSA_SIG structure
|
|
||||||
* \param eckey EC_KEY object containing a public EC key
|
|
||||||
* \return 1 if the signature is valid, 0 if the signature is invalid
|
|
||||||
* and -1 on error
|
|
||||||
*/
|
|
||||||
int ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
|
|
||||||
const ECDSA_SIG *sig, EC_KEY *eckey);
|
|
||||||
|
|
||||||
const ECDSA_METHOD *ECDSA_OpenSSL(void);
|
|
||||||
|
|
||||||
/** Sets the default ECDSA method
|
|
||||||
* \param meth new default ECDSA_METHOD
|
|
||||||
*/
|
|
||||||
void ECDSA_set_default_method(const ECDSA_METHOD *meth);
|
|
||||||
|
|
||||||
/** Returns the default ECDSA method
|
|
||||||
* \return pointer to ECDSA_METHOD structure containing the default method
|
|
||||||
*/
|
|
||||||
const ECDSA_METHOD *ECDSA_get_default_method(void);
|
|
||||||
|
|
||||||
/** Sets method to be used for the ECDSA operations
|
|
||||||
* \param eckey EC_KEY object
|
|
||||||
* \param meth new method
|
|
||||||
* \return 1 on success and 0 otherwise
|
|
||||||
*/
|
|
||||||
int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth);
|
|
||||||
|
|
||||||
/** Returns the maximum length of the DER encoded signature
|
|
||||||
* \param eckey EC_KEY object
|
|
||||||
* \return numbers of bytes required for the DER encoded signature
|
|
||||||
*/
|
|
||||||
int ECDSA_size(const EC_KEY *eckey);
|
|
||||||
|
|
||||||
/** Precompute parts of the signing operation
|
|
||||||
* \param eckey EC_KEY object containing a private EC key
|
|
||||||
* \param ctx BN_CTX object (optional)
|
|
||||||
* \param kinv BIGNUM pointer for the inverse of k
|
|
||||||
* \param rp BIGNUM pointer for x coordinate of k * generator
|
|
||||||
* \return 1 on success and 0 otherwise
|
|
||||||
*/
|
|
||||||
int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **rp);
|
|
||||||
|
|
||||||
/** Computes ECDSA signature of a given hash value using the supplied
|
|
||||||
* private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
|
|
||||||
* \param type this parameter is ignored
|
|
||||||
* \param dgst pointer to the hash value to sign
|
|
||||||
* \param dgstlen length of the hash value
|
|
||||||
* \param sig memory for the DER encoded created signature
|
|
||||||
* \param siglen pointer to the length of the returned signature
|
|
||||||
* \param eckey EC_KEY object containing a private EC key
|
|
||||||
* \return 1 on success and 0 otherwise
|
|
||||||
*/
|
|
||||||
int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen,
|
|
||||||
unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
|
|
||||||
|
|
||||||
/** Computes ECDSA signature of a given hash value using the supplied
|
|
||||||
* private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
|
|
||||||
* \param type this parameter is ignored
|
|
||||||
* \param dgst pointer to the hash value to sign
|
|
||||||
* \param dgstlen length of the hash value
|
|
||||||
* \param sig buffer to hold the DER encoded signature
|
|
||||||
* \param siglen pointer to the length of the returned signature
|
|
||||||
* \param kinv BIGNUM with a pre-computed inverse k (optional)
|
|
||||||
* \param rp BIGNUM with a pre-computed rp value (optioanl),
|
|
||||||
* see ECDSA_sign_setup
|
|
||||||
* \param eckey EC_KEY object containing a private EC key
|
|
||||||
* \return 1 on success and 0 otherwise
|
|
||||||
*/
|
|
||||||
int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen,
|
|
||||||
unsigned char *sig, unsigned int *siglen,
|
|
||||||
const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);
|
|
||||||
|
|
||||||
/** Verifies that the given signature is valid ECDSA signature
|
|
||||||
* of the supplied hash value using the specified public key.
|
|
||||||
* \param type this parameter is ignored
|
|
||||||
* \param dgst pointer to the hash value
|
|
||||||
* \param dgstlen length of the hash value
|
|
||||||
* \param sig pointer to the DER encoded signature
|
|
||||||
* \param siglen length of the DER encoded signature
|
|
||||||
* \param eckey EC_KEY object containing a public EC key
|
|
||||||
* \return 1 if the signature is valid, 0 if the signature is invalid
|
|
||||||
* and -1 on error
|
|
||||||
*/
|
|
||||||
int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen,
|
|
||||||
const unsigned char *sig, int siglen, EC_KEY *eckey);
|
|
||||||
|
|
||||||
/* the standard ex_data functions */
|
|
||||||
int ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
|
|
||||||
*new_func, CRYPTO_EX_dup *dup_func,
|
|
||||||
CRYPTO_EX_free *free_func);
|
|
||||||
int ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg);
|
|
||||||
void *ECDSA_get_ex_data(EC_KEY *d, int idx);
|
|
||||||
|
|
||||||
/** Allocates and initialize a ECDSA_METHOD structure
|
|
||||||
* \param ecdsa_method pointer to ECDSA_METHOD to copy. (May be NULL)
|
|
||||||
* \return pointer to a ECDSA_METHOD structure or NULL if an error occurred
|
|
||||||
*/
|
|
||||||
|
|
||||||
ECDSA_METHOD *ECDSA_METHOD_new(const ECDSA_METHOD *ecdsa_method);
|
|
||||||
|
|
||||||
/** frees a ECDSA_METHOD structure
|
|
||||||
* \param ecdsa_method pointer to the ECDSA_METHOD structure
|
|
||||||
*/
|
|
||||||
void ECDSA_METHOD_free(ECDSA_METHOD *ecdsa_method);
|
|
||||||
|
|
||||||
/** Sets application specific data in the ECDSA_METHOD
|
|
||||||
* \param ecdsa_method pointer to existing ECDSA_METHOD
|
|
||||||
* \param app application specific data to set
|
|
||||||
*/
|
|
||||||
|
|
||||||
void ECDSA_METHOD_set_app_data(ECDSA_METHOD *ecdsa_method, void *app);
|
|
||||||
|
|
||||||
/** Returns application specific data from a ECDSA_METHOD structure
|
|
||||||
* \param ecdsa_method pointer to ECDSA_METHOD structure
|
|
||||||
* \return pointer to application specific data.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *ECDSA_METHOD_get_app_data(ECDSA_METHOD *ecdsa_method);
|
|
||||||
|
|
||||||
/** Set the ECDSA_do_sign function in the ECDSA_METHOD
|
|
||||||
* \param ecdsa_method pointer to existing ECDSA_METHOD
|
|
||||||
* \param ecdsa_do_sign a funtion of type ECDSA_do_sign
|
|
||||||
*/
|
|
||||||
|
|
||||||
void ECDSA_METHOD_set_sign(ECDSA_METHOD *ecdsa_method,
|
|
||||||
ECDSA_SIG *(*ecdsa_do_sign) (const unsigned char
|
|
||||||
*dgst, int dgst_len,
|
|
||||||
const BIGNUM *inv,
|
|
||||||
const BIGNUM *rp,
|
|
||||||
EC_KEY *eckey));
|
|
||||||
|
|
||||||
/** Set the ECDSA_sign_setup function in the ECDSA_METHOD
|
|
||||||
* \param ecdsa_method pointer to existing ECDSA_METHOD
|
|
||||||
* \param ecdsa_sign_setup a funtion of type ECDSA_sign_setup
|
|
||||||
*/
|
|
||||||
|
|
||||||
void ECDSA_METHOD_set_sign_setup(ECDSA_METHOD *ecdsa_method,
|
|
||||||
int (*ecdsa_sign_setup) (EC_KEY *eckey,
|
|
||||||
BN_CTX *ctx,
|
|
||||||
BIGNUM **kinv,
|
|
||||||
BIGNUM **r));
|
|
||||||
|
|
||||||
/** Set the ECDSA_do_verify function in the ECDSA_METHOD
|
|
||||||
* \param ecdsa_method pointer to existing ECDSA_METHOD
|
|
||||||
* \param ecdsa_do_verify a funtion of type ECDSA_do_verify
|
|
||||||
*/
|
|
||||||
|
|
||||||
void ECDSA_METHOD_set_verify(ECDSA_METHOD *ecdsa_method,
|
|
||||||
int (*ecdsa_do_verify) (const unsigned char
|
|
||||||
*dgst, int dgst_len,
|
|
||||||
const ECDSA_SIG *sig,
|
|
||||||
EC_KEY *eckey));
|
|
||||||
|
|
||||||
void ECDSA_METHOD_set_flags(ECDSA_METHOD *ecdsa_method, int flags);
|
|
||||||
|
|
||||||
/** Set the flags field in the ECDSA_METHOD
|
|
||||||
* \param ecdsa_method pointer to existing ECDSA_METHOD
|
|
||||||
* \param flags flags value to set
|
|
||||||
*/
|
|
||||||
|
|
||||||
void ECDSA_METHOD_set_name(ECDSA_METHOD *ecdsa_method, char *name);
|
|
||||||
|
|
||||||
/** Set the name field in the ECDSA_METHOD
|
|
||||||
* \param ecdsa_method pointer to existing ECDSA_METHOD
|
|
||||||
* \param name name to set
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* BEGIN ERROR CODES */
|
|
||||||
/*
|
/*
|
||||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
* made after this point may be overwritten when the script is next run.
|
*
|
||||||
|
* 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
|
||||||
*/
|
*/
|
||||||
void ERR_load_ECDSA_strings(void);
|
|
||||||
|
|
||||||
/* Error codes for the ECDSA functions. */
|
|
||||||
|
|
||||||
/* Function codes. */
|
|
||||||
# define ECDSA_F_ECDSA_CHECK 104
|
|
||||||
# define ECDSA_F_ECDSA_DATA_NEW_METHOD 100
|
|
||||||
# define ECDSA_F_ECDSA_DO_SIGN 101
|
|
||||||
# define ECDSA_F_ECDSA_DO_VERIFY 102
|
|
||||||
# define ECDSA_F_ECDSA_METHOD_NEW 105
|
|
||||||
# define ECDSA_F_ECDSA_SIGN_SETUP 103
|
|
||||||
|
|
||||||
/* Reason codes. */
|
|
||||||
# define ECDSA_R_BAD_SIGNATURE 100
|
|
||||||
# define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 101
|
|
||||||
# define ECDSA_R_ERR_EC_LIB 102
|
|
||||||
# define ECDSA_R_MISSING_PARAMETERS 103
|
|
||||||
# define ECDSA_R_NEED_NEW_SETUP_VALUES 106
|
|
||||||
# define ECDSA_R_NON_FIPS_METHOD 107
|
|
||||||
# define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED 104
|
|
||||||
# define ECDSA_R_SIGNATURE_MALLOC_FAILED 105
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#include <openssl/ec.h>
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
@ -0,0 +1,276 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2020 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_ECERR_H
|
||||||
|
# define HEADER_ECERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_EC
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_EC_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* EC function codes.
|
||||||
|
*/
|
||||||
|
# define EC_F_BN_TO_FELEM 224
|
||||||
|
# define EC_F_D2I_ECPARAMETERS 144
|
||||||
|
# define EC_F_D2I_ECPKPARAMETERS 145
|
||||||
|
# define EC_F_D2I_ECPRIVATEKEY 146
|
||||||
|
# define EC_F_DO_EC_KEY_PRINT 221
|
||||||
|
# define EC_F_ECDH_CMS_DECRYPT 238
|
||||||
|
# define EC_F_ECDH_CMS_SET_SHARED_INFO 239
|
||||||
|
# define EC_F_ECDH_COMPUTE_KEY 246
|
||||||
|
# define EC_F_ECDH_SIMPLE_COMPUTE_KEY 257
|
||||||
|
# define EC_F_ECDSA_DO_SIGN_EX 251
|
||||||
|
# define EC_F_ECDSA_DO_VERIFY 252
|
||||||
|
# define EC_F_ECDSA_SIGN_EX 254
|
||||||
|
# define EC_F_ECDSA_SIGN_SETUP 248
|
||||||
|
# define EC_F_ECDSA_SIG_NEW 265
|
||||||
|
# define EC_F_ECDSA_VERIFY 253
|
||||||
|
# define EC_F_ECD_ITEM_VERIFY 270
|
||||||
|
# define EC_F_ECKEY_PARAM2TYPE 223
|
||||||
|
# define EC_F_ECKEY_PARAM_DECODE 212
|
||||||
|
# define EC_F_ECKEY_PRIV_DECODE 213
|
||||||
|
# define EC_F_ECKEY_PRIV_ENCODE 214
|
||||||
|
# define EC_F_ECKEY_PUB_DECODE 215
|
||||||
|
# define EC_F_ECKEY_PUB_ENCODE 216
|
||||||
|
# define EC_F_ECKEY_TYPE2PARAM 220
|
||||||
|
# define EC_F_ECPARAMETERS_PRINT 147
|
||||||
|
# define EC_F_ECPARAMETERS_PRINT_FP 148
|
||||||
|
# define EC_F_ECPKPARAMETERS_PRINT 149
|
||||||
|
# define EC_F_ECPKPARAMETERS_PRINT_FP 150
|
||||||
|
# define EC_F_ECP_NISTZ256_GET_AFFINE 240
|
||||||
|
# define EC_F_ECP_NISTZ256_INV_MOD_ORD 275
|
||||||
|
# define EC_F_ECP_NISTZ256_MULT_PRECOMPUTE 243
|
||||||
|
# define EC_F_ECP_NISTZ256_POINTS_MUL 241
|
||||||
|
# define EC_F_ECP_NISTZ256_PRE_COMP_NEW 244
|
||||||
|
# define EC_F_ECP_NISTZ256_WINDOWED_MUL 242
|
||||||
|
# define EC_F_ECX_KEY_OP 266
|
||||||
|
# define EC_F_ECX_PRIV_ENCODE 267
|
||||||
|
# define EC_F_ECX_PUB_ENCODE 268
|
||||||
|
# define EC_F_EC_ASN1_GROUP2CURVE 153
|
||||||
|
# define EC_F_EC_ASN1_GROUP2FIELDID 154
|
||||||
|
# define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY 208
|
||||||
|
# define EC_F_EC_GF2M_SIMPLE_FIELD_INV 296
|
||||||
|
# define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 159
|
||||||
|
# define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE 195
|
||||||
|
# define EC_F_EC_GF2M_SIMPLE_LADDER_POST 285
|
||||||
|
# define EC_F_EC_GF2M_SIMPLE_LADDER_PRE 288
|
||||||
|
# define EC_F_EC_GF2M_SIMPLE_OCT2POINT 160
|
||||||
|
# define EC_F_EC_GF2M_SIMPLE_POINT2OCT 161
|
||||||
|
# define EC_F_EC_GF2M_SIMPLE_POINTS_MUL 289
|
||||||
|
# define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162
|
||||||
|
# define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163
|
||||||
|
# define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 164
|
||||||
|
# define EC_F_EC_GFP_MONT_FIELD_DECODE 133
|
||||||
|
# define EC_F_EC_GFP_MONT_FIELD_ENCODE 134
|
||||||
|
# define EC_F_EC_GFP_MONT_FIELD_INV 297
|
||||||
|
# define EC_F_EC_GFP_MONT_FIELD_MUL 131
|
||||||
|
# define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE 209
|
||||||
|
# define EC_F_EC_GFP_MONT_FIELD_SQR 132
|
||||||
|
# define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189
|
||||||
|
# define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE 225
|
||||||
|
# define EC_F_EC_GFP_NISTP224_POINTS_MUL 228
|
||||||
|
# define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226
|
||||||
|
# define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE 230
|
||||||
|
# define EC_F_EC_GFP_NISTP256_POINTS_MUL 231
|
||||||
|
# define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 232
|
||||||
|
# define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE 233
|
||||||
|
# define EC_F_EC_GFP_NISTP521_POINTS_MUL 234
|
||||||
|
# define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 235
|
||||||
|
# define EC_F_EC_GFP_NIST_FIELD_MUL 200
|
||||||
|
# define EC_F_EC_GFP_NIST_FIELD_SQR 201
|
||||||
|
# define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202
|
||||||
|
# define EC_F_EC_GFP_SIMPLE_BLIND_COORDINATES 287
|
||||||
|
# define EC_F_EC_GFP_SIMPLE_FIELD_INV 298
|
||||||
|
# define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 165
|
||||||
|
# define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 166
|
||||||
|
# define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE 102
|
||||||
|
# define EC_F_EC_GFP_SIMPLE_OCT2POINT 103
|
||||||
|
# define EC_F_EC_GFP_SIMPLE_POINT2OCT 104
|
||||||
|
# define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE 137
|
||||||
|
# define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 167
|
||||||
|
# define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 168
|
||||||
|
# define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 169
|
||||||
|
# define EC_F_EC_GROUP_CHECK 170
|
||||||
|
# define EC_F_EC_GROUP_CHECK_DISCRIMINANT 171
|
||||||
|
# define EC_F_EC_GROUP_COPY 106
|
||||||
|
# define EC_F_EC_GROUP_GET_CURVE 291
|
||||||
|
# define EC_F_EC_GROUP_GET_CURVE_GF2M 172
|
||||||
|
# define EC_F_EC_GROUP_GET_CURVE_GFP 130
|
||||||
|
# define EC_F_EC_GROUP_GET_DEGREE 173
|
||||||
|
# define EC_F_EC_GROUP_GET_ECPARAMETERS 261
|
||||||
|
# define EC_F_EC_GROUP_GET_ECPKPARAMETERS 262
|
||||||
|
# define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 193
|
||||||
|
# define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194
|
||||||
|
# define EC_F_EC_GROUP_NEW 108
|
||||||
|
# define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 174
|
||||||
|
# define EC_F_EC_GROUP_NEW_FROM_DATA 175
|
||||||
|
# define EC_F_EC_GROUP_NEW_FROM_ECPARAMETERS 263
|
||||||
|
# define EC_F_EC_GROUP_NEW_FROM_ECPKPARAMETERS 264
|
||||||
|
# define EC_F_EC_GROUP_SET_CURVE 292
|
||||||
|
# define EC_F_EC_GROUP_SET_CURVE_GF2M 176
|
||||||
|
# define EC_F_EC_GROUP_SET_CURVE_GFP 109
|
||||||
|
# define EC_F_EC_GROUP_SET_GENERATOR 111
|
||||||
|
# define EC_F_EC_GROUP_SET_SEED 286
|
||||||
|
# define EC_F_EC_KEY_CHECK_KEY 177
|
||||||
|
# define EC_F_EC_KEY_COPY 178
|
||||||
|
# define EC_F_EC_KEY_GENERATE_KEY 179
|
||||||
|
# define EC_F_EC_KEY_NEW 182
|
||||||
|
# define EC_F_EC_KEY_NEW_METHOD 245
|
||||||
|
# define EC_F_EC_KEY_OCT2PRIV 255
|
||||||
|
# define EC_F_EC_KEY_PRINT 180
|
||||||
|
# define EC_F_EC_KEY_PRINT_FP 181
|
||||||
|
# define EC_F_EC_KEY_PRIV2BUF 279
|
||||||
|
# define EC_F_EC_KEY_PRIV2OCT 256
|
||||||
|
# define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES 229
|
||||||
|
# define EC_F_EC_KEY_SIMPLE_CHECK_KEY 258
|
||||||
|
# define EC_F_EC_KEY_SIMPLE_OCT2PRIV 259
|
||||||
|
# define EC_F_EC_KEY_SIMPLE_PRIV2OCT 260
|
||||||
|
# define EC_F_EC_PKEY_CHECK 273
|
||||||
|
# define EC_F_EC_PKEY_PARAM_CHECK 274
|
||||||
|
# define EC_F_EC_POINTS_MAKE_AFFINE 136
|
||||||
|
# define EC_F_EC_POINTS_MUL 290
|
||||||
|
# define EC_F_EC_POINT_ADD 112
|
||||||
|
# define EC_F_EC_POINT_BN2POINT 280
|
||||||
|
# define EC_F_EC_POINT_CMP 113
|
||||||
|
# define EC_F_EC_POINT_COPY 114
|
||||||
|
# define EC_F_EC_POINT_DBL 115
|
||||||
|
# define EC_F_EC_POINT_GET_AFFINE_COORDINATES 293
|
||||||
|
# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 183
|
||||||
|
# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 116
|
||||||
|
# define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 117
|
||||||
|
# define EC_F_EC_POINT_INVERT 210
|
||||||
|
# define EC_F_EC_POINT_IS_AT_INFINITY 118
|
||||||
|
# define EC_F_EC_POINT_IS_ON_CURVE 119
|
||||||
|
# define EC_F_EC_POINT_MAKE_AFFINE 120
|
||||||
|
# define EC_F_EC_POINT_NEW 121
|
||||||
|
# define EC_F_EC_POINT_OCT2POINT 122
|
||||||
|
# define EC_F_EC_POINT_POINT2BUF 281
|
||||||
|
# define EC_F_EC_POINT_POINT2OCT 123
|
||||||
|
# define EC_F_EC_POINT_SET_AFFINE_COORDINATES 294
|
||||||
|
# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 185
|
||||||
|
# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 124
|
||||||
|
# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES 295
|
||||||
|
# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 186
|
||||||
|
# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 125
|
||||||
|
# define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 126
|
||||||
|
# define EC_F_EC_POINT_SET_TO_INFINITY 127
|
||||||
|
# define EC_F_EC_PRE_COMP_NEW 196
|
||||||
|
# define EC_F_EC_SCALAR_MUL_LADDER 284
|
||||||
|
# define EC_F_EC_WNAF_MUL 187
|
||||||
|
# define EC_F_EC_WNAF_PRECOMPUTE_MULT 188
|
||||||
|
# define EC_F_I2D_ECPARAMETERS 190
|
||||||
|
# define EC_F_I2D_ECPKPARAMETERS 191
|
||||||
|
# define EC_F_I2D_ECPRIVATEKEY 192
|
||||||
|
# define EC_F_I2O_ECPUBLICKEY 151
|
||||||
|
# define EC_F_NISTP224_PRE_COMP_NEW 227
|
||||||
|
# define EC_F_NISTP256_PRE_COMP_NEW 236
|
||||||
|
# define EC_F_NISTP521_PRE_COMP_NEW 237
|
||||||
|
# define EC_F_O2I_ECPUBLICKEY 152
|
||||||
|
# define EC_F_OLD_EC_PRIV_DECODE 222
|
||||||
|
# define EC_F_OSSL_ECDH_COMPUTE_KEY 247
|
||||||
|
# define EC_F_OSSL_ECDSA_SIGN_SIG 249
|
||||||
|
# define EC_F_OSSL_ECDSA_VERIFY_SIG 250
|
||||||
|
# define EC_F_PKEY_ECD_CTRL 271
|
||||||
|
# define EC_F_PKEY_ECD_DIGESTSIGN 272
|
||||||
|
# define EC_F_PKEY_ECD_DIGESTSIGN25519 276
|
||||||
|
# define EC_F_PKEY_ECD_DIGESTSIGN448 277
|
||||||
|
# define EC_F_PKEY_ECX_DERIVE 269
|
||||||
|
# define EC_F_PKEY_EC_CTRL 197
|
||||||
|
# define EC_F_PKEY_EC_CTRL_STR 198
|
||||||
|
# define EC_F_PKEY_EC_DERIVE 217
|
||||||
|
# define EC_F_PKEY_EC_INIT 282
|
||||||
|
# define EC_F_PKEY_EC_KDF_DERIVE 283
|
||||||
|
# define EC_F_PKEY_EC_KEYGEN 199
|
||||||
|
# define EC_F_PKEY_EC_PARAMGEN 219
|
||||||
|
# define EC_F_PKEY_EC_SIGN 218
|
||||||
|
# define EC_F_VALIDATE_ECX_DERIVE 278
|
||||||
|
|
||||||
|
/*
|
||||||
|
* EC reason codes.
|
||||||
|
*/
|
||||||
|
# define EC_R_ASN1_ERROR 115
|
||||||
|
# define EC_R_BAD_SIGNATURE 156
|
||||||
|
# define EC_R_BIGNUM_OUT_OF_RANGE 144
|
||||||
|
# define EC_R_BUFFER_TOO_SMALL 100
|
||||||
|
# define EC_R_CANNOT_INVERT 165
|
||||||
|
# define EC_R_COORDINATES_OUT_OF_RANGE 146
|
||||||
|
# define EC_R_CURVE_DOES_NOT_SUPPORT_ECDH 160
|
||||||
|
# define EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING 159
|
||||||
|
# define EC_R_D2I_ECPKPARAMETERS_FAILURE 117
|
||||||
|
# define EC_R_DECODE_ERROR 142
|
||||||
|
# define EC_R_DISCRIMINANT_IS_ZERO 118
|
||||||
|
# define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119
|
||||||
|
# define EC_R_FIELD_TOO_LARGE 143
|
||||||
|
# define EC_R_GF2M_NOT_SUPPORTED 147
|
||||||
|
# define EC_R_GROUP2PKPARAMETERS_FAILURE 120
|
||||||
|
# define EC_R_I2D_ECPKPARAMETERS_FAILURE 121
|
||||||
|
# define EC_R_INCOMPATIBLE_OBJECTS 101
|
||||||
|
# define EC_R_INVALID_ARGUMENT 112
|
||||||
|
# define EC_R_INVALID_COMPRESSED_POINT 110
|
||||||
|
# define EC_R_INVALID_COMPRESSION_BIT 109
|
||||||
|
# define EC_R_INVALID_CURVE 141
|
||||||
|
# define EC_R_INVALID_DIGEST 151
|
||||||
|
# define EC_R_INVALID_DIGEST_TYPE 138
|
||||||
|
# define EC_R_INVALID_ENCODING 102
|
||||||
|
# define EC_R_INVALID_FIELD 103
|
||||||
|
# define EC_R_INVALID_FORM 104
|
||||||
|
# define EC_R_INVALID_GROUP_ORDER 122
|
||||||
|
# define EC_R_INVALID_KEY 116
|
||||||
|
# define EC_R_INVALID_OUTPUT_LENGTH 161
|
||||||
|
# define EC_R_INVALID_PEER_KEY 133
|
||||||
|
# define EC_R_INVALID_PENTANOMIAL_BASIS 132
|
||||||
|
# define EC_R_INVALID_PRIVATE_KEY 123
|
||||||
|
# define EC_R_INVALID_TRINOMIAL_BASIS 137
|
||||||
|
# define EC_R_KDF_PARAMETER_ERROR 148
|
||||||
|
# define EC_R_KEYS_NOT_SET 140
|
||||||
|
# define EC_R_LADDER_POST_FAILURE 136
|
||||||
|
# define EC_R_LADDER_PRE_FAILURE 153
|
||||||
|
# define EC_R_LADDER_STEP_FAILURE 162
|
||||||
|
# define EC_R_MISSING_OID 167
|
||||||
|
# define EC_R_MISSING_PARAMETERS 124
|
||||||
|
# define EC_R_MISSING_PRIVATE_KEY 125
|
||||||
|
# define EC_R_NEED_NEW_SETUP_VALUES 157
|
||||||
|
# define EC_R_NOT_A_NIST_PRIME 135
|
||||||
|
# define EC_R_NOT_IMPLEMENTED 126
|
||||||
|
# define EC_R_NOT_INITIALIZED 111
|
||||||
|
# define EC_R_NO_PARAMETERS_SET 139
|
||||||
|
# define EC_R_NO_PRIVATE_VALUE 154
|
||||||
|
# define EC_R_OPERATION_NOT_SUPPORTED 152
|
||||||
|
# define EC_R_PASSED_NULL_PARAMETER 134
|
||||||
|
# define EC_R_PEER_KEY_ERROR 149
|
||||||
|
# define EC_R_PKPARAMETERS2GROUP_FAILURE 127
|
||||||
|
# define EC_R_POINT_ARITHMETIC_FAILURE 155
|
||||||
|
# define EC_R_POINT_AT_INFINITY 106
|
||||||
|
# define EC_R_POINT_COORDINATES_BLIND_FAILURE 163
|
||||||
|
# define EC_R_POINT_IS_NOT_ON_CURVE 107
|
||||||
|
# define EC_R_RANDOM_NUMBER_GENERATION_FAILED 158
|
||||||
|
# define EC_R_SHARED_INFO_ERROR 150
|
||||||
|
# define EC_R_SLOT_FULL 108
|
||||||
|
# define EC_R_UNDEFINED_GENERATOR 113
|
||||||
|
# define EC_R_UNDEFINED_ORDER 128
|
||||||
|
# define EC_R_UNKNOWN_COFACTOR 164
|
||||||
|
# define EC_R_UNKNOWN_GROUP 129
|
||||||
|
# define EC_R_UNKNOWN_ORDER 114
|
||||||
|
# define EC_R_UNSUPPORTED_FIELD 131
|
||||||
|
# define EC_R_WRONG_CURVE_PARAMETERS 145
|
||||||
|
# define EC_R_WRONG_ORDER 130
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_ENGINEERR_H
|
||||||
|
# define HEADER_ENGINEERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_ENGINE
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_ENGINE_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ENGINE function codes.
|
||||||
|
*/
|
||||||
|
# define ENGINE_F_DIGEST_UPDATE 198
|
||||||
|
# define ENGINE_F_DYNAMIC_CTRL 180
|
||||||
|
# define ENGINE_F_DYNAMIC_GET_DATA_CTX 181
|
||||||
|
# define ENGINE_F_DYNAMIC_LOAD 182
|
||||||
|
# define ENGINE_F_DYNAMIC_SET_DATA_CTX 183
|
||||||
|
# define ENGINE_F_ENGINE_ADD 105
|
||||||
|
# define ENGINE_F_ENGINE_BY_ID 106
|
||||||
|
# define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170
|
||||||
|
# define ENGINE_F_ENGINE_CTRL 142
|
||||||
|
# define ENGINE_F_ENGINE_CTRL_CMD 178
|
||||||
|
# define ENGINE_F_ENGINE_CTRL_CMD_STRING 171
|
||||||
|
# define ENGINE_F_ENGINE_FINISH 107
|
||||||
|
# define ENGINE_F_ENGINE_GET_CIPHER 185
|
||||||
|
# define ENGINE_F_ENGINE_GET_DIGEST 186
|
||||||
|
# define ENGINE_F_ENGINE_GET_FIRST 195
|
||||||
|
# define ENGINE_F_ENGINE_GET_LAST 196
|
||||||
|
# define ENGINE_F_ENGINE_GET_NEXT 115
|
||||||
|
# define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 193
|
||||||
|
# define ENGINE_F_ENGINE_GET_PKEY_METH 192
|
||||||
|
# define ENGINE_F_ENGINE_GET_PREV 116
|
||||||
|
# define ENGINE_F_ENGINE_INIT 119
|
||||||
|
# define ENGINE_F_ENGINE_LIST_ADD 120
|
||||||
|
# define ENGINE_F_ENGINE_LIST_REMOVE 121
|
||||||
|
# define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150
|
||||||
|
# define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151
|
||||||
|
# define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 194
|
||||||
|
# define ENGINE_F_ENGINE_NEW 122
|
||||||
|
# define ENGINE_F_ENGINE_PKEY_ASN1_FIND_STR 197
|
||||||
|
# define ENGINE_F_ENGINE_REMOVE 123
|
||||||
|
# define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189
|
||||||
|
# define ENGINE_F_ENGINE_SET_ID 129
|
||||||
|
# define ENGINE_F_ENGINE_SET_NAME 130
|
||||||
|
# define ENGINE_F_ENGINE_TABLE_REGISTER 184
|
||||||
|
# define ENGINE_F_ENGINE_UNLOCKED_FINISH 191
|
||||||
|
# define ENGINE_F_ENGINE_UP_REF 190
|
||||||
|
# define ENGINE_F_INT_CLEANUP_ITEM 199
|
||||||
|
# define ENGINE_F_INT_CTRL_HELPER 172
|
||||||
|
# define ENGINE_F_INT_ENGINE_CONFIGURE 188
|
||||||
|
# define ENGINE_F_INT_ENGINE_MODULE_INIT 187
|
||||||
|
# define ENGINE_F_OSSL_HMAC_INIT 200
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ENGINE reason codes.
|
||||||
|
*/
|
||||||
|
# define ENGINE_R_ALREADY_LOADED 100
|
||||||
|
# define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133
|
||||||
|
# define ENGINE_R_CMD_NOT_EXECUTABLE 134
|
||||||
|
# define ENGINE_R_COMMAND_TAKES_INPUT 135
|
||||||
|
# define ENGINE_R_COMMAND_TAKES_NO_INPUT 136
|
||||||
|
# define ENGINE_R_CONFLICTING_ENGINE_ID 103
|
||||||
|
# define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119
|
||||||
|
# define ENGINE_R_DSO_FAILURE 104
|
||||||
|
# define ENGINE_R_DSO_NOT_FOUND 132
|
||||||
|
# define ENGINE_R_ENGINES_SECTION_ERROR 148
|
||||||
|
# define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102
|
||||||
|
# define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105
|
||||||
|
# define ENGINE_R_ENGINE_SECTION_ERROR 149
|
||||||
|
# define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128
|
||||||
|
# define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129
|
||||||
|
# define ENGINE_R_FINISH_FAILED 106
|
||||||
|
# define ENGINE_R_ID_OR_NAME_MISSING 108
|
||||||
|
# define ENGINE_R_INIT_FAILED 109
|
||||||
|
# define ENGINE_R_INTERNAL_LIST_ERROR 110
|
||||||
|
# define ENGINE_R_INVALID_ARGUMENT 143
|
||||||
|
# define ENGINE_R_INVALID_CMD_NAME 137
|
||||||
|
# define ENGINE_R_INVALID_CMD_NUMBER 138
|
||||||
|
# define ENGINE_R_INVALID_INIT_VALUE 151
|
||||||
|
# define ENGINE_R_INVALID_STRING 150
|
||||||
|
# define ENGINE_R_NOT_INITIALISED 117
|
||||||
|
# define ENGINE_R_NOT_LOADED 112
|
||||||
|
# define ENGINE_R_NO_CONTROL_FUNCTION 120
|
||||||
|
# define ENGINE_R_NO_INDEX 144
|
||||||
|
# define ENGINE_R_NO_LOAD_FUNCTION 125
|
||||||
|
# define ENGINE_R_NO_REFERENCE 130
|
||||||
|
# define ENGINE_R_NO_SUCH_ENGINE 116
|
||||||
|
# define ENGINE_R_UNIMPLEMENTED_CIPHER 146
|
||||||
|
# define ENGINE_R_UNIMPLEMENTED_DIGEST 147
|
||||||
|
# define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101
|
||||||
|
# define ENGINE_R_VERSION_INCOMPATIBILITY 145
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,205 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2020 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_EVPERR_H
|
||||||
|
# define HEADER_EVPERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_EVP_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* EVP function codes.
|
||||||
|
*/
|
||||||
|
# define EVP_F_AESNI_INIT_KEY 165
|
||||||
|
# define EVP_F_AESNI_XTS_INIT_KEY 207
|
||||||
|
# define EVP_F_AES_GCM_CTRL 196
|
||||||
|
# define EVP_F_AES_INIT_KEY 133
|
||||||
|
# define EVP_F_AES_OCB_CIPHER 169
|
||||||
|
# define EVP_F_AES_T4_INIT_KEY 178
|
||||||
|
# define EVP_F_AES_T4_XTS_INIT_KEY 208
|
||||||
|
# define EVP_F_AES_WRAP_CIPHER 170
|
||||||
|
# define EVP_F_AES_XTS_INIT_KEY 209
|
||||||
|
# define EVP_F_ALG_MODULE_INIT 177
|
||||||
|
# define EVP_F_ARIA_CCM_INIT_KEY 175
|
||||||
|
# define EVP_F_ARIA_GCM_CTRL 197
|
||||||
|
# define EVP_F_ARIA_GCM_INIT_KEY 176
|
||||||
|
# define EVP_F_ARIA_INIT_KEY 185
|
||||||
|
# define EVP_F_B64_NEW 198
|
||||||
|
# define EVP_F_CAMELLIA_INIT_KEY 159
|
||||||
|
# define EVP_F_CHACHA20_POLY1305_CTRL 182
|
||||||
|
# define EVP_F_CMLL_T4_INIT_KEY 179
|
||||||
|
# define EVP_F_DES_EDE3_WRAP_CIPHER 171
|
||||||
|
# define EVP_F_DO_SIGVER_INIT 161
|
||||||
|
# define EVP_F_ENC_NEW 199
|
||||||
|
# define EVP_F_EVP_CIPHERINIT_EX 123
|
||||||
|
# define EVP_F_EVP_CIPHER_ASN1_TO_PARAM 204
|
||||||
|
# define EVP_F_EVP_CIPHER_CTX_COPY 163
|
||||||
|
# define EVP_F_EVP_CIPHER_CTX_CTRL 124
|
||||||
|
# define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122
|
||||||
|
# define EVP_F_EVP_CIPHER_PARAM_TO_ASN1 205
|
||||||
|
# define EVP_F_EVP_DECRYPTFINAL_EX 101
|
||||||
|
# define EVP_F_EVP_DECRYPTUPDATE 166
|
||||||
|
# define EVP_F_EVP_DIGESTFINALXOF 174
|
||||||
|
# define EVP_F_EVP_DIGESTINIT_EX 128
|
||||||
|
# define EVP_F_EVP_ENCRYPTDECRYPTUPDATE 219
|
||||||
|
# define EVP_F_EVP_ENCRYPTFINAL_EX 127
|
||||||
|
# define EVP_F_EVP_ENCRYPTUPDATE 167
|
||||||
|
# define EVP_F_EVP_MD_CTX_COPY_EX 110
|
||||||
|
# define EVP_F_EVP_MD_SIZE 162
|
||||||
|
# define EVP_F_EVP_OPENINIT 102
|
||||||
|
# define EVP_F_EVP_PBE_ALG_ADD 115
|
||||||
|
# define EVP_F_EVP_PBE_ALG_ADD_TYPE 160
|
||||||
|
# define EVP_F_EVP_PBE_CIPHERINIT 116
|
||||||
|
# define EVP_F_EVP_PBE_SCRYPT 181
|
||||||
|
# define EVP_F_EVP_PKCS82PKEY 111
|
||||||
|
# define EVP_F_EVP_PKEY2PKCS8 113
|
||||||
|
# define EVP_F_EVP_PKEY_ASN1_ADD0 188
|
||||||
|
# define EVP_F_EVP_PKEY_CHECK 186
|
||||||
|
# define EVP_F_EVP_PKEY_COPY_PARAMETERS 103
|
||||||
|
# define EVP_F_EVP_PKEY_CTX_CTRL 137
|
||||||
|
# define EVP_F_EVP_PKEY_CTX_CTRL_STR 150
|
||||||
|
# define EVP_F_EVP_PKEY_CTX_DUP 156
|
||||||
|
# define EVP_F_EVP_PKEY_CTX_MD 168
|
||||||
|
# define EVP_F_EVP_PKEY_DECRYPT 104
|
||||||
|
# define EVP_F_EVP_PKEY_DECRYPT_INIT 138
|
||||||
|
# define EVP_F_EVP_PKEY_DECRYPT_OLD 151
|
||||||
|
# define EVP_F_EVP_PKEY_DERIVE 153
|
||||||
|
# define EVP_F_EVP_PKEY_DERIVE_INIT 154
|
||||||
|
# define EVP_F_EVP_PKEY_DERIVE_SET_PEER 155
|
||||||
|
# define EVP_F_EVP_PKEY_ENCRYPT 105
|
||||||
|
# define EVP_F_EVP_PKEY_ENCRYPT_INIT 139
|
||||||
|
# define EVP_F_EVP_PKEY_ENCRYPT_OLD 152
|
||||||
|
# define EVP_F_EVP_PKEY_GET0_DH 119
|
||||||
|
# define EVP_F_EVP_PKEY_GET0_DSA 120
|
||||||
|
# define EVP_F_EVP_PKEY_GET0_EC_KEY 131
|
||||||
|
# define EVP_F_EVP_PKEY_GET0_HMAC 183
|
||||||
|
# define EVP_F_EVP_PKEY_GET0_POLY1305 184
|
||||||
|
# define EVP_F_EVP_PKEY_GET0_RSA 121
|
||||||
|
# define EVP_F_EVP_PKEY_GET0_SIPHASH 172
|
||||||
|
# define EVP_F_EVP_PKEY_GET_RAW_PRIVATE_KEY 202
|
||||||
|
# define EVP_F_EVP_PKEY_GET_RAW_PUBLIC_KEY 203
|
||||||
|
# define EVP_F_EVP_PKEY_KEYGEN 146
|
||||||
|
# define EVP_F_EVP_PKEY_KEYGEN_INIT 147
|
||||||
|
# define EVP_F_EVP_PKEY_METH_ADD0 194
|
||||||
|
# define EVP_F_EVP_PKEY_METH_NEW 195
|
||||||
|
# define EVP_F_EVP_PKEY_NEW 106
|
||||||
|
# define EVP_F_EVP_PKEY_NEW_CMAC_KEY 193
|
||||||
|
# define EVP_F_EVP_PKEY_NEW_RAW_PRIVATE_KEY 191
|
||||||
|
# define EVP_F_EVP_PKEY_NEW_RAW_PUBLIC_KEY 192
|
||||||
|
# define EVP_F_EVP_PKEY_PARAMGEN 148
|
||||||
|
# define EVP_F_EVP_PKEY_PARAMGEN_INIT 149
|
||||||
|
# define EVP_F_EVP_PKEY_PARAM_CHECK 189
|
||||||
|
# define EVP_F_EVP_PKEY_PUBLIC_CHECK 190
|
||||||
|
# define EVP_F_EVP_PKEY_SET1_ENGINE 187
|
||||||
|
# define EVP_F_EVP_PKEY_SET_ALIAS_TYPE 206
|
||||||
|
# define EVP_F_EVP_PKEY_SIGN 140
|
||||||
|
# define EVP_F_EVP_PKEY_SIGN_INIT 141
|
||||||
|
# define EVP_F_EVP_PKEY_VERIFY 142
|
||||||
|
# define EVP_F_EVP_PKEY_VERIFY_INIT 143
|
||||||
|
# define EVP_F_EVP_PKEY_VERIFY_RECOVER 144
|
||||||
|
# define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT 145
|
||||||
|
# define EVP_F_EVP_SIGNFINAL 107
|
||||||
|
# define EVP_F_EVP_VERIFYFINAL 108
|
||||||
|
# define EVP_F_INT_CTX_NEW 157
|
||||||
|
# define EVP_F_OK_NEW 200
|
||||||
|
# define EVP_F_PKCS5_PBE_KEYIVGEN 117
|
||||||
|
# define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118
|
||||||
|
# define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN 164
|
||||||
|
# define EVP_F_PKCS5_V2_SCRYPT_KEYIVGEN 180
|
||||||
|
# define EVP_F_PKEY_SET_TYPE 158
|
||||||
|
# define EVP_F_RC2_MAGIC_TO_METH 109
|
||||||
|
# define EVP_F_RC5_CTRL 125
|
||||||
|
# define EVP_F_R_32_12_16_INIT_KEY 242
|
||||||
|
# define EVP_F_S390X_AES_GCM_CTRL 201
|
||||||
|
# define EVP_F_UPDATE 173
|
||||||
|
|
||||||
|
/*
|
||||||
|
* EVP reason codes.
|
||||||
|
*/
|
||||||
|
# define EVP_R_AES_KEY_SETUP_FAILED 143
|
||||||
|
# define EVP_R_ARIA_KEY_SETUP_FAILED 176
|
||||||
|
# define EVP_R_BAD_DECRYPT 100
|
||||||
|
# define EVP_R_BAD_KEY_LENGTH 195
|
||||||
|
# define EVP_R_BUFFER_TOO_SMALL 155
|
||||||
|
# define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157
|
||||||
|
# define EVP_R_CIPHER_PARAMETER_ERROR 122
|
||||||
|
# define EVP_R_COMMAND_NOT_SUPPORTED 147
|
||||||
|
# define EVP_R_COPY_ERROR 173
|
||||||
|
# define EVP_R_CTRL_NOT_IMPLEMENTED 132
|
||||||
|
# define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133
|
||||||
|
# define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138
|
||||||
|
# define EVP_R_DECODE_ERROR 114
|
||||||
|
# define EVP_R_DIFFERENT_KEY_TYPES 101
|
||||||
|
# define EVP_R_DIFFERENT_PARAMETERS 153
|
||||||
|
# define EVP_R_ERROR_LOADING_SECTION 165
|
||||||
|
# define EVP_R_ERROR_SETTING_FIPS_MODE 166
|
||||||
|
# define EVP_R_EXPECTING_AN_HMAC_KEY 174
|
||||||
|
# define EVP_R_EXPECTING_AN_RSA_KEY 127
|
||||||
|
# define EVP_R_EXPECTING_A_DH_KEY 128
|
||||||
|
# define EVP_R_EXPECTING_A_DSA_KEY 129
|
||||||
|
# define EVP_R_EXPECTING_A_EC_KEY 142
|
||||||
|
# define EVP_R_EXPECTING_A_POLY1305_KEY 164
|
||||||
|
# define EVP_R_EXPECTING_A_SIPHASH_KEY 175
|
||||||
|
# define EVP_R_FIPS_MODE_NOT_SUPPORTED 167
|
||||||
|
# define EVP_R_GET_RAW_KEY_FAILED 182
|
||||||
|
# define EVP_R_ILLEGAL_SCRYPT_PARAMETERS 171
|
||||||
|
# define EVP_R_INITIALIZATION_ERROR 134
|
||||||
|
# define EVP_R_INPUT_NOT_INITIALIZED 111
|
||||||
|
# define EVP_R_INVALID_DIGEST 152
|
||||||
|
# define EVP_R_INVALID_FIPS_MODE 168
|
||||||
|
# define EVP_R_INVALID_IV_LENGTH 194
|
||||||
|
# define EVP_R_INVALID_KEY 163
|
||||||
|
# define EVP_R_INVALID_KEY_LENGTH 130
|
||||||
|
# define EVP_R_INVALID_OPERATION 148
|
||||||
|
# define EVP_R_KEYGEN_FAILURE 120
|
||||||
|
# define EVP_R_KEY_SETUP_FAILED 180
|
||||||
|
# define EVP_R_MEMORY_LIMIT_EXCEEDED 172
|
||||||
|
# define EVP_R_MESSAGE_DIGEST_IS_NULL 159
|
||||||
|
# define EVP_R_METHOD_NOT_SUPPORTED 144
|
||||||
|
# define EVP_R_MISSING_PARAMETERS 103
|
||||||
|
# define EVP_R_NOT_XOF_OR_INVALID_LENGTH 178
|
||||||
|
# define EVP_R_NO_CIPHER_SET 131
|
||||||
|
# define EVP_R_NO_DEFAULT_DIGEST 158
|
||||||
|
# define EVP_R_NO_DIGEST_SET 139
|
||||||
|
# define EVP_R_NO_KEY_SET 154
|
||||||
|
# define EVP_R_NO_OPERATION_SET 149
|
||||||
|
# define EVP_R_ONLY_ONESHOT_SUPPORTED 177
|
||||||
|
# define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150
|
||||||
|
# define EVP_R_OPERATON_NOT_INITIALIZED 151
|
||||||
|
# define EVP_R_PARTIALLY_OVERLAPPING 162
|
||||||
|
# define EVP_R_PBKDF2_ERROR 181
|
||||||
|
# define EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED 179
|
||||||
|
# define EVP_R_PRIVATE_KEY_DECODE_ERROR 145
|
||||||
|
# define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146
|
||||||
|
# define EVP_R_PUBLIC_KEY_NOT_RSA 106
|
||||||
|
# define EVP_R_UNKNOWN_CIPHER 160
|
||||||
|
# define EVP_R_UNKNOWN_DIGEST 161
|
||||||
|
# define EVP_R_UNKNOWN_OPTION 169
|
||||||
|
# define EVP_R_UNKNOWN_PBE_ALGORITHM 121
|
||||||
|
# define EVP_R_UNSUPPORTED_ALGORITHM 156
|
||||||
|
# define EVP_R_UNSUPPORTED_CIPHER 107
|
||||||
|
# define EVP_R_UNSUPPORTED_KEYLENGTH 123
|
||||||
|
# define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124
|
||||||
|
# define EVP_R_UNSUPPORTED_KEY_SIZE 108
|
||||||
|
# define EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS 135
|
||||||
|
# define EVP_R_UNSUPPORTED_PRF 125
|
||||||
|
# define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118
|
||||||
|
# define EVP_R_UNSUPPORTED_SALT_TYPE 126
|
||||||
|
# define EVP_R_WRAP_MODE_NOT_ALLOWED 170
|
||||||
|
# define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109
|
||||||
|
# define EVP_R_XTS_DUPLICATED_KEYS 183
|
||||||
|
|
||||||
|
#endif
|
@ -1,105 +1,64 @@
|
|||||||
/* crypto/idea/idea.h */
|
/*
|
||||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* This package is an SSL implementation written
|
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||||
* by Eric Young (eay@cryptsoft.com).
|
* this file except in compliance with the License. You can obtain a copy
|
||||||
* The implementation was written so as to conform with Netscapes SSL.
|
* in the file LICENSE in the source distribution or at
|
||||||
*
|
* https://www.openssl.org/source/license.html
|
||||||
* This library is free for commercial and non-commercial use as long as
|
|
||||||
* the following conditions are aheared to. The following conditions
|
|
||||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
|
||||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
|
||||||
* included with this distribution is covered by the same copyright terms
|
|
||||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
|
||||||
*
|
|
||||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
|
||||||
* the code are not to be removed.
|
|
||||||
* If this package is used in a product, Eric Young should be given attribution
|
|
||||||
* as the author of the parts of the library used.
|
|
||||||
* This can be in the form of a textual message at program startup or
|
|
||||||
* in documentation (online or textual) provided with the package.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* "This product includes cryptographic software written by
|
|
||||||
* Eric Young (eay@cryptsoft.com)"
|
|
||||||
* The word 'cryptographic' can be left out if the rouines from the library
|
|
||||||
* being used are not cryptographic related :-).
|
|
||||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
|
||||||
* the apps directory (application code) you must include an acknowledgement:
|
|
||||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* The licence and distribution terms for any publically available version or
|
|
||||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
|
||||||
* copied and put under another distribution licence
|
|
||||||
* [including the GNU Public Licence.]
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEADER_IDEA_H
|
#ifndef HEADER_IDEA_H
|
||||||
# define HEADER_IDEA_H
|
# define HEADER_IDEA_H
|
||||||
|
|
||||||
# include <openssl/opensslconf.h>/* IDEA_INT, OPENSSL_NO_IDEA */
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
# ifdef OPENSSL_NO_IDEA
|
# ifndef OPENSSL_NO_IDEA
|
||||||
# error IDEA is disabled.
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
typedef unsigned int IDEA_INT;
|
||||||
|
|
||||||
# define IDEA_ENCRYPT 1
|
# define IDEA_ENCRYPT 1
|
||||||
# define IDEA_DECRYPT 0
|
# define IDEA_DECRYPT 0
|
||||||
|
|
||||||
# define IDEA_BLOCK 8
|
# define IDEA_BLOCK 8
|
||||||
# define IDEA_KEY_LENGTH 16
|
# define IDEA_KEY_LENGTH 16
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct idea_key_st {
|
typedef struct idea_key_st {
|
||||||
IDEA_INT data[9][6];
|
IDEA_INT data[9][6];
|
||||||
} IDEA_KEY_SCHEDULE;
|
} IDEA_KEY_SCHEDULE;
|
||||||
|
|
||||||
const char *idea_options(void);
|
const char *IDEA_options(void);
|
||||||
void idea_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
IDEA_KEY_SCHEDULE *ks);
|
|
||||||
# ifdef OPENSSL_FIPS
|
|
||||||
void private_idea_set_encrypt_key(const unsigned char *key,
|
|
||||||
IDEA_KEY_SCHEDULE *ks);
|
IDEA_KEY_SCHEDULE *ks);
|
||||||
# endif
|
void IDEA_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks);
|
||||||
void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks);
|
void IDEA_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);
|
||||||
void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);
|
void IDEA_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
void idea_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
|
||||||
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
|
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
|
||||||
int enc);
|
int enc);
|
||||||
void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
|
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
|
||||||
int *num, int enc);
|
int *num, int enc);
|
||||||
void idea_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
|
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
|
||||||
int *num);
|
int *num);
|
||||||
void idea_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks);
|
void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks);
|
||||||
#ifdef __cplusplus
|
|
||||||
|
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||||
|
# define idea_options IDEA_options
|
||||||
|
# define idea_ecb_encrypt IDEA_ecb_encrypt
|
||||||
|
# define idea_set_encrypt_key IDEA_set_encrypt_key
|
||||||
|
# define idea_set_decrypt_key IDEA_set_decrypt_key
|
||||||
|
# define idea_cbc_encrypt IDEA_cbc_encrypt
|
||||||
|
# define idea_cfb64_encrypt IDEA_cfb64_encrypt
|
||||||
|
# define idea_ofb64_encrypt IDEA_ofb64_encrypt
|
||||||
|
# define idea_encrypt IDEA_encrypt
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016-2018 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_KDF_H
|
||||||
|
# define HEADER_KDF_H
|
||||||
|
|
||||||
|
# include <openssl/kdferr.h>
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTRL_TLS_MD (EVP_PKEY_ALG_CTRL)
|
||||||
|
# define EVP_PKEY_CTRL_TLS_SECRET (EVP_PKEY_ALG_CTRL + 1)
|
||||||
|
# define EVP_PKEY_CTRL_TLS_SEED (EVP_PKEY_ALG_CTRL + 2)
|
||||||
|
# define EVP_PKEY_CTRL_HKDF_MD (EVP_PKEY_ALG_CTRL + 3)
|
||||||
|
# define EVP_PKEY_CTRL_HKDF_SALT (EVP_PKEY_ALG_CTRL + 4)
|
||||||
|
# define EVP_PKEY_CTRL_HKDF_KEY (EVP_PKEY_ALG_CTRL + 5)
|
||||||
|
# define EVP_PKEY_CTRL_HKDF_INFO (EVP_PKEY_ALG_CTRL + 6)
|
||||||
|
# define EVP_PKEY_CTRL_HKDF_MODE (EVP_PKEY_ALG_CTRL + 7)
|
||||||
|
# define EVP_PKEY_CTRL_PASS (EVP_PKEY_ALG_CTRL + 8)
|
||||||
|
# define EVP_PKEY_CTRL_SCRYPT_SALT (EVP_PKEY_ALG_CTRL + 9)
|
||||||
|
# define EVP_PKEY_CTRL_SCRYPT_N (EVP_PKEY_ALG_CTRL + 10)
|
||||||
|
# define EVP_PKEY_CTRL_SCRYPT_R (EVP_PKEY_ALG_CTRL + 11)
|
||||||
|
# define EVP_PKEY_CTRL_SCRYPT_P (EVP_PKEY_ALG_CTRL + 12)
|
||||||
|
# define EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES (EVP_PKEY_ALG_CTRL + 13)
|
||||||
|
|
||||||
|
# define EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND 0
|
||||||
|
# define EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY 1
|
||||||
|
# define EVP_PKEY_HKDEF_MODE_EXPAND_ONLY 2
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_set_tls1_prf_md(pctx, md) \
|
||||||
|
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_TLS_MD, 0, (void *)(md))
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_set1_tls1_prf_secret(pctx, sec, seclen) \
|
||||||
|
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_TLS_SECRET, seclen, (void *)(sec))
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, seed, seedlen) \
|
||||||
|
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_TLS_SEED, seedlen, (void *)(seed))
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_set_hkdf_md(pctx, md) \
|
||||||
|
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_HKDF_MD, 0, (void *)(md))
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt, saltlen) \
|
||||||
|
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_HKDF_SALT, saltlen, (void *)(salt))
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_set1_hkdf_key(pctx, key, keylen) \
|
||||||
|
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_HKDF_KEY, keylen, (void *)(key))
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_add1_hkdf_info(pctx, info, infolen) \
|
||||||
|
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_HKDF_INFO, infolen, (void *)(info))
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_hkdf_mode(pctx, mode) \
|
||||||
|
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_HKDF_MODE, mode, NULL)
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_set1_pbe_pass(pctx, pass, passlen) \
|
||||||
|
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_PASS, passlen, (void *)(pass))
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_set1_scrypt_salt(pctx, salt, saltlen) \
|
||||||
|
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_SCRYPT_SALT, saltlen, (void *)(salt))
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_set_scrypt_N(pctx, n) \
|
||||||
|
EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_SCRYPT_N, n)
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_set_scrypt_r(pctx, r) \
|
||||||
|
EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_SCRYPT_R, r)
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_set_scrypt_p(pctx, p) \
|
||||||
|
EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_SCRYPT_P, p)
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTX_set_scrypt_maxmem_bytes(pctx, maxmem_bytes) \
|
||||||
|
EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||||
|
EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES, maxmem_bytes)
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_KDFERR_H
|
||||||
|
# define HEADER_KDFERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_KDF_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* KDF function codes.
|
||||||
|
*/
|
||||||
|
# define KDF_F_PKEY_HKDF_CTRL_STR 103
|
||||||
|
# define KDF_F_PKEY_HKDF_DERIVE 102
|
||||||
|
# define KDF_F_PKEY_HKDF_INIT 108
|
||||||
|
# define KDF_F_PKEY_SCRYPT_CTRL_STR 104
|
||||||
|
# define KDF_F_PKEY_SCRYPT_CTRL_UINT64 105
|
||||||
|
# define KDF_F_PKEY_SCRYPT_DERIVE 109
|
||||||
|
# define KDF_F_PKEY_SCRYPT_INIT 106
|
||||||
|
# define KDF_F_PKEY_SCRYPT_SET_MEMBUF 107
|
||||||
|
# define KDF_F_PKEY_TLS1_PRF_CTRL_STR 100
|
||||||
|
# define KDF_F_PKEY_TLS1_PRF_DERIVE 101
|
||||||
|
# define KDF_F_PKEY_TLS1_PRF_INIT 110
|
||||||
|
# define KDF_F_TLS1_PRF_ALG 111
|
||||||
|
|
||||||
|
/*
|
||||||
|
* KDF reason codes.
|
||||||
|
*/
|
||||||
|
# define KDF_R_INVALID_DIGEST 100
|
||||||
|
# define KDF_R_MISSING_ITERATION_COUNT 109
|
||||||
|
# define KDF_R_MISSING_KEY 104
|
||||||
|
# define KDF_R_MISSING_MESSAGE_DIGEST 105
|
||||||
|
# define KDF_R_MISSING_PARAMETER 101
|
||||||
|
# define KDF_R_MISSING_PASS 110
|
||||||
|
# define KDF_R_MISSING_SALT 111
|
||||||
|
# define KDF_R_MISSING_SECRET 107
|
||||||
|
# define KDF_R_MISSING_SEED 106
|
||||||
|
# define KDF_R_UNKNOWN_PARAMETER_TYPE 103
|
||||||
|
# define KDF_R_VALUE_ERROR 108
|
||||||
|
# define KDF_R_VALUE_MISSING 102
|
||||||
|
|
||||||
|
#endif
|
@ -1,240 +0,0 @@
|
|||||||
/* krb5_asn.h */
|
|
||||||
/*
|
|
||||||
* Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project, **
|
|
||||||
* using ocsp/{*.h,*asn*.c} as a starting point
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* ====================================================================
|
|
||||||
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
*
|
|
||||||
* 3. All advertising materials mentioning features or use of this
|
|
||||||
* software must display the following acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
|
||||||
*
|
|
||||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* prior written permission. For written permission, please contact
|
|
||||||
* openssl-core@openssl.org.
|
|
||||||
*
|
|
||||||
* 5. Products derived from this software may not be called "OpenSSL"
|
|
||||||
* nor may "OpenSSL" appear in their names without prior written
|
|
||||||
* permission of the OpenSSL Project.
|
|
||||||
*
|
|
||||||
* 6. Redistributions of any form whatsoever must retain the following
|
|
||||||
* acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
|
||||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
|
||||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
||||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
||||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
* ====================================================================
|
|
||||||
*
|
|
||||||
* This product includes cryptographic software written by Eric Young
|
|
||||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
|
||||||
* Hudson (tjh@cryptsoft.com).
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef HEADER_KRB5_ASN_H
|
|
||||||
# define HEADER_KRB5_ASN_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
* #include <krb5.h>
|
|
||||||
*/
|
|
||||||
# include <openssl/safestack.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ASN.1 from Kerberos RFC 1510
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*- EncryptedData ::= SEQUENCE {
|
|
||||||
* etype[0] INTEGER, -- EncryptionType
|
|
||||||
* kvno[1] INTEGER OPTIONAL,
|
|
||||||
* cipher[2] OCTET STRING -- ciphertext
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
typedef struct krb5_encdata_st {
|
|
||||||
ASN1_INTEGER *etype;
|
|
||||||
ASN1_INTEGER *kvno;
|
|
||||||
ASN1_OCTET_STRING *cipher;
|
|
||||||
} KRB5_ENCDATA;
|
|
||||||
|
|
||||||
DECLARE_STACK_OF(KRB5_ENCDATA)
|
|
||||||
|
|
||||||
/*- PrincipalName ::= SEQUENCE {
|
|
||||||
* name-type[0] INTEGER,
|
|
||||||
* name-string[1] SEQUENCE OF GeneralString
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
typedef struct krb5_princname_st {
|
|
||||||
ASN1_INTEGER *nametype;
|
|
||||||
STACK_OF(ASN1_GENERALSTRING) *namestring;
|
|
||||||
} KRB5_PRINCNAME;
|
|
||||||
|
|
||||||
DECLARE_STACK_OF(KRB5_PRINCNAME)
|
|
||||||
|
|
||||||
/*- Ticket ::= [APPLICATION 1] SEQUENCE {
|
|
||||||
* tkt-vno[0] INTEGER,
|
|
||||||
* realm[1] Realm,
|
|
||||||
* sname[2] PrincipalName,
|
|
||||||
* enc-part[3] EncryptedData
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
typedef struct krb5_tktbody_st {
|
|
||||||
ASN1_INTEGER *tktvno;
|
|
||||||
ASN1_GENERALSTRING *realm;
|
|
||||||
KRB5_PRINCNAME *sname;
|
|
||||||
KRB5_ENCDATA *encdata;
|
|
||||||
} KRB5_TKTBODY;
|
|
||||||
|
|
||||||
typedef STACK_OF(KRB5_TKTBODY) KRB5_TICKET;
|
|
||||||
DECLARE_STACK_OF(KRB5_TKTBODY)
|
|
||||||
|
|
||||||
/*- AP-REQ ::= [APPLICATION 14] SEQUENCE {
|
|
||||||
* pvno[0] INTEGER,
|
|
||||||
* msg-type[1] INTEGER,
|
|
||||||
* ap-options[2] APOptions,
|
|
||||||
* ticket[3] Ticket,
|
|
||||||
* authenticator[4] EncryptedData
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* APOptions ::= BIT STRING {
|
|
||||||
* reserved(0), use-session-key(1), mutual-required(2) }
|
|
||||||
*/
|
|
||||||
typedef struct krb5_ap_req_st {
|
|
||||||
ASN1_INTEGER *pvno;
|
|
||||||
ASN1_INTEGER *msgtype;
|
|
||||||
ASN1_BIT_STRING *apoptions;
|
|
||||||
KRB5_TICKET *ticket;
|
|
||||||
KRB5_ENCDATA *authenticator;
|
|
||||||
} KRB5_APREQBODY;
|
|
||||||
|
|
||||||
typedef STACK_OF(KRB5_APREQBODY) KRB5_APREQ;
|
|
||||||
DECLARE_STACK_OF(KRB5_APREQBODY)
|
|
||||||
|
|
||||||
/* Authenticator Stuff */
|
|
||||||
|
|
||||||
/*- Checksum ::= SEQUENCE {
|
|
||||||
* cksumtype[0] INTEGER,
|
|
||||||
* checksum[1] OCTET STRING
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
typedef struct krb5_checksum_st {
|
|
||||||
ASN1_INTEGER *ctype;
|
|
||||||
ASN1_OCTET_STRING *checksum;
|
|
||||||
} KRB5_CHECKSUM;
|
|
||||||
|
|
||||||
DECLARE_STACK_OF(KRB5_CHECKSUM)
|
|
||||||
|
|
||||||
/*- EncryptionKey ::= SEQUENCE {
|
|
||||||
* keytype[0] INTEGER,
|
|
||||||
* keyvalue[1] OCTET STRING
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
typedef struct krb5_encryptionkey_st {
|
|
||||||
ASN1_INTEGER *ktype;
|
|
||||||
ASN1_OCTET_STRING *keyvalue;
|
|
||||||
} KRB5_ENCKEY;
|
|
||||||
|
|
||||||
DECLARE_STACK_OF(KRB5_ENCKEY)
|
|
||||||
|
|
||||||
/*- AuthorizationData ::= SEQUENCE OF SEQUENCE {
|
|
||||||
* ad-type[0] INTEGER,
|
|
||||||
* ad-data[1] OCTET STRING
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
typedef struct krb5_authorization_st {
|
|
||||||
ASN1_INTEGER *adtype;
|
|
||||||
ASN1_OCTET_STRING *addata;
|
|
||||||
} KRB5_AUTHDATA;
|
|
||||||
|
|
||||||
DECLARE_STACK_OF(KRB5_AUTHDATA)
|
|
||||||
|
|
||||||
/*- -- Unencrypted authenticator
|
|
||||||
* Authenticator ::= [APPLICATION 2] SEQUENCE {
|
|
||||||
* authenticator-vno[0] INTEGER,
|
|
||||||
* crealm[1] Realm,
|
|
||||||
* cname[2] PrincipalName,
|
|
||||||
* cksum[3] Checksum OPTIONAL,
|
|
||||||
* cusec[4] INTEGER,
|
|
||||||
* ctime[5] KerberosTime,
|
|
||||||
* subkey[6] EncryptionKey OPTIONAL,
|
|
||||||
* seq-number[7] INTEGER OPTIONAL,
|
|
||||||
* authorization-data[8] AuthorizationData OPTIONAL
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
typedef struct krb5_authenticator_st {
|
|
||||||
ASN1_INTEGER *avno;
|
|
||||||
ASN1_GENERALSTRING *crealm;
|
|
||||||
KRB5_PRINCNAME *cname;
|
|
||||||
KRB5_CHECKSUM *cksum;
|
|
||||||
ASN1_INTEGER *cusec;
|
|
||||||
ASN1_GENERALIZEDTIME *ctime;
|
|
||||||
KRB5_ENCKEY *subkey;
|
|
||||||
ASN1_INTEGER *seqnum;
|
|
||||||
KRB5_AUTHDATA *authorization;
|
|
||||||
} KRB5_AUTHENTBODY;
|
|
||||||
|
|
||||||
typedef STACK_OF(KRB5_AUTHENTBODY) KRB5_AUTHENT;
|
|
||||||
DECLARE_STACK_OF(KRB5_AUTHENTBODY)
|
|
||||||
|
|
||||||
/*- DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) =
|
|
||||||
* type *name##_new(void);
|
|
||||||
* void name##_free(type *a);
|
|
||||||
* DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) =
|
|
||||||
* 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) = OPENSSL_EXTERN const ASN1_ITEM itname##_it
|
|
||||||
*/
|
|
||||||
|
|
||||||
DECLARE_ASN1_FUNCTIONS(KRB5_ENCDATA)
|
|
||||||
DECLARE_ASN1_FUNCTIONS(KRB5_PRINCNAME)
|
|
||||||
DECLARE_ASN1_FUNCTIONS(KRB5_TKTBODY)
|
|
||||||
DECLARE_ASN1_FUNCTIONS(KRB5_APREQBODY)
|
|
||||||
DECLARE_ASN1_FUNCTIONS(KRB5_TICKET)
|
|
||||||
DECLARE_ASN1_FUNCTIONS(KRB5_APREQ)
|
|
||||||
|
|
||||||
DECLARE_ASN1_FUNCTIONS(KRB5_CHECKSUM)
|
|
||||||
DECLARE_ASN1_FUNCTIONS(KRB5_ENCKEY)
|
|
||||||
DECLARE_ASN1_FUNCTIONS(KRB5_AUTHDATA)
|
|
||||||
DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENTBODY)
|
|
||||||
DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENT)
|
|
||||||
|
|
||||||
/* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
@ -1,197 +0,0 @@
|
|||||||
/* ssl/kssl.h */
|
|
||||||
/*
|
|
||||||
* Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project
|
|
||||||
* 2000. project 2000.
|
|
||||||
*/
|
|
||||||
/* ====================================================================
|
|
||||||
* Copyright (c) 2000 The OpenSSL Project. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
*
|
|
||||||
* 3. All advertising materials mentioning features or use of this
|
|
||||||
* software must display the following acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
|
||||||
*
|
|
||||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* prior written permission. For written permission, please contact
|
|
||||||
* licensing@OpenSSL.org.
|
|
||||||
*
|
|
||||||
* 5. Products derived from this software may not be called "OpenSSL"
|
|
||||||
* nor may "OpenSSL" appear in their names without prior written
|
|
||||||
* permission of the OpenSSL Project.
|
|
||||||
*
|
|
||||||
* 6. Redistributions of any form whatsoever must retain the following
|
|
||||||
* acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
|
||||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
|
||||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
||||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
||||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
* ====================================================================
|
|
||||||
*
|
|
||||||
* This product includes cryptographic software written by Eric Young
|
|
||||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
|
||||||
* Hudson (tjh@cryptsoft.com).
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
** 19990701 VRS Started.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef KSSL_H
|
|
||||||
# define KSSL_H
|
|
||||||
|
|
||||||
# include <openssl/opensslconf.h>
|
|
||||||
|
|
||||||
# ifndef OPENSSL_NO_KRB5
|
|
||||||
|
|
||||||
# include <stdio.h>
|
|
||||||
# include <ctype.h>
|
|
||||||
# include <krb5.h>
|
|
||||||
# ifdef OPENSSL_SYS_WIN32
|
|
||||||
/*
|
|
||||||
* These can sometimes get redefined indirectly by krb5 header files after
|
|
||||||
* they get undefed in ossl_typ.h
|
|
||||||
*/
|
|
||||||
# undef X509_NAME
|
|
||||||
# undef X509_EXTENSIONS
|
|
||||||
# undef OCSP_REQUEST
|
|
||||||
# undef OCSP_RESPONSE
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Depending on which KRB5 implementation used, some types from
|
|
||||||
* the other may be missing. Resolve that here and now
|
|
||||||
*/
|
|
||||||
# ifdef KRB5_HEIMDAL
|
|
||||||
typedef unsigned char krb5_octet;
|
|
||||||
# define FAR
|
|
||||||
# else
|
|
||||||
|
|
||||||
# ifndef FAR
|
|
||||||
# define FAR
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/*-
|
|
||||||
* Uncomment this to debug kssl problems or
|
|
||||||
* to trace usage of the Kerberos session key
|
|
||||||
*
|
|
||||||
* #define KSSL_DEBUG
|
|
||||||
*/
|
|
||||||
|
|
||||||
# ifndef KRB5SVC
|
|
||||||
# define KRB5SVC "host"
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef KRB5KEYTAB
|
|
||||||
# define KRB5KEYTAB "/etc/krb5.keytab"
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef KRB5SENDAUTH
|
|
||||||
# define KRB5SENDAUTH 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef KRB5CHECKAUTH
|
|
||||||
# define KRB5CHECKAUTH 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef KSSL_CLOCKSKEW
|
|
||||||
# define KSSL_CLOCKSKEW 300;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# define KSSL_ERR_MAX 255
|
|
||||||
typedef struct kssl_err_st {
|
|
||||||
int reason;
|
|
||||||
char text[KSSL_ERR_MAX + 1];
|
|
||||||
} KSSL_ERR;
|
|
||||||
|
|
||||||
/*- Context for passing
|
|
||||||
* (1) Kerberos session key to SSL, and
|
|
||||||
* (2) Config data between application and SSL lib
|
|
||||||
*/
|
|
||||||
typedef struct kssl_ctx_st {
|
|
||||||
/* used by: disposition: */
|
|
||||||
char *service_name; /* C,S default ok (kssl) */
|
|
||||||
char *service_host; /* C input, REQUIRED */
|
|
||||||
char *client_princ; /* S output from krb5 ticket */
|
|
||||||
char *keytab_file; /* S NULL (/etc/krb5.keytab) */
|
|
||||||
char *cred_cache; /* C NULL (default) */
|
|
||||||
krb5_enctype enctype;
|
|
||||||
int length;
|
|
||||||
krb5_octet FAR *key;
|
|
||||||
} KSSL_CTX;
|
|
||||||
|
|
||||||
# define KSSL_CLIENT 1
|
|
||||||
# define KSSL_SERVER 2
|
|
||||||
# define KSSL_SERVICE 3
|
|
||||||
# define KSSL_KEYTAB 4
|
|
||||||
|
|
||||||
# define KSSL_CTX_OK 0
|
|
||||||
# define KSSL_CTX_ERR 1
|
|
||||||
# define KSSL_NOMEM 2
|
|
||||||
|
|
||||||
/* Public (for use by applications that use OpenSSL with Kerberos 5 support */
|
|
||||||
krb5_error_code kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text);
|
|
||||||
KSSL_CTX *kssl_ctx_new(void);
|
|
||||||
KSSL_CTX *kssl_ctx_free(KSSL_CTX *kssl_ctx);
|
|
||||||
void kssl_ctx_show(KSSL_CTX *kssl_ctx);
|
|
||||||
krb5_error_code kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which,
|
|
||||||
krb5_data *realm, krb5_data *entity,
|
|
||||||
int nentities);
|
|
||||||
krb5_error_code kssl_cget_tkt(KSSL_CTX *kssl_ctx, krb5_data **enc_tktp,
|
|
||||||
krb5_data *authenp, KSSL_ERR *kssl_err);
|
|
||||||
krb5_error_code kssl_sget_tkt(KSSL_CTX *kssl_ctx, krb5_data *indata,
|
|
||||||
krb5_ticket_times *ttimes, KSSL_ERR *kssl_err);
|
|
||||||
krb5_error_code kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session);
|
|
||||||
void kssl_err_set(KSSL_ERR *kssl_err, int reason, char *text);
|
|
||||||
void kssl_krb5_free_data_contents(krb5_context context, krb5_data *data);
|
|
||||||
krb5_error_code kssl_build_principal_2(krb5_context context,
|
|
||||||
krb5_principal *princ, int rlen,
|
|
||||||
const char *realm, int slen,
|
|
||||||
const char *svc, int hlen,
|
|
||||||
const char *host);
|
|
||||||
krb5_error_code kssl_validate_times(krb5_timestamp atime,
|
|
||||||
krb5_ticket_times *ttimes);
|
|
||||||
krb5_error_code kssl_check_authent(KSSL_CTX *kssl_ctx, krb5_data *authentp,
|
|
||||||
krb5_timestamp *atimep,
|
|
||||||
KSSL_ERR *kssl_err);
|
|
||||||
unsigned char *kssl_skip_confound(krb5_enctype enctype, unsigned char *authn);
|
|
||||||
|
|
||||||
void SSL_set0_kssl_ctx(SSL *s, KSSL_CTX *kctx);
|
|
||||||
KSSL_CTX *SSL_get0_kssl_ctx(SSL *s);
|
|
||||||
char *kssl_ctx_get0_client_princ(KSSL_CTX *kctx);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
# endif /* OPENSSL_NO_KRB5 */
|
|
||||||
#endif /* KSSL_H */
|
|
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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_MD2_H
|
||||||
|
# define HEADER_MD2_H
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_MD2
|
||||||
|
# include <stddef.h>
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
typedef unsigned char MD2_INT;
|
||||||
|
|
||||||
|
# define MD2_DIGEST_LENGTH 16
|
||||||
|
# define MD2_BLOCK 16
|
||||||
|
|
||||||
|
typedef struct MD2state_st {
|
||||||
|
unsigned int num;
|
||||||
|
unsigned char data[MD2_BLOCK];
|
||||||
|
MD2_INT cksm[MD2_BLOCK];
|
||||||
|
MD2_INT state[MD2_BLOCK];
|
||||||
|
} MD2_CTX;
|
||||||
|
|
||||||
|
const char *MD2_options(void);
|
||||||
|
int MD2_Init(MD2_CTX *c);
|
||||||
|
int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len);
|
||||||
|
int MD2_Final(unsigned char *md, MD2_CTX *c);
|
||||||
|
unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md);
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_OBJERR_H
|
||||||
|
# define HEADER_OBJERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_OBJ_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OBJ function codes.
|
||||||
|
*/
|
||||||
|
# define OBJ_F_OBJ_ADD_OBJECT 105
|
||||||
|
# define OBJ_F_OBJ_ADD_SIGID 107
|
||||||
|
# define OBJ_F_OBJ_CREATE 100
|
||||||
|
# define OBJ_F_OBJ_DUP 101
|
||||||
|
# define OBJ_F_OBJ_NAME_NEW_INDEX 106
|
||||||
|
# define OBJ_F_OBJ_NID2LN 102
|
||||||
|
# define OBJ_F_OBJ_NID2OBJ 103
|
||||||
|
# define OBJ_F_OBJ_NID2SN 104
|
||||||
|
# define OBJ_F_OBJ_TXT2OBJ 108
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OBJ reason codes.
|
||||||
|
*/
|
||||||
|
# define OBJ_R_OID_EXISTS 102
|
||||||
|
# define OBJ_R_UNKNOWN_NID 101
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2019 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_OCSPERR_H
|
||||||
|
# define HEADER_OCSPERR_H
|
||||||
|
|
||||||
|
# ifndef HEADER_SYMHACKS_H
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_OCSP
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int ERR_load_OCSP_strings(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OCSP function codes.
|
||||||
|
*/
|
||||||
|
# define OCSP_F_D2I_OCSP_NONCE 102
|
||||||
|
# define OCSP_F_OCSP_BASIC_ADD1_STATUS 103
|
||||||
|
# define OCSP_F_OCSP_BASIC_SIGN 104
|
||||||
|
# define OCSP_F_OCSP_BASIC_SIGN_CTX 119
|
||||||
|
# define OCSP_F_OCSP_BASIC_VERIFY 105
|
||||||
|
# define OCSP_F_OCSP_CERT_ID_NEW 101
|
||||||
|
# define OCSP_F_OCSP_CHECK_DELEGATED 106
|
||||||
|
# define OCSP_F_OCSP_CHECK_IDS 107
|
||||||
|
# define OCSP_F_OCSP_CHECK_ISSUER 108
|
||||||
|
# define OCSP_F_OCSP_CHECK_VALIDITY 115
|
||||||
|
# define OCSP_F_OCSP_MATCH_ISSUERID 109
|
||||||
|
# define OCSP_F_OCSP_PARSE_URL 114
|
||||||
|
# define OCSP_F_OCSP_REQUEST_SIGN 110
|
||||||
|
# define OCSP_F_OCSP_REQUEST_VERIFY 116
|
||||||
|
# define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111
|
||||||
|
# define OCSP_F_PARSE_HTTP_LINE1 118
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OCSP reason codes.
|
||||||
|
*/
|
||||||
|
# define OCSP_R_CERTIFICATE_VERIFY_ERROR 101
|
||||||
|
# define OCSP_R_DIGEST_ERR 102
|
||||||
|
# define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122
|
||||||
|
# define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123
|
||||||
|
# define OCSP_R_ERROR_PARSING_URL 121
|
||||||
|
# define OCSP_R_MISSING_OCSPSIGNING_USAGE 103
|
||||||
|
# define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124
|
||||||
|
# define OCSP_R_NOT_BASIC_RESPONSE 104
|
||||||
|
# define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105
|
||||||
|
# define OCSP_R_NO_RESPONSE_DATA 108
|
||||||
|
# define OCSP_R_NO_REVOKED_TIME 109
|
||||||
|
# define OCSP_R_NO_SIGNER_KEY 130
|
||||||
|
# define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110
|
||||||
|
# define OCSP_R_REQUEST_NOT_SIGNED 128
|
||||||
|
# define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111
|
||||||
|
# define OCSP_R_ROOT_CA_NOT_TRUSTED 112
|
||||||
|
# define OCSP_R_SERVER_RESPONSE_ERROR 114
|
||||||
|
# define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115
|
||||||
|
# define OCSP_R_SIGNATURE_FAILURE 117
|
||||||
|
# define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118
|
||||||
|
# define OCSP_R_STATUS_EXPIRED 125
|
||||||
|
# define OCSP_R_STATUS_NOT_YET_VALID 126
|
||||||
|
# define OCSP_R_STATUS_TOO_OLD 127
|
||||||
|
# define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119
|
||||||
|
# define OCSP_R_UNKNOWN_NID 120
|
||||||
|
# define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
@ -0,0 +1,160 @@
|
|||||||
|
/*
|
||||||
|
* {- join("\n * ", @autowarntext) -}
|
||||||
|
*
|
||||||
|
* Copyright 2016-2020 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <openssl/opensslv.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef OPENSSL_ALGORITHM_DEFINES
|
||||||
|
# error OPENSSL_ALGORITHM_DEFINES no longer supported
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OpenSSL was configured with the following options:
|
||||||
|
*/
|
||||||
|
|
||||||
|
{- if (@{$config{openssl_sys_defines}}) {
|
||||||
|
foreach (@{$config{openssl_sys_defines}}) {
|
||||||
|
$OUT .= "#ifndef $_\n";
|
||||||
|
$OUT .= "# define $_ 1\n";
|
||||||
|
$OUT .= "#endif\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (@{$config{openssl_api_defines}}) {
|
||||||
|
(my $macro, my $value) = $_ =~ /^(.*?)=(.*?)$/;
|
||||||
|
$OUT .= "#define $macro $value\n";
|
||||||
|
}
|
||||||
|
if (@{$config{openssl_algorithm_defines}}) {
|
||||||
|
foreach (@{$config{openssl_algorithm_defines}}) {
|
||||||
|
$OUT .= "#ifndef $_\n";
|
||||||
|
$OUT .= "# define $_\n";
|
||||||
|
$OUT .= "#endif\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (@{$config{openssl_thread_defines}}) {
|
||||||
|
foreach (@{$config{openssl_thread_defines}}) {
|
||||||
|
$OUT .= "#ifndef $_\n";
|
||||||
|
$OUT .= "# define $_\n";
|
||||||
|
$OUT .= "#endif\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (@{$config{openssl_other_defines}}) {
|
||||||
|
foreach (@{$config{openssl_other_defines}}) {
|
||||||
|
$OUT .= "#ifndef $_\n";
|
||||||
|
$OUT .= "# define $_\n";
|
||||||
|
$OUT .= "#endif\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"";
|
||||||
|
-}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers
|
||||||
|
* don't like that. This will hopefully silence them.
|
||||||
|
*/
|
||||||
|
#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the
|
||||||
|
* declarations of functions deprecated in or before <version>. Otherwise, they
|
||||||
|
* still won't see them if the library has been built to disable deprecated
|
||||||
|
* functions.
|
||||||
|
*/
|
||||||
|
#ifndef DECLARE_DEPRECATED
|
||||||
|
# define DECLARE_DEPRECATED(f) f;
|
||||||
|
# ifdef __GNUC__
|
||||||
|
# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
|
||||||
|
# undef DECLARE_DEPRECATED
|
||||||
|
# define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated));
|
||||||
|
# endif
|
||||||
|
# elif defined(__SUNPRO_C)
|
||||||
|
# if (__SUNPRO_C >= 0x5130)
|
||||||
|
# undef DECLARE_DEPRECATED
|
||||||
|
# define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated));
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef OPENSSL_FILE
|
||||||
|
# ifdef OPENSSL_NO_FILENAMES
|
||||||
|
# define OPENSSL_FILE ""
|
||||||
|
# define OPENSSL_LINE 0
|
||||||
|
# else
|
||||||
|
# define OPENSSL_FILE __FILE__
|
||||||
|
# define OPENSSL_LINE __LINE__
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef OPENSSL_MIN_API
|
||||||
|
# define OPENSSL_MIN_API 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API
|
||||||
|
# undef OPENSSL_API_COMPAT
|
||||||
|
# define OPENSSL_API_COMPAT OPENSSL_MIN_API
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Do not deprecate things to be deprecated in version 1.2.0 before the
|
||||||
|
* OpenSSL version number matches.
|
||||||
|
*/
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10200000L
|
||||||
|
# define DEPRECATEDIN_1_2_0(f) f;
|
||||||
|
#elif OPENSSL_API_COMPAT < 0x10200000L
|
||||||
|
# define DEPRECATEDIN_1_2_0(f) DECLARE_DEPRECATED(f)
|
||||||
|
#else
|
||||||
|
# define DEPRECATEDIN_1_2_0(f)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||||
|
# define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f)
|
||||||
|
#else
|
||||||
|
# define DEPRECATEDIN_1_1_0(f)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if OPENSSL_API_COMPAT < 0x10000000L
|
||||||
|
# define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f)
|
||||||
|
#else
|
||||||
|
# define DEPRECATEDIN_1_0_0(f)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if OPENSSL_API_COMPAT < 0x00908000L
|
||||||
|
# define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f)
|
||||||
|
#else
|
||||||
|
# define DEPRECATEDIN_0_9_8(f)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Generate 80386 code? */
|
||||||
|
{- $config{processor} eq "386" ? "#define" : "#undef" -} I386_ONLY
|
||||||
|
|
||||||
|
#undef OPENSSL_UNISTD
|
||||||
|
#define OPENSSL_UNISTD {- $target{unistd} -}
|
||||||
|
|
||||||
|
{- $config{export_var_as_fn} ? "#define" : "#undef" -} OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following are cipher-specific, but are part of the public API.
|
||||||
|
*/
|
||||||
|
#if !defined(OPENSSL_SYS_UEFI)
|
||||||
|
{- $config{bn_ll} ? "# define" : "# undef" -} BN_LLONG
|
||||||
|
/* Only one for the following should be defined */
|
||||||
|
{- $config{b64l} ? "# define" : "# undef" -} SIXTY_FOUR_BIT_LONG
|
||||||
|
{- $config{b64} ? "# define" : "# undef" -} SIXTY_FOUR_BIT
|
||||||
|
{- $config{b32} ? "# define" : "# undef" -} THIRTY_TWO_BIT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define RC4_INT {- $config{rc4_int} -}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue